In Public key infra structure, The MD5 of the data is encrypted with private key of sender and this encypted md5 along with the data is again encryted using AES or 3DES algo. here key used to encrypt with AES is encrypted with private key of sender. Is this correct?
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- key to encrypt, param 2- DATA and hash are concatnated
encryptkey = RSAENCRYPT(privatekey,KEY)// AES key encrypted with private key of sender
masterKEY = RSAENCRYPT(publickey,KEY)// encryptkey encrypted with public key of receiver
its a rough implementation. Am I right?
RSAENCRYPTto sign a hash is wrong; the role ofencryptkeyis unclear at best (why is is computed? who will get to know it?); the formula for computation ofmasterKEY(which makes sense) does not match the comment alongside (and I fail to grasp its intend). See this answer – fgrieu Nov 23 '12 at 16:20