Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to make an encryption algorithm that can be encrypted by the md5(or any other one way encryption algorithm) of the key and decrypted by the key?

The purpose of this would be for the user to receive the md5 of a randomly generated key, encrypt something with it and send it back to the server. Even if both the key and the encrypted data would be intercepted, it would be undecryptable since only the server knows the decryption key.

share|improve this question

closed as unclear what you're asking by tylerl, NULLZ, Terry Chia, Lucas Kauffman, Xander Jul 28 '13 at 15:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

@TildalWave The server sends the md5'd key and the client encrypts it and sends back the encrypted string to the server. The server knows the non-md5 since it generated it. Read the question before downvoting – Runemoro Jul 27 '13 at 16:49
I've read your question, no need to presume anything about me either - my reading or my voting habits. Explaining what part of your question you believe I've misunderstood is quite sufficient, thank you very much! – TildalWave Jul 27 '13 at 18:25
What you're saying doesn't really make a whole heap of sense. I would suggest reading up a bit on how encryption works. – tylerl Jul 27 '13 at 22:53
up vote 3 down vote accepted

Even if both the key and the encrypted data would be intercepted, it would be undecryptable since only the server knows the decryption key.

This is exactly how asymmetric cryptographic systems work normally. In an asymmetric public-key encryption system, an entity holds two keys in a "keypair": a public key P and a private key R. The system defines two operations, Enc(message, P) (encryption with the public key) and Dec(ciphertext, R) (decryption with the private key) such that Dec(Enc(msg, P), R) == msg. The public key is available to all, in order to encrypt messages, but only the entity that owns the keypair knows the private key, so it is the only one who can decrypt messages.

Your requirements have defined a hypothetical public-key crypto system in which the public key is generated by the hash of the private key. Just use an established public-key system; that will satisfy the general requirements described in your last sentence.

share|improve this answer
With finite field or elliptic curve based crypto deriving a public key from the private key looks very similar to hashing. You use a simple random value (in a certain range) as private key, and apply a one-way function to get the public key. – CodesInChaos Jul 27 '13 at 16:01

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