AwsEncryptionSdk.Encrypt (AWS Encryption SDK v0.7.0)
View SourceMessage encryption operations.
Encrypts plaintext into AWS Encryption SDK message format using provided encryption materials. This is a non-streaming implementation that requires the entire plaintext in memory.
Algorithm Suite Selection
Uses the algorithm suite from the provided encryption materials. For committed suites (recommended), the message will use format version 2.
Summary
Functions
Encrypts plaintext into an AWS Encryption SDK message.
Types
@type encrypt_opts() :: [{:frame_length, pos_integer()}]
@type encrypt_result() :: %{ ciphertext: binary(), header: AwsEncryptionSdk.Format.Header.t(), encryption_context: map(), algorithm_suite: AwsEncryptionSdk.AlgorithmSuite.t() }
Functions
@spec encrypt( AwsEncryptionSdk.Materials.EncryptionMaterials.t(), binary(), encrypt_opts() ) :: {:ok, encrypt_result()} | {:error, term()}
Encrypts plaintext into an AWS Encryption SDK message.
Parameters
materials- Encryption materials containing algorithm suite, data key, and EDKsplaintext- Data to encryptopts- Options::frame_length- Frame size in bytes (default: 4096)
Returns
{:ok, result}- Encryption succeeded; result contains ciphertext, header, etc.{:error, reason}- Encryption failed