[ACCEPTED]-Converting PrivateKey to pem string without using bouncycastle-pem
PEMWriter class from BouncyCastle stores 10 private key in PKCS#1 format (for more details 9 please see RsaPrivateKey stucture defined 8 in RFC 3447):
Your code stores private key in PKCS#8 7 format (for more details please see PrivateKeyInfo 6 structure defined in RFC 5208):
PKCS#1 defines how 5 to store RSA keys while PKCS#8 defines an 4 envelope that can store any asymmetric key 3 pair. As you can see on the attached pictures 2 PKCS#8 just envelopes PKCS#1 and specifies 1 that key is usable with RSA algorithm.
More Related questions