What is PKCS #8 (private key information syntax)?

PKCS #8 is the standard container for private keys, defined today by RFC 5958. Post-quantum keys such as ML-DSA and ML-KEM are packaged in it, so inventories and vendor answers need to name the structure correctly.

On this page

What is PKCS #8 and where does it appear in post-quantum work?

You most likely met PKCS #8 in a key file, a vendor answer or a tender requirement that asked whether private keys are stored in a standard format. PKCS #8 is the Private-Key Information Syntax, the standard container for private keys. Its original RSA Laboratories version 1.2 was republished as RFC 5208 in May 2008 as an Informational document that moved change control to the IETF. RFC 5958 now obsoletes RFC 5208 and defines its successor structure, OneAsymmetricKey, which keeps backward compatibility through a version field. When a document says PKCS #8, check whether it means the older PrivateKeyInfo form or the newer OneAsymmetricKey structure, since the two are linked but not the same text.

You will meet the container in key files, in libraries that read and write keys, and in certificate tooling that imports or exports private keys. Unencrypted keys use the PEM label BEGIN PRIVATE KEY, and encrypted keys use BEGIN ENCRYPTED PRIVATE KEY. RFC 5958 also registers the application/pkcs8 media type and the .p8 file extension. The container does not define what the key material means: the privateKey octet string takes a format set by the algorithm, such as RSA or elliptic curve keys in RFC 5958. For post-quantum keys, the newer RFCs define that inner format. RFC 9881 carries ML-DSA private keys in OneAsymmetricKey, and RFC 9935 does the same for ML-KEM keys, both without using the name PKCS #8.

For a migration inventory, ask each vendor which key file formats it reads and writes, whether it accepts OneAsymmetricKey version 2 with a public key, and how it treats the seed and expanded forms of ML-DSA or ML-KEM keys. OpenSSL 3.5.0 tolerates PKCS #8 version 2 keys with a public key, though it currently ignores that public key data, and a Red Hat issue shows that an upgrade required converting earlier ML-KEM and ML-DSA keys with the openssl pkcs8 command. Confirm these behaviors for the exact versions you run before you rely on them, and test a round trip of your key files during the upgrade.

Which names and structures does PKCS #8 go by?

This table lists the names, specifications, structures, file markers and object identifiers you are likely to meet for PKCS #8 private key packaging. Use it to match a term in a vendor answer, tender or key file to the document that defines it. Post-quantum rows apply only to the ML-DSA and ML-KEM key formats named in the source documents.

Name or structureWhere it appearsWhat to check
PKCS #8 (Private-Key Information Syntax)Original RSA Laboratories v1.2 specification, republished as RFC 5208 in May 2008Confirm which revision a document cites, since RFC 5958 has replaced RFC 5208
RFC 5208 (PrivateKeyInfo, EncryptedPrivateKeyInfo)Informational IETF document, authored by B. KaliskiNote that RFC 5958 obsoletes it, and version 1 structures remain compatible
RFC 5958 (OneAsymmetricKey)Proposed Standard from August 2010, the successor to PKCS #8Check the version field, where v2 is used when the publicKey field is present
PEM labels (BEGIN PRIVATE KEY, BEGIN ENCRYPTED PRIVATE KEY)Headers in PEM-encoded key filesConfirm an encrypted key carries the encrypted label before assuming protection
.p8 extension and application/pkcs8 media typeFile names and content-type registrations in RFC 5958Check the extension and media type in tool output, though they do not prove the key content
ML-DSA object identifiers (RFC 9881)Algorithm identifiers for ML-DSA-44, ML-DSA-65 and ML-DSA-87 in OneAsymmetricKeyMatch 2.16.840.1.101.3.4.3.17, .18 and .19 to the parameter set your product uses
ML-KEM object identifiers (RFC 9935)Algorithm identifiers for ML-KEM-512, ML-KEM-768 and ML-KEM-1024 in X.509 and OneAsymmetricKeyMatch 2.16.840.1.101.3.4.4.1, .2 and .3 to the parameter set in use, and check the private key form
OpenSSL 3.5 handling of PKCS#8 version 2Release notes for OpenSSL 3.5.0 covering ML-KEM, ML-DSA and SLH-DSAConfirm whether your OpenSSL build reads public key data, since the changelog says it is currently ignored

Where do practitioners meet PKCS #8 keys?

PKCS #8 rarely appears by name in day-to-day work. It shows up as a PEM label on a key file, as a version change after an OpenSSL upgrade, and as a line in a vendor questionnaire. The cards below cover where each of these appears and what to check when you find one.

Unencrypted key files

A key file that begins with BEGIN PRIVATE KEY holds an unencrypted PrivateKeyInfo structure, as RFC 5958 defines it. Any process that can read the file can read the key, so access control on the file is the main protection. When you inventory a server, search for this label in certificate and key directories, and record which files still use the older algorithm-specific labels such as BEGIN RSA PRIVATE KEY, since those will need conversion before a PKCS #8 based tool can read them.

RFC 5958 text

Encrypted key files

A file beginning with BEGIN ENCRYPTED PRIVATE KEY holds an EncryptedPrivateKeyInfo structure, where the same information is protected by a key-encryption algorithm, such as the password-based schemes from PKCS #5 cited in RFC 5208. Confirm which encryption scheme and passphrase process your tools use, and check that the passphrase is stored in a controlled system rather than in a script next to the file. Encrypted files are often the ones that migration tooling fails to open, so test them early.

RFC 5208 text

Version 2 keys after an OpenSSL upgrade

The OpenSSL 3.5.0 changelog says it accepts PKCS#8 version 2 structures with optional public keys, but currently ignores the public key data. Check your OpenSSL version before relying on any key that carries a public key field, and confirm with your own test vectors that a key round-trips correctly. Do not assume that accepting a structure means the public key is being verified; the changelog says that data is ignored.

OpenSSL 3.5 changelog

Converting keys for OpenSSL 3.5

Red Hat's RHEL-82676 issue reports that a rebase to OpenSSL 3.5 required converting earlier ML-KEM and ML-DSA keys to the standard format using the openssl pkcs8 command. Treat this as a required step in your change plan, not an optional clean-up. Before converting production keys, list which keys were generated by a pre-3.5 build, back them up, and verify each converted file loads in the service that uses it. Confirm the exact steps against the issue and your distribution's release notes.

RHEL-82676 issue

Vendor and tender questions

Security questionnaires and tender documents may ask which private key formats a product reads and writes, and whether it supports PKCS #8 encoded keys. A useful answer names the structure (PrivateKeyInfo, EncryptedPrivateKeyInfo, or OneAsymmetricKey), the PEM labels used, and the algorithms covered, with the product version. Ask the vendor to show a sample file for each claim. The sources listed on this page do not say how any specific vendor implements these formats, so verify each answer against their documentation or a test.

How does PKCS #8 hold a private key in a system?

PKCS #8 defines two containers for a private key. PrivateKeyInfo holds three required fields: a version, a private-key algorithm identifier and the private key itself as an octet string, plus optional attributes. EncryptedPrivateKeyInfo holds that same information encrypted with a key-encryption algorithm, such as the password-based schemes in PKCS #5. RFC 5208 describes both types. RFC 5958 later renamed the structure to OneAsymmetricKey and added an optional publicKey field. Its version 1 fields match the original PrivateKeyInfo, so older files still parse. In practice, the container you see in a system is usually identified by its PEM label: unencrypted keys carry the label BEGIN PRIVATE KEY and encrypted keys carry BEGIN ENCRYPTED PRIVATE KEY.

The algorithm identifier tells a reader how to interpret the octet string, and the contents of that string depend on the algorithm. RFC 5958 gives RSA (RSAPrivateKey) and elliptic curve (ECPrivateKey) as examples. For post-quantum algorithms, the packaging is defined by separate RFCs. RFC 9881 carries ML-DSA private keys in OneAsymmetricKey as a choice of a 32-byte seed, an expanded key, or both, and recommends the seed-only form for storage efficiency. RFC 9935 does the same for ML-KEM with a 64-octet seed. Parsers should distinguish ML-KEM private key variants by their ASN.1 tag rather than by length. Confirm which form your product writes and reads before you rely on a key file moving between systems.

For a migration review, check how each component stores and reads these structures. OpenSSL 3.5.0 added ML-KEM, ML-DSA and SLH-DSA support and tolerates PKCS #8 version 2 keys with optional public keys, though it currently ignores that public key data. A Red Hat issue reports that moving to OpenSSL 3.5 required converting earlier ML-KEM and ML-DSA keys to the standard format with the openssl pkcs8 command. Ask vendors which PKCS #8 version, which algorithm identifiers and which private key forms their products produce and accept, and test a sample key round trip across each system in your inventory.

When was PKCS #8 standardized and what does RFC 9881 say about it?

PKCS #8 began as RSA Laboratories' Private-Key Information Syntax, version 1.2. In May 2008 it was republished as RFC 5208, an Informational document authored by B. Kaliski, which transferred change control to the IETF. RFC 5958, Asymmetric Key Packages, followed in August 2010 as a Proposed Standard. It obsoletes RFC 5208, renames the PrivateKeyInfo structure to OneAsymmetricKey, adds an optional publicKey field, and keeps backward compatibility through the version field. Engineers reading older vendor documents should expect both names, and should confirm which structure a given tool actually emits.

