# Insecure private-key encryption

I am learning about crytography and the differences between the public and private keys encryption examples and I was wondering if it is possible to have a private key encryption scheme that is completely insecure? I have not been able to find what that could look like but I'm curious? Or is this not possible? Is the encryption scheme always secure with private keys?

Any encryption scheme can be insecure if the key space is small enough.

For example, you could perform encryption with an 8 bit RSA key. For a key of that size, it's trivial to determine the private key given the public key.

• would this be true even with a small message space? Or that wouldn't factor in? – droidnoob Feb 24 at 14:34
• @droidnoob If your key is insecure nothing else matters. For example given an 8 bit RSA public key with exponent 3 modulus 187, it's trival to factor the modulus into 11 and 17, calculate lamda(187) = lcm(11-1,17-1) = 80, then calculate the private exponent d = 3^-1 mod 80 = 27. – dbush Feb 24 at 14:53
• thanks for reply. can I ask you one more? What if the key is completely secure and protected, would there be any way to have a completely secure key but insecure scheme? – droidnoob Feb 24 at 14:57
• @droidnoob If you mean a poorly designed encryption algorithm, then yes. – dbush Feb 24 at 15:00
• You could derive a subkey in your scheme that is much smaller than the input key, e.g. by hashing it and taking the leftmost bits. The original, large key could be completely secure - protected by the cryptographic hash - but you have again an encryption scheme with a small key space. Presto. – Maarten - reinstate Monica Feb 24 at 16:25

What if the key is completely secure and protected, would there be any way to have a completely secure key but insecure scheme?

Yes, certainly. For example, consider the following encryption scheme:

• The key is a 256 bit (or, heck, 512 or 1024 bit if you want) string chosen uniformly at random by a cryptographically secure true random number generator, stored securely in a locked vault deep underground, with multiple armed guards watching the entrance 24/7.

• The encryption method doesn't use the key for anything, and instead encrypts the data using rot13.

• The decryption method is the same as the encryption method.

• I have some optimizations in mind for your scheme, I think we can improve its efficiency by using the identity function instead of rot13. Furthermore, the identity function is an old, well-known and well-studied object, used often in cryptography - much more often than rot13. Hence I would suggest going for this conservative yet highly optimized option (I think there is even hardware support for identity, unlike rot13) – Geoffroy Couteau Feb 25 at 13:04