In Public key infrastructure, the MD5 of a piece of data is encrypted with the private key of a sender and this encrypted MD5 – along with the data – is again encrypted using an algorithm like AES or 3DES.
Here, the private key of a sender is used to encrypt with AES… is that correct?
This is a rough implementation of what I think I’ve understood:
- DATA
= text which should be send through PKI hash = MD5(DATA) - encrypthash = RSAENCRYPT(privatekey,hash)
= hash encrypted using private key of sender - cipher= AES(KEY,DATA+hash)
= param 1 is the key to encrypt, and param 2 is the DATA and hash which have been concatenated - encryptkey = RSAENCRYPT(privatekey,KEY)
= AES key, encrypted with private key of sender - masterKEY = RSAENCRYPT(publickey,KEY)
= encryptkey, encrypted with public key of receiver
Is this correct, or am I missing something important?