Ssl dgst
ssl_dgst¶
Compute a cryptographic digest of a file.
Example¶
ssl_dgst archive.tar.gz
ssl_dgst archive.tar.gz sha512
Arguments¶
- $1 (string): File to hash
- $2 (string): Digest algorithm (default: sha256)
Exit codes¶
- 0: Success
Output on stdout¶
- Digest string in the form "algo(file)= hash"
ssl_dgst_sign¶
Sign a file's digest with a private key. Produces a binary signature file.
Example¶
ssl_dgst_sign server.key archive.tar.gz
ssl_dgst_sign server.key archive.tar.gz archive.tar.gz.sig sha512
Arguments¶
- $1 (string): Private key file
- $2 (string): File to sign
- $3 (string): Output signature file (default: input file with .sig suffix)
- $4 (string): Digest algorithm (default: sha256)
Exit codes¶
- 0: Success
- 1: openssl error
ssl_dgst_verify¶
Verify a signed digest against a public key.
Example¶
ssl_dgst_verify pubkey.pem archive.tar.gz.sig archive.tar.gz
Arguments¶
- $1 (string): Public key file (PEM, extracted via openssl rsa -pubout)
- $2 (string): Signature file produced by ssl_dgst_sign
- $3 (string): File to verify
- $4 (string): Digest algorithm (default: sha256; must match what was used to sign)
Exit codes¶
- 0: Signature verified
- 1: Verification failed
Output on stdout¶
- "Verified OK" or "Verification Failure"