Notes

PKCS#1

PKCS #1

RSA Public key can be generate from private key:

[nix-shell:/tmp]$ openssl rsa -in test.key -outform PEM -pubout
writing RSA key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6Wpoq3tz8BRyJOU18cJK
D+4lVGBz94lpRLfAAK3mjEWbIbeQ/uElnyGbq0Fe+XRMBdVpI5B5PQbM8kf6sNYv
n7BM+dRVq1LuRGmxjL/i+CW7VRWiIZxHWNF/eCaqn3j2hij81NK22m13eFMSOELo
76G6TDtEbv5rqJdhrJw6BlCbslHXNr4rT+q0R2ajricbY/xig/bz6mOetjgxoL6X
WiuJibtAYqGa7+iQse1icFz3SWCwwZjYE46uW1rUI7iyugRBhdVMiypPDj00wdak
77NiaiFw91Vl1EfZo09b8ztcSjBKWeE0tte8Iy5+AhKsC59/hE2wIFj5TnxVE4JC
kwIDAQAB
-----END PUBLIC KEY-----

The output of the public key is in PKCS#1 in ASN.1 syntax DER encoded in PEM format.

PKCS#1 represent RSA public key ASN.1 as

RSAPublicKey:

      RSAPublicKey ::= SEQUENCE {
          modulus           INTEGER,  -- n
          publicExponent    INTEGER   -- e
      }

You can read the same information as ASN.1 from

[nix-shell:/tmp]$ openssl rsa -in test.key -pubout -out test.pem
[nix-shell:/tmp]$ openssl rsa -in test.pem -pubin -noout -text
RSA Public-Key: (2048 bit)
Modulus:
    00:e9:6a:68:ab:7b:73:f0:14:72:24:e5:35:f1:c2:
    4a:0f:ee:25:54:60:73:f7:89:69:44:b7:c0:00:ad:
    e6:8c:45:9b:21:b7:90:fe:e1:25:9f:21:9b:ab:41:
    5e:f9:74:4c:05:d5:69:23:90:79:3d:06:cc:f2:47:
    fa:b0:d6:2f:9f:b0:4c:f9:d4:55:ab:52:ee:44:69:
    b1:8c:bf:e2:f8:25:bb:55:15:a2:21:9c:47:58:d1:
    7f:78:26:aa:9f:78:f6:86:28:fc:d4:d2:b6:da:6d:
    77:78:53:12:38:42:e8:ef:a1:ba:4c:3b:44:6e:fe:
    6b:a8:97:61:ac:9c:3a:06:50:9b:b2:51:d7:36:be:
    2b:4f:ea:b4:47:66:a3:ae:27:1b:63:fc:62:83:f6:
    f3:ea:63:9e:b6:38:31:a0:be:97:5a:2b:89:89:bb:
    40:62:a1:9a:ef:e8:90:b1:ed:62:70:5c:f7:49:60:
    b0:c1:98:d8:13:8e:ae:5b:5a:d4:23:b8:b2:ba:04:
    41:85:d5:4c:8b:2a:4f:0e:3d:34:c1:d6:a4:ef:b3:
    62:6a:21:70:f7:55:65:d4:47:d9:a3:4f:5b:f3:3b:
    5c:4a:30:4a:59:e1:34:b6:d7:bc:23:2e:7e:02:12:
    ac:0b:9f:7f:84:4d:b0:20:58:f9:4e:7c:55:13:82:
    42:93
Exponent: 65537 (0x10001)

So far all these PKCS are UNENCRYPTED, they are just encoded in certain format.

There is a common standard for store and exchange certs and keys that is encypted - PKCS#12