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.
Decrypt CryptoAPI SIMPLEBLOB in Java
-
04-06-2022 - |
Pergunta
Here is my process:
CryptoAPI:
- Generate AES session key
- Use recipient's public key to encrypt and export (1) in a SIMPLEBLOB with RSA
- Send SIMPLEBLOB to recipient
Java:
- Recipient receives (3)
- 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.
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow