I made the following file: asn_format_mykey.txt
asn1=SEQUENCE:rsa_key
[rsa_key]
version=INTEGER:0
modulus=INTEGER:305512047893009
pubExp=INTEGER:78221649299689
privExp=INTEGER:181909
p=INTEGER:17477423
q=INTEGER:17480383
e1=INTEGER:181909
e2=INTEGER:181909
coeff=INTEGER:1611938
I run the following commands to get key.pem
(private key) and pkey.pem
(public key)
openssl asn1parse -genconf "asn_format_mykey.txt" -out "key.der"
openssl rsa -inform der -in "key.der" -outform pem > "key.pem"
openssl rsa -inform der -in "key.der" -outform pem -pubout>"pkey.pem"
Then, I try to encrypt a small message using -raw
with openssl rsautl
echo 'aaaa'| openssl rsautl -encrypt -pubin -inkey "pkey.pem" -raw -out "message.encrypted"
and it returns:
RSA operation error 140063665198744:error:0406B07A:rsa
routines:RSA_padding_add_none:data too small for key
size:rsa_none.c:74:
Any idea how to fix this?
e1=INTEGER:17477422 e2=INTEGER:17480382 coeff=INTEGER:305512012935204
? It looks like a cut and paste error ( as the Private Expo was correctly set to181909
) – rustyMagnet Apr 29 '20 at 12:29