Hi Jo,
Thanks again for all your input and continued assistance.
That's interesting about the padding as I note the following from the docs:
use_pkcs1_oaep_padding Use EME-OAEP padding as defined in PKCS #1 v2.0 with SHA-1, MGF1 a +nd an empty encoding parameter. This mode of padding is recommended f +or all new applications. It is the default mode used by Crypt::OpenSS +L::RSA.
I tried adding the padding option, as you suggested and was able to encrypt and decrypt text.
Perhaps something that I should have done earlier was to dig out the hex editor and see if the data that I was reading from the file was really what I was reading from the file. As it turned out, I wasn't quite on the mark and so wasn't reading the correct data, which meant that sometimes it was > modulus. After correcting the read(), the blocks all decrypted and the data looked as expected, the second block containing lots of 0x00 padding. The blocks contain a 56 byte blowfish key, which I had believe was 40 bytes in the first block and the remaining 16 bytes in the second block, padded out with zeros. I too had wondered how to fit the data into the first block if it needs to be less than the modulus. As it turns out the answer was rather obvious. There's 39 bytes of the key in the first block, with a leading 0x00 pad and the remaining 17 in the second block with lots of 0x00 padding.
Thanks again for your assistance with this, it's been eating far too much of my time recently!
BOfHIn reply to Re^2: Importing keys into Crypt::Openssl::RSA
by BOfH
in thread Importing keys into Crypt::Openssl::RSA
by BOfH
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |