Certificate Chains (PEM)

PEM signing embeds an X.509 certificate chain directly in the signature value, letting verifiers pin a root CA rather than a bare public key. Use it when your organization has existing PKI infrastructure.

For the conceptual background on key pinning vs. certificate chain trust, see Trust Models.

What You’ll Learn

By the end of this tutorial, you will:

  • Understand how PEM signing differs from Plain signing
  • Generate (or supply) a certificate chain for signing
  • Configure .ocmconfig for both signer and verifier roles
  • Sign a component version with a PEM-encoded signature
  • Verify the signature using only the root CA as a trust anchor

How It Works

  flowchart LR
    subgraph sign ["Sign (You)"]
        direction TB
        A[Component Version] --> C[Sign with Leaf Key]
        C --> D[Signature + Embedded Chain]
    end

    D --> T["Share Component"]

    T --> verify

    subgraph verify ["Verify (Consumer)"]
        direction TB
        E[Signature + Embedded Chain] --> H[Verify Chain against Root CA]
        H --> I{Valid?}
        I -->|Yes| VALID["✓ Trusted"]
        I -->|No| INVALID["✗ Rejected"]
    end

    style VALID fill:#dcfce7,color:#166534
    style INVALID fill:#fee2e2,color:#991b1b

At signing time OCM embeds the leaf certificate (and any intermediates) into the signature value. The root CA is never embedded – the verifier holds it as a trust anchor.

How it differs from Plain signing:

AspectPlain (default)PEM
Signature valueHex-encoded bytesPEM SIGNATURE block
Public key distributionVerifier needs it in .ocmconfigEmbedded in signature
Trust anchorPublic key pinningRoot CA certificate pinning
Certificate chainNot supportedLeaf required; intermediates optional
Use caseSimple setups, self-signed keysPKI integration, enterprise environments

Estimated time: ~20 minutes

Prerequisites

Scenario

  • Component: github.com/acme.org/helloworld:1.0.0 in a local CTF archive at /tmp/helloworld/transport-archive (created by the Create Component Versions tutorial)
  • Working directory: ~/.ocm/keys/pem-demo
  • Signer files: leaf.key, chain.pem
  • Verifier file: root.crt
Root CA must not be embedded

Never include the root CA in the certificate chain you supply to the signer. OCM rejects any self-signed certificate found in the embedded chain to prevent signers from asserting their own trust anchor.

Steps

The following steps cover the required setup for two scenarios, one with a simple Root CA directly signing the leaf certificate, and another with an intermediate CA between the Root and Leaf.

Troubleshooting

“must not be embedded in the signature”

The chain file contains a self-signed (root CA) certificate. Remove the root CA from chain.pem.

# Check which certificates are in chain.pem
openssl crl2pkcs7 -nocrl -certfile chain.pem | openssl pkcs7 -print_certs -noout

# Verify the leaf is correctly signed
openssl verify -CAfile root.crt leaf.crt
openssl verify -CAfile root.crt -untrusted intermediate.crt leaf.crt

“certificate signed by unknown authority”

The root CA in the verification config doesn’t match the root that signed the embedded chain. Check that public_key_pem_file points to the correct root CA.

openssl verify -CAfile root.crt leaf.crt
openssl verify -CAfile root.crt -untrusted intermediate.crt leaf.crt

“could not resolve credentials for identity”

The consumer identity in .ocmconfig doesn’t match what OCM looks up. Confirm:

  • type: RSA/v1alpha1 is spelled correctly
  • algorithm matches the value in the signer spec (RSASSA-PSS)
  • signature matches the --signature flag value (default: default)

“signature already exists”

Use --force to overwrite or choose a different name with --signature.