-1

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?

e-sushi
  • 17,891
  • 12
  • 83
  • 229
  • 1
    How about reading PKCS#1 ? – CodesInChaos Nov 22 '12 at 18:30
  • You are doing it wrong. Encryption of hash with RSA private key is called signing. Note, that RSA is one of the few ciphers that provide signature as encryption with private key. The goal of second operation is not clear. Why you encrypt a symmetric key? I see you need classic sign-then-encrypt scheme. – Pavel Ognev Nov 23 '12 at 06:35
  • 1
    This question badly needs repair before it can be answered meaningfully. In particular it is unclear which public/private key belongs to who (sender/receiver); the use of RSAENCRYPT to sign a hash is wrong; the role of encryptkey is unclear at best (why is is computed? who will get to know it?); the formula for computation of masterKEY (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
  • I guess this should probably be opened and reclosed as "too specific". Unless the original questioner comes back or someone else comments that they have also had this problem, I'll find it hard to believe this will be of general use – Cryptographeur Mar 27 '14 at 18:30