AwsEncryptionSdk.Stream (AWS Encryption SDK v0.7.0)

View Source

Streaming encryption and decryption APIs.

Provides Stream-compatible functions for processing large data incrementally.

Example

# Encrypt a file stream
File.stream!("input.bin", [], 4096)
|> AwsEncryptionSdk.Stream.encrypt(client)
|> Stream.into(File.stream!("output.encrypted"))
|> Stream.run()

# Decrypt a file stream
File.stream!("output.encrypted", [], 4096)
|> AwsEncryptionSdk.Stream.decrypt(client)
|> Stream.map(fn {plaintext, _status} -> plaintext end)
|> Stream.into(File.stream!("decrypted.bin"))
|> Stream.run()

Summary

Functions

Creates a stream that decrypts ciphertext chunks.

Creates a stream that encrypts plaintext chunks.

Functions

decrypt(ciphertext_stream, client, opts \\ [])

Creates a stream that decrypts ciphertext chunks.

Returns a Stream that emits {plaintext, status} tuples where status is :verified or :unverified.

Options

  • :encryption_context - Reproduced context to validate (optional)
  • :fail_on_signed - Fail immediately on signed suites (default: false)

encrypt(plaintext_stream, client, opts \\ [])

Creates a stream that encrypts plaintext chunks.

Returns a Stream that emits ciphertext binaries.

Options

  • :encryption_context - Encryption context (default: %{})
  • :frame_length - Frame size in bytes (default: 4096)
  • :algorithm_suite - Algorithm suite to use (default: from client)