Configure Credentials for Signing

Set up credential configuration so OCM can find your signing keys when signing or verifying component versions.

You’ll end up with

  • A configured .ocmconfig file that OCM uses to locate your signing keys
  • Ability to sign and verify component versions without specifying key paths manually

Estimated time: ~3 minutes

Prerequisites

Steps

  1. Create .ocmconfig file (optional)

    Create .ocmconfig in your current directory. If you already have an .ocmconfig file, you can skip this step and add the credential configuration to your existing file.

    touch .ocmconfig
  2. Add the signing credential configuration to your .ocmconfig

    Copy the following YAML into your .ocmconfig file.

    We use the key pair you created in the How-To: Generate Signing Keys. If you already have a key pair that is located in a different location, simply update the file paths accordingly.

    Identity attributes are required for credential matching. The type and signature attributes apply to every identity. The algorithm attribute only applies to RSA — GPG and Sigstore each have a single algorithm, so it is resolved implicitly and must not be set in the identity. See the Consumer Identities Reference for details.

    There are two ways to configure signing credentials, either using file paths that point to your key files, or by including the key material directly in the config file. For more details on the supported attributes and configuration options, see Credential Consumer Identities Reference.

    The most convenient way to configure signing credentials is to add a consumer block to your .ocmconfig with the key file paths.

  3. Test the configuration

    The dry run signs in memory without persisting the signature, so it’s a quick way to confirm OCM can locate your keys. Match the command to the algorithm you configured above:

Configure multiple signing identities

For different environments (e.g., dev and prod) you can create different key pairs and add multiple consumer blocks to your .ocmconfig with different signature names:

type: generic.config.ocm.software/v1
configurations:
  - type: credentials.config.ocm.software
    consumers:
      - identity:
          type: RSA/v1alpha1
          algorithm: RSASSA-PSS
          signature: dev
        credentials:
          - type: RSACredentials/v1
            privateKeyPEMFile: /tmp/keys/dev/private-key.pem
            publicKeyPEMFile: /tmp/keys/dev/public-key.pem
      - identity:
          type: RSA/v1alpha1
          algorithm: RSASSA-PSS
          signature: prod
        credentials:
          - type: RSACredentials/v1
            privateKeyPEMFile: /tmp/keys/prod/private-key.pem
            publicKeyPEMFile: /tmp/keys/prod/public-key.pem

Specify the signature name when signing:

ocm sign cv --dry-run --signature dev /tmp/helloworld/transport-archive//github.com/acme.org/helloworld:1.0.0
ocm sign cv --dry-run --signature prod /tmp/helloworld/transport-archive//github.com/acme.org/helloworld:1.0.0

Identity Attributes Reference

The consumer identity for RSA signing/verification supports these attributes:

AttributeRequiredDescription
typeYesMust be RSA/v1alpha1
algorithmYesRSASSA-PSS (default) or RSASSA-PKCS1-V1_5. Required for credential matching — the lookup always includes this field.
signatureYesLogical name for this key configuration (default: default). Must match the --signature CLI flag.

Troubleshooting

Symptom: “no private key found”

Cause: OCM cannot find a matching consumer entry in .ocmconfig.

Fix: Ensure:

  • The key file path is correct and the file exists (privateKeyPEMFile for RSA, privateKeyPGPFile for GPG)
  • The algorithm attribute is present in the identity (e.g. algorithm: RSASSA-PSS). See Consumer Identities Reference.
  • The signature name matches what you’re using (or is default if not specified)
  • The file is valid YAML with correct indentation

Symptom: “permission denied” reading key file

Cause: Key file has restrictive permissions.

Fix: Ensure your user can read the key file:

chmod 600 /tmp/keys/private-key.pem
ls -la /tmp/keys/private-key.pem

CLI Reference

CommandDescription
ocm sign cv --dry-run --config .ocmconfigTest signing configuration
ocm verify cvTest verification configuration

Next Steps