RFC 9881, published in October 2025 as a Proposed Standard, carries ML-DSA private keys in the OneAsymmetricKey structure from RFC 5958. It does not use the name PKCS #8. The RFC defines the private key as a choice of a 32-byte seed, an expanded key, or both, and recommends the seed-only form for storage efficiency. When both forms are present, a recipient should run a seed consistency check. RFC 9935, published in March 2026, applies the same container to ML-KEM keys, using a 64-octet seed with the same recommendation. Check which of these forms your key generation and storage tooling produces before you migrate stored keys.

The sources listed on this page do not state any government requirement that keys be stored in this container. Confirm that point against the procurement or compliance text that applies to your system, and check your PKCS #8 and OneAsymmetricKey parsing against the vendor's documentation for the versions you run. OpenSSL 3.5.0 tolerates PKCS #8 version 2 with public keys, but ignores the public key data, and a Red Hat issue shows that moving to OpenSSL 3.5 required converting earlier ML-KEM and ML-DSA keys to the standard format with the openssl pkcs8 command. Plan that conversion step into any upgrade that touches stored keys.

How do the PKCS #8 structures nest?

The diagram starts at PKCS #8 version 1.2 from RFC 5208, which defined PrivateKeyInfo and EncryptedPrivateKeyInfo. RFC 5958 then evolved that structure into OneAsymmetricKey, which keeps version 1 fields backward compatible and adds an optional publicKey in version 2. Algorithm-specific contents, such as the ML-DSA and ML-KEM private key formats in RFC 9881 and RFC 9935, sit inside the privateKey octet string. When you review a file, check which version field it carries and which algorithm identifier it names, because those decide how the contents must be parsed.

How PKCS #8 structures evolve and branch into algorithm-specific private key contents.

What should a migration team check for PKCS #8 keys?

This sequence establishes which private key files exist, what structure and algorithm each one uses, and whether every system that reads or writes them agrees on the format. The output is a list of keys that are ready for ML-DSA or ML-KEM use, keys that need conversion, and vendor questions still open.

  1. Inventory key files and their PEM labels

    Collect every private key file across the estate, including those in application configs, container images, HSM exports and backup archives. Read the PEM header of each file: RFC 5958 says unencrypted PKCS #8 keys use the label BEGIN PRIVATE KEY and encrypted ones use BEGIN ENCRYPTED PRIVATE KEY. Keys with other labels, such as BEGIN RSA PRIVATE KEY or BEGIN EC PRIVATE KEY, are in algorithm-specific formats and need separate handling. The step is complete when each file has a row recording its path, owner, label and the system that uses it.

  2. Identify version 1 and version 2 structures

    For each file labeled as PKCS #8, decode the ASN.1 structure and record the version field. RFC 5958 says v1 is 0 and v2 is 1, and v2 is used when the optional publicKey field is present. Tools such as openssl asn1parse can show this. The output is a second column in the inventory that separates version 1 keys, which carry no public key, from version 2 keys, which may carry one. Mark any file where the parser cannot read the version, since that file needs a closer look before the next step.

  3. Confirm algorithm identifiers and privateKey contents

    For each ML-DSA or ML-KEM key, read the privateKeyAlgorithm identifier and check it against the object identifiers in the RFCs. RFC 9881 lists ML-DSA-44, ML-DSA-65 and ML-DSA-87, and RFC 9935 lists ML-KEM-512, ML-KEM-768 and ML-KEM-1024. Then check what the privateKey octet string holds. RFC 9881 and RFC 9935 both describe the content as a seed, an expanded key, or both, and RFC 9881 recommends the seed-only form. Record the byte length of the octet string and compare it with the sizes in the RFCs. Where both forms are present, RFC 9881 recommends a seed consistency check, and the output is a pass or fail mark for each key.

  4. Convert older keys to the standard format

    Where a key uses an older ML-KEM or ML-DSA encoding that the current library does not read, convert it to the standard PKCS #8 form. Red Hat's RHEL-82676 issue reports that a rebase to OpenSSL 3.5 required this conversion using the openssl pkcs8 command, and the same approach applies to other keys in your inventory. Work on copies, keep the originals in the backup set, and check the converted file with the same asn1parse and algorithm checks used in the previous steps. The step closes when each converted key loads in the target library and its version and algorithm identifier match the inventory.

  5. Test loading in each library and runtime

    Load every converted and native key in each library, runtime and HSM the organization uses. The OpenSSL 3.5 changelog says the library accepts PKCS #8 version 2 keys with optional public keys, but it currently ignores the public key data, so a test should confirm whether the application relies on that field. Record any library that rejects a key, reports an algorithm mismatch or drops the optional public key. The output is a test matrix showing each key, each runtime and the result.

  6. Ask vendors which structure and version they use

    Send each vendor a written question asking which PKCS #8 structure and version it writes and which it reads, whether it supports the OneAsymmetricKey form in RFC 5958, and whether it handles ML-DSA and ML-KEM privateKey contents as described in RFC 9881 and RFC 9935. Ask whether the answer applies to the exact product version you run. Vendors should answer in writing, and the response should name the version, edition and component. Where a vendor does not answer a point, mark it open in the inventory and do not assume support.

