CLI Keys
Sign and verify spar archives
The Aperture CLI supports cryptographic signing and verification of spar archives. This ensures the integrity and authenticity of your application builds.
Overview
Spar archives can be signed with a private key during creation and verified with the corresponding public key during extraction or verification. This provides:
- Integrity: Ensures the archive hasn’t been tampered with
- Authenticity: Confirms the archive was created by a trusted source
- Security: Protects your deployment pipeline from malicious modifications
Generating Keys
Generate a key pair for signing and verification:
# Generate a private key$ openssl genrsa -out private.key 4096
# Extract the public key$ openssl rsa -in private.key -pubout -out public.keySigning Archives
Use the --signing-key option when creating archives:
$ aperture spar archive ./dist ./my-app.spar --signing-key ./keys/private.keyThe signature is embedded in the archive and can be verified later.
Verifying Archives
Verify Without Extraction
Check an archive’s signature without extracting its contents:
# Verify with a public key$ aperture spar verify my-app.spar -k ./keys/public.key
# Verify checksums only (no signature verification)$ aperture spar verify my-app.spar -k checksumVerify During Extraction
Verify the archive as part of the extraction process:
# Extract and verify with public key$ aperture spar extract my-app.spar --verify ./keys/public.key
# Extract and verify checksums$ aperture spar extract my-app.spar --verify checksumIf verification fails, the extraction will be aborted.
Verify During Upload
Verify an archive before uploading to Aperture:
$ aperture build upload ./my-app.spar \ --version 1.0.0 \ --verify-key ./keys/public.keyKey Management Best Practices
Storing Private Keys
- Never commit private keys to version control
- Use environment variables or secrets managers in CI/CD
- Restrict access to private keys to authorized personnel only
- Consider using hardware security modules (HSMs) for production keys
CI/CD Integration
Store your private key as a secret and reference it in your workflow:
# GitHub Actions example- name: Create signed archive env: SIGNING_KEY: ${{ secrets.APERTURE_SIGNING_KEY }} run: | echo "$SIGNING_KEY" > /tmp/private.key aperture spar archive ./dist ./build.spar --signing-key /tmp/private.key rm /tmp/private.keyKey Rotation
When rotating keys:
- Generate a new key pair
- Update CI/CD secrets with the new private key
- Distribute the new public key to verification systems
- Keep the old public key available to verify older archives
- Securely destroy the old private key
Verification Modes
| Mode | Command | Use Case |
|---|---|---|
| Signature | -k ./public.key | Full cryptographic verification |
| Checksum | -k checksum | Integrity check only (no authenticity) |
Troubleshooting
Signature verification failed
- Ensure you’re using the correct public key that corresponds to the private key used for signing
- Check that the archive hasn’t been modified after signing - Verify the key file is in the correct format (PEM)
No signature found in archive
- The archive was created without the
--signing-keyoption - Use-k checksumfor integrity verification of unsigned archives
Invalid key format
- Ensure keys are in PEM format - Private keys should start with
-----BEGIN RSA PRIVATE KEY-----or-----BEGIN PRIVATE KEY------ Public keys should start with-----BEGIN PUBLIC KEY-----