Skip to content

Adds non-AWS encryption examples#85

Merged
johnnyt merged 1 commit intomainfrom
74-non-aws-examples
Feb 1, 2026
Merged

Adds non-AWS encryption examples#85
johnnyt merged 1 commit intomainfrom
74-non-aws-examples

Conversation

@johnnyt
Copy link
Member

@johnnyt johnnyt commented Feb 1, 2026

Implements three new runnable examples demonstrating SDK usage without AWS credentials or KMS keys:

  • raw_aes_basic.exs: AES-GCM encryption with all key sizes (128/192/256-bit), encryption context, and error handling

  • raw_rsa.exs: RSA encryption with all 5 padding schemes (PKCS#1 v1.5, OAEP-SHA1/256/384/512), environment variable PEM key loading, and asymmetric key patterns

  • multi_keyring_local.exs: Multi-keyring demonstrating key redundancy, rotation scenarios, and generator + children pattern

Fixes RSA keyring bug where load_public_key_pem and load_private_key_pem incorrectly used der_decode instead of pem_entry_decode, causing PEM-loaded keys to fail encryption.

Updates all KMS examples (basic, discovery, cross_region, multi_keyring) to use correct Client API format where encrypt returns a map with ciphertext field and decrypt returns a map with plaintext and encryption_context fields.

Updates examples/README.md to clearly distinguish AWS vs non-AWS examples with Quick Start section for local usage.

Closes #74

Implements three new runnable examples demonstrating SDK usage
without AWS credentials or KMS keys:

- raw_aes_basic.exs: AES-GCM encryption with all key sizes
  (128/192/256-bit), encryption context, and error handling

- raw_rsa.exs: RSA encryption with all 5 padding schemes
  (PKCS#1 v1.5, OAEP-SHA1/256/384/512), environment variable
  PEM key loading, and asymmetric key patterns

- multi_keyring_local.exs: Multi-keyring demonstrating key
  redundancy, rotation scenarios, and generator + children pattern

Fixes RSA keyring bug where load_public_key_pem and
load_private_key_pem incorrectly used der_decode instead of
pem_entry_decode, causing PEM-loaded keys to fail encryption.

Updates all KMS examples (basic, discovery, cross_region,
multi_keyring) to use correct Client API format where encrypt
returns a map with ciphertext field and decrypt returns a map
with plaintext and encryption_context fields.

Updates examples/README.md to clearly distinguish AWS vs
non-AWS examples with Quick Start section for local usage.

Closes #74
@johnnyt johnnyt merged commit 9cab057 into main Feb 1, 2026
1 check passed
@johnnyt johnnyt deleted the 74-non-aws-examples branch February 1, 2026 17:18
@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
- Coverage   92.75%   92.74%   -0.02%     
==========================================
  Files          40       40              
  Lines        1435     1433       -2     
==========================================
- Hits         1331     1329       -2     
  Misses        104      104              
Files with missing lines Coverage Δ
lib/aws_encryption_sdk/keyring/raw_rsa.ex 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Non-AWS Encryption Examples (Raw AES & RSA)

1 participant