Which PKCS #8 claims and version mix-ups should reviewers question?

Several claims about PKCS #8 in vendor answers and tender language blur the format with its neighbors, its successors and its file labels. Each point below is a place where a reviewer should ask for the exact standard, version and algorithm before accepting the statement.

PKCS #8 is not PKCS #12

PKCS #8 defines a container for one private key and its algorithm identifier. PKCS #12 is a separate bundle format that can hold keys together with certificates and chains. A claim that a product supports PKCS #8 says nothing about whether it handles PKCS #12 bundles, and the reverse also holds. Ask which format a vendor means, and whether the export or import path in question uses the key-only or the bundle format.

RFC 5208 text

Version 2 keys may be partly ignored

RFC 5958 allows a version 2 structure with an optional publicKey field. The OpenSSL 3.5.0 changelog says it tolerates PKCS#8 version 2 with optional public keys, and that the public key data is currently ignored. A reviewer should not read tolerance as full support, and should ask whether the public key is validated, used or dropped in the specific OpenSSL build and version deployed.

OpenSSL 3.5 changelog

RFC 9881 does not use the PKCS #8 name

RFC 9881 describes ML-DSA private key packaging through the OneAsymmetricKey structure from RFC 5958, which is the successor of PKCS #8. A vendor document that cites RFC 9881 as a PKCS #8 specification has taken a name the RFC does not use. Ask the vendor to name the structure and the RFC section they follow, so that the answer can be checked against the text itself.

RFC 9881 text

A PEM label does not prove the algorithm

RFC 5958 uses the label BEGIN PRIVATE KEY for unencrypted keys and BEGIN ENCRYPTED PRIVATE KEY for encrypted keys. The label reports the container type only. It does not name the private key algorithm or its strength, and it does not show whether a post-quantum algorithm is inside. Ask for the privateKeyAlgorithm identifier from a parsed key, and confirm which encryption scheme protects an encrypted key.

RFC 5958 text

Converted keys need a format check

A Red Hat issue states that a rebase to OpenSSL 3.5 required converting earlier ML-KEM and ML-DSA keys to the standard format with the openssl pkcs8 command. If a vendor says its keys carry over an upgrade unchanged, a reviewer should ask whether any conversion was needed, which keys were affected, and how the converted output was checked.

Red Hat RHEL-82676

Seed and expanded forms differ

RFC 9881 defines the ML-DSA private key as a seed, an expanded key, or both, and recommends the seed-only form. RFC 9935 applies the same pattern to ML-KEM. A claim that a key is stored or exported in a given form should be checked against the form the product actually writes. Ask whether a seed consistency check runs when both forms are present.

RFC 9935 text

What do people search about PKCS #8?

What does PKCS #8 stand for?

PKCS #8 stands for Private-Key Information Syntax. It is a format for packaging a private key together with the identifier of the algorithm it belongs to. Its original version 1.2 was published by RSA Laboratories and republished as RFC 5208 in May 2008 as an Informational document, which transferred change control to the IETF. Engineers usually meet the format as an unencrypted block labeled BEGIN PRIVATE KEY or as an encrypted block labeled BEGIN ENCRYPTED PRIVATE KEY. The two forms are described in RFC 5208 and in its successor, RFC 5958, so check which document a vendor cites before comparing their behavior.

Does RFC 5958 replace PKCS #8?

Yes, RFC 5958 obsoletes RFC 5208 and is the document that now defines the structure. It renames PrivateKeyInfo to OneAsymmetricKey, adds an optional publicKey field, and keeps backward compatibility through the version field, so a structure that uses only version 1 fields is the same as PrivateKeyInfo in RFC 5208. RFC 9881 does not use the name PKCS #8 and describes ML-DSA private key packaging through the RFC 5958 OneAsymmetricKey structure, which it identifies as the successor of PKCS #8. When a document says PKCS #8, confirm whether it means the RFC 5208 or RFC 5958 structure.

