Documentation
¶
Overview ¶
Package crypto opens backups encrypted with age or GPG.
Index ¶
- Variables
- func GenerateRunnerKey() (config.Secret, string, error)
- func KeyFingerprint(publicKey string) string
- func OpenAge(encrypted io.Reader, identity config.Secret) (io.Reader, error)
- func OpenGPG(encrypted io.Reader, key, passphrase config.Secret) (io.Reader, error)
- func RunnerID(privateKey config.Secret) (string, error)
- func RunnerPublicKey(privateKey config.Secret) (string, error)
- type SealedBundle
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoKey = errors.New("no decryption key is set") ErrInvalidKey = errors.New("the decryption key can't be used") ErrWrongKey = errors.New("the decryption key doesn't match this backup") )
Reasons a backup can't be opened. Key parsing errors are replaced by these because library messages can quote the key they were given.
var ErrInvalidBundle = errors.New("the sealed keys can't be read, enter them again in the dashboard")
ErrInvalidBundle replaces every reason a bundle can't be read, because parser messages can quote the decrypted contents.
Functions ¶
func GenerateRunnerKey ¶
GenerateRunnerKey creates the key pair that keys are sealed for. The private key stays on the runner.
func KeyFingerprint ¶
KeyFingerprint is what users compare with the dashboard to spot a swapped key. The dashboard calculates the same value: SHA-256 of the public key string in unpadded base64.
func OpenAge ¶
OpenAge returns the decrypted contents of an age file. Damage is reported while reading.
func OpenGPG ¶
OpenGPG returns the decrypted contents of a GPG message. Damage is reported while reading.
Types ¶
type SealedBundle ¶
type SealedBundle struct {
S3AccessKey config.Secret
S3SecretKey config.Secret
NameSalt config.Secret
AgeIdentity config.Secret
GPGKey config.Secret
GPGPassphrase config.Secret
}
SealedBundle holds the keys from SealedBundleContents in api/v1/openapi.yaml. It lives in memory for one job.
func OpenSealedBundle ¶
func OpenSealedBundle(armored string, identity config.Secret) (SealedBundle, error)
OpenSealedBundle decrypts a job's sealed bundle in memory with the runner's private key. A bundle sealed for other runners returns ErrWrongKey.