export only public key from my.key
a) openssl rsa -in alice.pem -RSAPublicKey_out -out alice_pub.pem
b) openssl rsa -in alice.pem -pubout -out alice_pub2.pem
The two approaches generate different footers in .pem: the first one outputs
--Begin RSA public key ----, and the second outputs
-- Begin Public key ----
When using openssl asn1parse to analyze the two public key pem files, openssl asn1 parse -inform PEM -in alice_pub.pem, something unexpected happened.
For alice_pub.pem, it works good; for alice_pub2.pem, openssl is unable to extract the "N" and "E" parameters indicating they have been "rsaEncryption".
Openssl can only transform the second pem to DER, however, the pem content is obviously incorrect...
pls let me know how to solve this problem. Many thanks. This issue can be reproduced easily.