Is PKCS #8 standardized for post-quantum private keys?

The container itself is not post-quantum specific. RFC 5958 defines a generic structure, and RFC 5958 notes that the privateKey octet string format depends on the algorithm, so each post-quantum algorithm needs its own definition of what goes inside it. RFC 9881 (October 2025, Proposed Standard) carries ML-DSA private keys in OneAsymmetricKey, and RFC 9935 (March 2026, Proposed Standard) carries ML-KEM private keys the same way. Both documents are Proposed Standards, so check their status and any later revisions before citing them as final. The sources do not establish that other post-quantum algorithms have a packaging definition, so confirm that with the relevant specification.

Which key sizes change for ML-DSA and ML-KEM in PKCS #8?

The container size depends on the private key form chosen. RFC 9881 defines the ML-DSA private key as a CHOICE of a 32-byte seed, an expanded key, or both, and recommends the seed-only form for storage efficiency. The expanded ML-DSA private keys are 2560, 4032 and 4896 bytes for ML-DSA-44, ML-DSA-65 and ML-DSA-87. RFC 9935 gives ML-KEM decapsulation keys of 1632, 2400 and 3168 bytes for ML-KEM-512, ML-KEM-768 and ML-KEM-1024, and says the private key is carried as a 64-octet seed, an expanded key, or both, recommending the seed-only form. Storage and transfer tooling sized for smaller keys should be checked against these figures.

Does my product support PKCS #8 with post-quantum keys?

The sources do not establish support for any specific product, so confirm this with the vendor rather than assuming it. The OpenSSL 3.5.0 changelog lists support for ML-KEM (FIPS 203), ML-DSA (FIPS 204) and SLH-DSA (FIPS 205), and says it tolerates PKCS#8 version 2 with optional public keys, whose public key data is currently ignored. Support in one library does not show that every tool, service or appliance in your stack reads the same encoding. Ask the vendor which PKCS #8 structure, which RFC and which algorithm identifiers the product reads and writes, and test a key round trip in your environment.

What changes for my team when moving to post-quantum PKCS #8 keys?

The main change is that existing key files may need conversion before a newer library will accept them. A Red Hat issue states that a rebase to OpenSSL 3.5 required converting earlier ML-KEM and ML-DSA keys to the standard format with the openssl pkcs8 command. Teams should inventory where private keys are stored and transferred, confirm which encodings each consumer accepts, and plan the conversion step in their rollout. Keys are also larger, so check storage, backup and transfer limits. Conversion and testing usually recur whenever a library or key type changes, not only once.

What should I ask a vendor about PKCS #8 support?

Ask which RFC the product implements for PKCS #8 packaging, RFC 5208 or RFC 5958, and whether it accepts the version 2 structure with an optional publicKey field. Ask which algorithm identifiers it reads for ML-DSA and ML-KEM, and whether it accepts the seed-only, expanded or combined private key forms. Ask how it handles existing keys that must be converted, and which command or procedure it documents for that. Request the version and build you will run, since support differs between releases. Get the answers in writing, then verify them with a key round trip in your own environment.

How DeployOpen works on this

DeployOpen approaches PKCS #8 migration as a scoped piece of work on the private key containers your systems actually load. We start from an inventory of where PKCS #8 files are produced, stored and read, then plan changes to the tools and libraries that create or parse them. The written scope sets what is covered before any work starts.

How we scope

  • We inventory where PKCS #8 private key files are generated, stored, converted and read across your systems.
  • We identify which libraries and tools in use, such as OpenSSL versions, must handle the new algorithm key formats.
  • We agree the written scope, deliverables and timeline with you before any work starts, as fixed-scope engagements.

How we build

  • We configure and upgrade the components that create and read PKCS #8 keys, keeping existing keys usable during the change.
  • We convert stored keys to the standard format where a library upgrade requires it, and verify each conversion result.
  • We test that applications, services and automation still load keys correctly after each change in your environment.

How we hand over

  • We document each changed component, its version, the key formats in use and the steps taken to reach them.
  • We provide a record of which keys were converted, when, and how the conversion was checked for your audit trail.
  • We walk your engineering and security teams through the changes so they can operate and review the setup themselves.

How we support

  • Ongoing support is available as a retainer for upgrades and reviews as libraries and standards continue to change.
  • We can retest key handling after library or platform upgrades so regressions in loading keys are caught early.
  • Confirm the exact library versions and key formats your systems need against the vendor documentation before planning.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.