Skip to content

PKCS#8 export with PBES2 encryption - #828

Open
karel-m wants to merge 8 commits into
developfrom
pr/pbes2-writer
Open

karel-m wants to merge 8 commits into
developfrom
pr/pbes2-writer

Conversation

@karel-m

@karel-m karel-m commented Nov 17, 2026

Copy link
Copy Markdown
Member

Adds the write side for PKCS#8 keys, which so far could only be read.

  • pbes2_encrypt() - encrypts a PrivateKeyInfo into an EncryptedPrivateKeyInfo (PBES2 with PBKDF2 and AES or 3DES in CBC mode)
  • pka_key_export() - PKCS#8 or SubjectPublicKeyInfo export of any ltc_pka_key
  • pem_encode_pkcs() + pem_encode_pkcs_filehandle() - PEM output according to RFC 7468 (PRIVATE KEY, ENCRYPTED PRIVATE KEY, PUBLIC KEY)

Three commits fix bugs that are already in develop and are not directly related to PBES2. They were found while working on this:

  • fix base64_encode_pem line breaks
  • make ecc_export_openssl compliant with RFC 5915
  • fix ecc_export_openssl - pad curve coefficients a and b to the field size

@karel-m
karel-m requested a review from sjaeckel November 17, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant