micro509/pkcs
PKCS container APIs: PFX/PKCS#12 and PKCS#7/CMS.
Package keys and certificates with createPfx, then read them with parsePfxDer. Use createPkcs7SignedData and verifyPkcs7SignedData for signed content.
Functions
createPfx— Builds a PKCS#12/PFX archive containing certificates and/or private keys.parsePfxDer— Decodes a BER- or DER-encoded PKCS#12/PFX container into its constituent bags.parsePfxPem— Decodes a PEM-armored PKCS#12/PFX container. Expects exactly onePKCS12block.createPkcs7CertBag— Creates a degenerate PKCS#7 SignedData structure containing onlycreatePkcs7SignedData— Creates a PKCS#7/CMS SignedData with one or more signers overcontent.parsePkcs7CertBagDer— Parses a DER-encoded PKCS#7 cert bag, returning the contained certificates.parsePkcs7CertBagPem— Parses a PEM-armored PKCS#7/CMS cert bag. Expects exactly onePKCS7orCMSPEM block.parsePkcs7SignedDataDer— Decodes a DER-encoded PKCS#7 ContentInfo expectingsignedDatacontent type.parsePkcs7SignedDataPem— Decodes a PEM-armored PKCS#7/CMS SignedData. Expects exactly onePKCS7orCMSPEM block.verifyPkcs7SignedData— Verifies all signer signatures in a PKCS#7 SignedData structure.createPkcs12MacData— Computes a PKCS#12 MAC over the AuthenticatedSafe and returns the DER-encoded MacDataparsePkcs12MacData— Decodes a DER-encoded MacData block. Whenpasswordis provided, verifiesparsePkcs12MacDataOrThrow— Throwing core forparsePkcs12MacData. Whenpasswordis
Types
CreatePfxErrorCode— Caller-correctable failure code fromcreatePfx.CreatePfxFailure— Error payload for a failed PFX creation.CreatePfxInput— Input forcreatePfx.CreatePfxResult— Success-or-failure result fromcreatePfx.KdfLimitOptions— Caller-supplied bound on password-based KDF work.ParsedPfx— Fully decoded PFX container returned byparsePfxDer/parsePfxPem.ParsedPfxAttribute— A single PKCS#12 bag attribute as decoded byparsePfxDer.ParsedPfxBag— Discriminated union of SafeBag types decoded from a PFX container.ParsedPfxBagAttributes— Decoded bag attributes for a single SafeBag inside a PFX.ParsePfxErrorCode— Error codes returned byparsePfxDerandparsePfxPem.ParsePfxFailure— Error payload for a failed PFX parse.ParsePfxOptions— Options forparsePfxDerandparsePfxPem.ParsePfxResult— Success-or-failure result fromparsePfxDer/parsePfxPem.PfxBagAttributesInput— Optional metadata attached to a certificate or key bag inside a PFX.PfxCertificateBagInput— A certificate to embed in a PFX container. Input forcreatePfx.PfxCertificateSource— PEM string or DER bytes for a certificate to include in a PFX bag.PfxEncoderErrorCode— Bag attribute input thatcreatePfxrefuses by throwing aResultError.PfxEncryptionOptions— PBES2 encryption settings for PFX key-bag protection. Alias ofEncryptedPkcs8Options.PfxMaterial— DER, PEM, and base64 encodings of a PFX container produced bycreatePfx.PfxPrivateKeyBagInput— A private key to embed in a PFX container. Input forcreatePfx.PfxPrivateKeySource— A WebCrypto private key or raw PKCS#8 DER bytes for a PFX key bag.CreatePkcs7CertBagErrorCode— Caller-correctable failure code fromcreatePkcs7CertBag.CreatePkcs7CertBagFailure— Error payload for a failed PKCS#7 certificate bag creation.CreatePkcs7CertBagResult— Success-or-failure result fromcreatePkcs7CertBag.CreatePkcs7SignedDataErrorCode— Caller-correctable failure codes fromcreatePkcs7SignedData.CreatePkcs7SignedDataFailure— Error payload for a failed PKCS#7 SignedData creation.CreatePkcs7SignedDataInput— Input forcreatePkcs7SignedData.CreatePkcs7SignedDataResult— Success-or-failure result fromcreatePkcs7SignedData.ParsedCertificateChoice— One RFC 5652 §10.2.2 CertificateChoices alternative.ParsedPkcs7SignedData— Decoded PKCS#7 SignedData content, including certificates and signer info.ParsedPkcs7SignerInfo— A single SignerInfo decoded from a PKCS#7 SignedData structure.ParsedPkcs7SignerInfoBase— Fields shared by every decoded SignerInfo, regardless of signed-attribute presence.ParsedSignerIdentifier— RFC 5652 §5.3 `SignerIdentifier ::= CHOICE { issuerAndSerialNumber,ParsePkcs7CertBagResult— Success-or-failure result fromparsePkcs7CertBagDer/parsePkcs7CertBagPem.ParsePkcs7ErrorCode— Error codes for PKCS#7 parse failures.ParsePkcs7Failure— Error payload for a failed PKCS#7 parse.ParsePkcs7SignedDataResult— Success-or-failure result fromparsePkcs7SignedDataDer/parsePkcs7SignedDataPem.Pkcs7CertBagMaterial— DER, PEM, and base64 encodings of a PKCS#7 certificate bag.Pkcs7CertificateSource— PEM text (may contain multiple CERTIFICATE blocks), raw DER bytes, or an already-parsed certificate.Pkcs7SignedDataMaterial— DER, PEM, and base64 encodings of a PKCS#7/CMS SignedData structure.Pkcs7Signer— A single signer forcreatePkcs7SignedData.VerifiedPkcs7Signer— A SignerInfo paired with the certificate that verified its signature.VerifyPkcs7SignedDataErrorCode— Error codes forverifyPkcs7SignedDatafailures.VerifyPkcs7SignedDataFailure— Error payload for a failedverifyPkcs7SignedDatacall.VerifyPkcs7SignedDataOptions— Options forverifyPkcs7SignedData.VerifyPkcs7SignedDataResult— Success-or-failure result fromverifyPkcs7SignedData.CreatePkcs12MacDataErrorCode— Machine-readable reasoncreatePkcs12MacDatarejected its construction input.ParsedPkcs12MacData— Decoded PKCS#12 MacData block returned byparsePkcs12MacData.typenames theParsePkcs12MacDataErrorCode— Machine-readable failure reason forparsePkcs12MacData.ParsePkcs12MacDataFailure— Structured failure payload for MacData parsing.ParsePkcs12MacDataOptions— Options forparsePkcs12MacDataandparsePkcs12MacDataOrThrow.ParsePkcs12MacDataResult— Success-or-failure result fromparsePkcs12MacData.Pkcs12MacOptions— Input forcreatePkcs12MacData.typeselects the MAC:'pkcs12-kdf'(the