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
.ocmconfigfile 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
- OCM CLI installed
- Key pair generated
- A component version to test your configuration in your current directory (we’ll use
github.com/acme.org/helloworld:1.0.0from the getting started guide) in this guide, but you can use any component version you have.
Steps
Create .ocmconfig file (optional)
Create
.ocmconfigin your current directory. If you already have an.ocmconfigfile, you can skip this step and add the credential configuration to your existing file.touch .ocmconfigAdd the signing credential configuration to your .ocmconfig
Copy the following YAML into your
.ocmconfigfile.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
typeandsignatureattributes apply to every identity. Thealgorithmattribute 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
.ocmconfigwith the key file paths.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.pemSpecify 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.0Identity Attributes Reference
The consumer identity for RSA signing/verification supports these attributes:
| Attribute | Required | Description |
|---|---|---|
type | Yes | Must be RSA/v1alpha1 |
algorithm | Yes | RSASSA-PSS (default) or RSASSA-PKCS1-V1_5. Required for credential matching — the lookup always includes this field. |
signature | Yes | Logical 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 (
privateKeyPEMFilefor RSA,privateKeyPGPFilefor GPG) - The
algorithmattribute is present in the identity (e.g.algorithm: RSASSA-PSS). See Consumer Identities Reference. - The
signaturename matches what you’re using (or isdefaultif 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.pemCLI Reference
| Command | Description |
|---|---|
ocm sign cv --dry-run --config .ocmconfig | Test signing configuration |
ocm verify cv | Test verification configuration |
Next Steps
- How-to: Sign Component Versions - Sign components with your configured credentials
- How-to: Verify Component Versions - Verify signatures using public keys
Related Documentation
- How-to: Generate Signing Keys - Create the key pair needed for this configuration
- Concept: Signing and Verification - Understand how OCM signing works