Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Choose a provider and a backend

A build makes two choices that do not constrain each other: the KMS that holds the KEK, and the crypto backend that runs the AEAD algorithms. Both are Cargo features, see Cargo features.

KMS providers

The KMS decides who else reads the values, what a rotation takes and how a scope is crypto-shredded:

Google Cloud KMSAWS KMSAzure Key VaultVault TransitLocal KMS
Tink reads envelope valuesyesyesnonono
Tink reads keyring keysetsyesyes, with a key named by its ARNnoTink for Go onlyno
BigQuery readsyesnononono
KMS random generatoryes, at the HSM protection levelyesnonono
KEK version on each encrypted DEKyesno, Noneyesyesyes
Disabling an old KEK versionyes, eventually consistentno, for key material AWS KMS generatedyesyes, with min_decryption_versionyes, by dropping it from the list
Crypto-shredding a scopedestroying its KEK versionsdeleting the keydeleting the key, with all its versionsdeleting its key versionsdestroying every copy of the KEK

Notes on the table:

The TLS root store and the TLS crypto provider are a feature choice for Google Cloud KMS, Azure and Vault Transit, with the rules in Feature rules.

Crypto backends

ringaws-lcaws-lc-fipsrustcrypto
AES-256-GCM-SIVnoyesyesyes
RSA-OAEP encryption, for a producer under an asymmetric KEKnoyesyesyes
FIPS modulenonoyesno
Needs a C toolchainyesyesyes, with CMake and Gono
A second crypto library beside a cloud provideryesnonoyes
Key schedules zeroisednoyes, by AWS-LC’s allocatoryes, by AWS-LC’s allocatoryes

Every backend has ChaCha20-Poly1305, AES-128-GCM and AES-256-GCM, writes the same bytes, and decrypts the values of any other, so a move from one backend to another needs no migration of the data, see Cross-backend compatibility.

  • Producers under an asymmetric KEK: a producer needs a backend with RSA encryption, so it cannot run on ring. Readers need nothing of RSA on any backend, see Accept data from partners and devices that cannot read it back;
  • No second crypto library: the default features of the cloud providers already build aws-lc-rs for TLS, so aws-lc adds nothing to a provider build, see aws-lc-rs and FIPS;
  • FIPS: aws-lc-fips runs the backend on the AWS-LC FIPS module and moves every user of aws-lc-rs in the build to it, the rustls provider included. AES-256-GCM is the algorithm for a FIPS deployment. AES-SIV, the deterministic algorithm, is not FIPS-approved and runs on RustCrypto whatever the backend, so deterministic fields stay outside the validated boundary, see aws-lc-rs and FIPS;
  • No C toolchain: rustcrypto is pure Rust;
  • Zeroisation: what each backend leaves in freed memory is in Crypto backends.

A build may enable several backends at once, and code generic over the backend bounds it with B: AeadBackend and nothing else, see Code generic over the backend.