Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PKCS12

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

RFC 7292 PFX container (.p12/.pfx) holding keys and certificates inside a DER structure: outer SEQUENCE, version 3, authSafe ContentInfo, optional macData.

Structure

From RFC 7292 (section 4 and appendix ASN.1):

PFX ::= SEQUENCE { version INTEGER {v3(3)}, authSafe ContentInfo, macData MacData OPTIONAL }
MacData ::= SEQUENCE { mac DigestInfo, macSalt OCTET STRING, iterations INTEGER DEFAULT 1 }
AuthenticatedSafe ::= SEQUENCE OF ContentInfo

So a PFX file is DER (see Format:ASN.1 DER and BER) and begins with 30 82 xx xx (or 30 80 when produced with BER indefinite lengths, Unverified) then 02 01 03 (INTEGER 3) and the authSafe ContentInfo (a SEQUENCE whose first element is an OID, typically pkcs7-data or pkcs7-signedData). The bags inside AuthenticatedSafe are unencrypted or password-encrypted ContentInfos. Password-based encryption OIDs are under the pkcs12-pbeids arc (1.2.840.113549.1.12.1.n; 3 is pbeWithSHA1And3-KeyTripleDES-CBC, 6 pbeWithSHA1And40BitRC2-CBC per OpenSSL objects.txt).

Recognition: file starts 30 8x ... then 02 01 03 30. Unverified: the exact bytes after authSafe length. This page does not describe cracking the password.

Technique:Recognizing embedded keys and certificates

Code & repositories

  • https://github.com/openssl/openssl @ cfb89e50a06a00917bdfa6142665ffee08ca79bd · license: Apache-2.0
    OpenSSL: include/openssl/pem.h PEM labels and crypto/objects/objects.txt OID tree.
    Tested on: source read, not run: source reading only · checked 2026-10-19; last activity 2026-10-19