1
$\begingroup$

While XOR is used as simple symmetric encryption with arbitrary custom key, what is a simple asymmetric encryption that use arbitrary custom key?

That means I want to be able to set custom private key or public key (in ASCII format).

Expectation:

pub = "mypubkey"
pri = "myprivkey"
msg = "hello world"

encrypted_msg = encrypt(msg, pub)
decrypted_msg = decrypt(encrypted_msg, pri)

print(decrypted_msg) # "hello world"
$\endgroup$
2
  • $\begingroup$ There are many asymmetric algorithms with predefined presets for achieving a certain security level, but some of them notice that the user can modify their presets to achieve a desired security. With McEliece you can use many security parameters for achieving your goal: en.wikipedia.org/wiki/McEliece_cryptosystem $\endgroup$
    – alpominth
    Jul 3, 2023 at 7:04
  • 3
    $\begingroup$ Modern cryptography operates on bits and bytes, not ASCII characters. For e.g. Elliptic Curve private keys, the key is a (derived) random value in the range 1..N with N being the field size. For practicing calculations you could use tiny insecure RSA primes that are represented by a character, but I don't see the point of that. In the end asymmetric algorithms mostly operate on fields represented by numbers, not characters. $\endgroup$
    – Maarten Bodewes
    Jul 3, 2023 at 10:07

2 Answers 2

5
$\begingroup$

With the standard definition of public key encryption (or signature), it's not possible to make the public key arbitrary†. If it was, the method to find a matching private key from public key would allow decryption (or signature).

It's possible, and common, that the private key is arbitrary (in some interval, which is easily extended to arbitrary text).

With Identity Based Encryption, each user's public key is arbitrary, and the authority's private key can be arbitrary. But user private (decryption) keys and the authority's public key can't be arbitrary. And it's not public key encryption by standard definition, since a user can't autonomously generate their keypair.


It's even less possible to make both public and private keys arbitrary, which would imply that anything is the private key of any public key.

$\endgroup$
0
$\begingroup$

If such silver bullet had existed, it'd already been discovered. And since it hasn't, we can safely assume it doesn't exist.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.