Understand RSA key formats (PKCS#1 vs PKCS#8/PKIX)
masterThe package supports two primary formats. Note that encryption uses public keys, and for modern formats, public keys use the PKIX (X.509) standard, not PKCS#8.
| Format | Private Key PEM Header | Public Key PEM Header |
|---|---|---|
| PKCS#1 | -----BEGIN RSA PRIVATE KEY----- | -----BEGIN RSA PUBLIC KEY----- |
| PKCS#8/PKIX | -----BEGIN PRIVATE KEY----- | -----BEGIN PUBLIC KEY----- |
Important Note on PKCS#8/PKIX:
When using modern keys, a "PKCS#8 key pair" actually consists of a PKCS#8 formatted private key and a PKIX/SubjectPublicKeyInfo formatted public key. The function EncryptPKIX is the correct way to encrypt using these modern public keys.