certbotbot
Reference documentation for a modular Bash project
Loading...
Searching...
No Matches
Functions
crypto.bash File Reference

Authenticates an optional encrypted envelope around the shared tar. More...

Functions

int certbotbot_crypto_packet_valid (String workspace, String packet)
 Rejects any GnuPG encrypted payload without the required AEAD mode.
 
int certbotbot_crypto_encrypt_packet (String workspace, String source, String target)
 Creates a verified authenticated OCB ciphertext packet.
 
int certbotbot_crypto_decrypt_packet (String workspace, String source, String target)
 Quarantines decrypted bytes until authenticated GnuPG exits zero.
 
int certbotbot_crypto_require (String workspace)
 Probes the minimum GnuPG version and actual AES-OCB roundtrip.
 
int certbotbot_crypto_unwrap (String workspace)
 Authenticates the downloaded object before ordinary tar restore.
 
int certbotbot_crypto_wrap (String workspace)
 Encrypts a validated full tar candidate and verifies a local roundtrip.
 

Detailed Description

Authenticates an optional encrypted envelope around the shared tar.

ADR-031 requires AES-256/OCB, iterated SHA-512 S2K, an exact versioned envelope, and a private staging boundary before exposing plaintext. The operator's exported secret must already have been captured into the unexported CERTBOTBOT_GPG_SECRET variable and removed from the environment. The runtime treats GnuPG as a trusted external executable, not a sandbox.

Function Documentation

◆ certbotbot_crypto_decrypt_packet()

int certbotbot_crypto_decrypt_packet ( String  workspace,
String  source,
String  target 
)

Quarantines decrypted bytes until authenticated GnuPG exits zero.

Parameters
workspacePrivate runner root with an isolated GPG home.
sourceValidated-mode packet staged under private root.
targetAbsent private plaintext staging file.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nothing is written to STDERR.
Return values
0Authentication succeeded and complete staged plaintext exists.
65Authentication or private decryption failed.

◆ certbotbot_crypto_encrypt_packet()

int certbotbot_crypto_encrypt_packet ( String  workspace,
String  source,
String  target 
)

Creates a verified authenticated OCB ciphertext packet.

Parameters
workspacePrivate existing runner root with an isolated GPG home.
sourceExisting plaintext file, never a remote or logged argument.
targetAbsent private output filename.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nothing is written to STDERR.
Return values
0A supported authenticated encryption packet was produced.
65Unsupported mode or failed private encryption.

◆ certbotbot_crypto_packet_valid()

int certbotbot_crypto_packet_valid ( String  workspace,
String  packet 
)

Rejects any GnuPG encrypted payload without the required AEAD mode.

Parameters
workspaceOwned private runner root with isolated GPG home.
packetExisting private OpenPGP ciphertext file.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nothing is written to STDERR.
Return values
0Expected AES256/OCB and SHA512 iterated S2K packet layout.
1Unrecognized or downgraded OpenPGP packet layout.

◆ certbotbot_crypto_require()

int certbotbot_crypto_require ( String  workspace)

Probes the minimum GnuPG version and actual AES-OCB roundtrip.

Parameters
workspaceNewly allocated private mode-0700 runner workspace.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Static nonsecret diagnostic on failure.
Return values
0Runtime supports authenticated encryption and decryption.
69Missing or incompatible GnuPG runtime.

◆ certbotbot_crypto_unwrap()

int certbotbot_crypto_unwrap ( String  workspace)

Authenticates the downloaded object before ordinary tar restore.

With a known encrypted envelope, successful GnuPG authentication and full gzip/tar validation are required before renaming staged plaintext to downloaded.tar.gz. Plaintext-to-encrypted conversion requires the independently confirmed migration settings before any provider work.

Parameters
workspacePrivate workspace with downloaded.tar.gz from S3.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed nonsecret format/decryption diagnostic.
Return values
0Existing object matches the selected mode and migration intent.
65Wrong format, invalid key, archive or authentication.

◆ certbotbot_crypto_wrap()

int certbotbot_crypto_wrap ( String  workspace)

Encrypts a validated full tar candidate and verifies a local roundtrip.

Parameters
workspacePrivate workspace with an assembled candidate.tar.gz.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Static nonsecret error diagnostic.
Return values
0Candidate.tar.gz.enc contains verified authenticated ciphertext.
65Encryption, format inspection or roundtrip verification failed.