I have a piece of hardware that contains a public key. I send a Get Challenge in cleartext and am returned a 128-byte cryptogram encrypted by the RSA Public Key in the device.
When I decrypt the 128 bytes using PrivateKey.CalculateInverst(), the result is 127 bytes instead of 128. Everything is shifted down 1 byte, so I can hack the return value but I really want to figure out why the returned result is minus a byte. The clear-text decrypted output is supposed to be: PKCS#1 byte 00 (This byte is missing in my result.) PKCS#1 byte 02 PKCS#1 bytes[92] random octet string PKCS#1 byte 00 byte [33 bytes] message with Challenge response But I get back the valid padding and challenge response, except the first byte (PKCS#1Ver 1.5 byte 00) is missing and everything is shifted down by one byte. Does anyone know why this byte is being stripped? I think it must have something to do with various algorithms used for generating and parsing PKCS#1 V1.5 padding, but I don't see any obvious way to specify variations on the algorithm. I have to use the low-level RSA interface because the hardware is in the field and cannot be altered. Any suggestions would be appreciated. I have hacked a solution by shifting the decode up one byte, but I don't think this is a reliable solution for the long term. TIA -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
