Package Signing
Zarf supports cryptographic signing and verification of packages using Cosign. Package signing provides:
- Authenticity: Verify that a package comes from a trusted source
- Integrity: Ensure the package has not been modified or corrupted
- Non-repudiation: Prove who signed the package and when
Zarf signs the zarf.yaml file within a package, which contains metadata and checksums for all package contents. This allows verification of the entire package through a single signature.
Packages are signed using the Sigstore bundle format, stored as zarf.bundle.sig within the package. This format provides:
- Offline Verification: Bundles include all verification materials in a single file
- Standardized Format: Based on the widely-adopted Sigstore specification
- Better interoperability: Compatible with other Sigstore tooling and services
The bundle format follows the Sigstore Bundle Specification.
The most common approach uses local private/public key pairs:
# Generate a key pair (prompts for password)zarf tools gen-key
# Creates:# - cosign.key (private key - keep this secure!)# - cosign.pub (public key - share for verification)For production environments, cloud-based KMS provides enhanced security and key management:
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key awskms://alias/my-signing-keyRequires AWS credentials configured and appropriate IAM permissions. The KMS key must be an asymmetric signing key.
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key gcpkms://projects/PROJECT/locations/LOCATION/keyRings/RING/cryptoKeys/KEYRequires gcloud authentication and appropriate IAM roles. The key must be an asymmetric signing key.
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key azurekms://VAULT_NAME.vault.azure.net/keys/KEY_NAME/KEY_VERSIONRequires Azure CLI authentication and appropriate access policies. The key must be an asymmetric signing key.
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key hashivault://KEY_NAMERequires Vault token authentication and appropriate policies. The transit key must be an asymmetric signing key.
Automatically sign a package during creation:
zarf package create . --signing-key cosign.key --signing-key-pass <password>The signature is embedded in the package archive during the build process.
Sign a package after it has been created:
zarf package sign zarf-package-example-amd64.tar.zst --signing-key cosign.keyThe signature is added to the package archive, and the zarf.yaml is updated to indicate it is signed.
Replace an existing signature (useful for key rotation):
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key new-cosign.key \ --overwriteThe --overwrite flag is required when a signature already exists.
Zarf supports signing packages stored in OCI registries:
# Sign a package from OCI and output to local directoryzarf package sign oci://ghcr.io/my-org/my-package:1.0.0 \ --signing-key cosign.key \ --output ./signed/
# Sign a package and publish directly to OCI registryzarf package sign zarf-package-example-amd64.tar.zst \ --signing-key cosign.key \ --output oci://ghcr.io/my-org/signed-packages
# Sign a package from OCI and re-publish to OCI (in place)zarf package sign oci://ghcr.io/my-org/my-package:1.0.0 \ --signing-key cosign.keyVerify a package’s signature using the public key:
zarf package verify zarf-package-example-amd64.tar.zst --key cosign.pubSuccessful verification output:
2025-11-15 14:17:13 INF checksum verification status=PASSEDVerified OK2025-11-15 14:17:16 INF signature verification status=PASSED2025-11-15 14:17:16 INF verification complete status=SUCCESSIf verification fails, the command exits with a non-zero status code and displays an error message.
Verify package integrity without signature verification:
zarf package verify zarf-package-example-amd64.tar.zstThis confirms that package files match their expected checksums but does not verify authenticity or source.
Verify signatures during package deployment:
zarf package deploy zarf-package-example-amd64.tar.zst --key cosign.pub --verifyIf signature verification fails and --verify is specified, Zarf aborts the deployment to prevent deploying potentially compromised packages.
- Protect private keys: Store private keys securely with restricted file system permissions
- Use strong passwords: Encrypt private keys with strong, unique passwords
- Consider KMS for production: Use cloud KMS for production signing operations
- Document key locations: Maintain clear documentation of where keys are stored and who has access
- Verify before deployment: Always verify package signatures before deploying to critical environments
- Automate verification: Integrate signature verification into CI/CD pipelines
- Enforce verification: Use
--verifyflag during deployment to make verification mandatory - Distribute public keys securely: Establish a trusted channel for distributing public keys
- Maintain key inventory: Keep records of which keys were used to sign which packages
- Never commit private keys: Exclude private keys from version control
- Audit signature operations: Log all signing and verification operations
- Validate key sources: Verify public keys come from trusted sources before using them
- Monitor for warnings: Pay attention to deprecation warnings about signature formats
- Plan for key compromise: Have a procedure for responding to compromised signing keys
✖ failed to verify signature: invalid signature when validating ASN.1 encoded signatureSolution: Verify you are using the correct public key for verification.
✖ package is signed but no key was providedSolution: Provide the public key when deploying or inspecting a signed package:
zarf package deploy zarf-package-example-amd64.tar.zst --key cosign.pubERR failed to sign package: failed to sign package: reading key: decrypt: encrypted: decryption failedSolution: Verify the password is correct. Use --signing-key-pass to provide the password:
zarf package sign zarf-package-example-amd64.tar.zst \ --signing-key cosign.key \ --signing-key-pass <correct-password>✖ signature verification failed: invalid signaturePossible causes:
- Wrong public key: The public key doesn’t match the private key used to sign
- Package modified: The package contents have been altered after signing
- Corrupted package: The package file is corrupted or incomplete
- Format mismatch: Using wrong verification method for signature format
Solutions:
- Verify you’re using the correct public key that corresponds to the signing key
- Re-download the package if corruption is suspected
- Check package checksums to verify integrity
- Inspect the package to confirm which signature format it uses
✖ failed to sign package: kms authentication failedSolutions:
- Verify cloud provider credentials are configured correctly
- Ensure the KMS key exists and is accessible
- Verify IAM permissions allow signing operations
- Check that the key is an asymmetric signing key (not encryption key)
- Refer to your KMS provider’s documentation for authentication setup
- zarf package sign - Sign a Zarf package
- zarf package verify - Verify a package signature
- zarf package create - Create a package with optional signing
- zarf tools gen-key - Generate a signing key pair