Bonjour, Without knowing what functions you’re calling when you try to encrypt data using the key Key3_wo16, I can only guess. And I’m guessing that you’re calling a function that expects to find a public
key encoded in a SubjectPublicKeyInfo structure, and since this Key3_wo16 object is not such a structure, the function fails. What you can do is :
Cordialement, Erwann Abalea De : prithiraj das <prithiraj.das@xxxxxxxxx> Hi Erwann/All, Thank you for your earlier response. I have done a couple of tests on the originally generated 2048-bit RSA public key (let's say
Key1_org) and the key file containing 16 byte custom information after removing 24 bytes from the originally generated key file and prepending those 16 bytes (let's say
Key2_w16). For my experiment(s), I also removed those 16 bytes from the key Key2_w16 (which contains custom information) and the rest of the bytes were written into a file. Lets name this keyfile Key3_wo16. I believe the presence of custom
16 byte information resulted in asn1parse encoding/decoding errors as mentioned in the previous mail.. So now, Key3_wo16 = Key2_w16 - the first 16 bytes = Key1_org - the first 24 bytes. And I performed
asn1parse on Key3_wo16. The output of asn1parse on this key is shown in the image file
asn1parse of 24 byte removed.jpg which is attached in the mail. And I also performed 2
asn1parse strparse opertions on the originally generated public key Key1_org
with strparse offsets 19 and 24. I have attached screenshots of the same with names
asn1parse strparse 19.jpg and asn1parse strparse 24.jpg respectively. The outputs in all cases are the same. In the screenshots, the (removed/blurred) respective INTEGER values in all screenshots are the same. What I want to know is why is OpenSSL throwing an error when try to encrypt data using the key Key3_wo16?
The same command used for encryption works when the key Key1_org is used.
I believe the INTEGER values contain the modulus and exponent information and so, I was expecting the encryption to be successful but OpenSSL fails to accept this key. Can anyone please tell me what is going wrong here? Apart from the solution suggested by Erwann , can anyone please suggest an alternative solution as we need to work with the Key2_w16 ( the key containing the custom 16 byte information
after removing the originally present first 24 bytes)? That is the only keyfile received by us. Thanks and Regards, Prithiraj On Wed, 12 Dec 2018 at 12:32, Erwann Abalea via openssl-users <openssl-users@xxxxxxxxxxx> wrote:
|
-- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users