NAME
Crypt::AuthEnc::EAX - Authenticated encryption in EAX mode
SYNOPSIS
my $ae = Crypt::AuthEnc::EAX->new( "AES" , $key , $iv );
$ae ->adata_add( 'additional_authenticated_data1' );
$ae ->adata_add( 'additional_authenticated_data2' );
my $ct = $ae ->encrypt_add( 'data1' );
$ct .= $ae ->encrypt_add( 'data2' );
$ct .= $ae ->encrypt_add( 'data3' );
my $tag = $ae ->encrypt_done();
my $ae = Crypt::AuthEnc::EAX->new( "AES" , $key , $iv );
$ae ->adata_add( 'additional_authenticated_data1' );
$ae ->adata_add( 'additional_authenticated_data2' );
my $pt = $ae ->decrypt_add( 'ciphertext1' );
$pt .= $ae ->decrypt_add( 'ciphertext2' );
$pt .= $ae ->decrypt_add( 'ciphertext3' );
my $tag = $ae ->decrypt_done();
die "decrypt failed" unless $tag eq $expected_tag ;
my $result = $ae ->decrypt_done( $expected_tag );
my ( $ciphertext , $tag ) = eax_encrypt_authenticate( 'AES' , $key , $iv , $adata , $plaintext );
my $plaintext = eax_decrypt_verify( 'AES' , $key , $iv , $adata , $ciphertext , $tag );
|
DESCRIPTION
EAX is a mode that requires a cipher, CTR and OMAC support and provides encryption and authentication. It is initialized with a random IV that can be shared publicly, additional authenticated data which can be fixed and public, and a random secret symmetric key.
EXPORT
Nothing is exported by default.
You can export selected functions:
FUNCTIONS
eax_encrypt_authenticate
my ( $ciphertext , $tag ) = eax_encrypt_authenticate( $cipher , $key , $iv , $adata , $plaintext );
|
eax_decrypt_verify
my $plaintext = eax_decrypt_verify( $cipher , $key , $iv , $adata , $ciphertext , $tag );
|
METHODS
new
my $ae = Crypt::AuthEnc::EAX->new( $cipher , $key , $iv );
my $ae = Crypt::AuthEnc::EAX->new( $cipher , $key , $iv , $adata );
|
adata_add
encrypt_add
$ciphertext = $ae ->encrypt_add( $data );
|
encrypt_done
$tag = $ae ->encrypt_done();
|
decrypt_add
$plaintext = $ae ->decrypt_add( $ciphertext );
|
decrypt_done
my $tag = $ae ->decrypt_done;
my $result = $ae ->decrypt_done( $tag );
|
clone
SEE ALSO