Question

Here is my process:

CryptoAPI:

  1. Generate AES session key
  2. Use recipient's public key to encrypt and export (1) in a SIMPLEBLOB with RSA
  3. Send SIMPLEBLOB to recipient

Java:

  1. Recipient receives (3)
  2. Recipient wants to decrypt SIMPLEBLOB using his private key

This is pretty standard I believe. There is a need to byte reverse the received byte array (from step 4 above). However, for some reason, the number of bytes received is above the maximum allowable number of bytes that RSA algorithm can decrypt. The error is "javax.crypto.IllegalBlockSizeException: Data must not be longer than 256 bytes". So there is something else going on that I don't understand. Can someone explain how to properly decrypt the SIMPLEBLOB in Java? Resources would help.

Was it helpful?

Solution

Have a look at this page: SIMPLEBLOB structure The first 12 Bytes of the blob belong to BLOBHEADER. To decrypt the key, start from the 12th position of the encrypted blob.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top