1Image::ExifTool::AES(3)User Contributed Perl DocumentatioInmage::ExifTool::AES(3)
2
3
4

NAME

6       Image::ExifTool::AES - AES encryption with cipher-block chaining
7

SYNOPSIS

9         use Image::ExifTool::AES qw(Crypt);
10
11         $err = Crypt(\$plaintext, $key, 1);   # encryption
12
13         $err = Crypt(\$ciphertext, $key);     # decryption
14

DESCRIPTION

16       This module contains an implementation of the AES encryption/decryption
17       algorithms with cipher-block chaining (CBC) and RFC 2898 PKCS #5
18       padding.  This is the AESV2 and AESV3 encryption mode used in PDF
19       documents.
20

EXPORTS

22       Exports nothing by default, but "Crypt" may be exported.
23

METHODS

25   Crypt
26       Implement AES encryption/decryption with cipher-block chaining.
27
28       Inputs:
29           0) Scalar reference for data to encrypt/decrypt.
30
31           1) Encryption key string (must have length 16, 24 or 32).
32
33           2) [optional] Encrypt flag (false to decrypt).
34
35           3) [optional] Flag to avoid removing padding after decrypting, or
36           to avoid adding 16 bytes of padding before encrypting when data
37           length is already a multiple of 16 bytes.
38
39       Returns:
40           On success, the return value is undefined and the data is encrypted
41           or decrypted as specified.  Otherwise returns an error string and
42           the data is left in an indeterminate state.
43
44       Notes:
45           The length of the encryption key dictates the AES mode, with
46           lengths of 16, 24 and 32 bytes resulting in AES-128, AES-192 and
47           AES-256.
48
49           When encrypting, the input data may be any length and will be
50           padded to an even 16-byte block size using the specified padding
51           technique.  If the encrypt flag has length 16, it is used as the
52           initialization vector for the cipher-block chaining, otherwise a
53           random IV is generated.  Upon successful return the data will be
54           encrypted, with the first 16 bytes of the data being the CBC IV.
55
56           When decrypting, the input data begins with the 16-byte CBC
57           initialization vector.
58

BUGS

60       This code is blindingly slow.  But in truth, slowing down processing is
61       the main purpose of encryption, so this really can't be considered a
62       bug.
63

AUTHOR

65       Copyright 2003-2020, Phil Harvey (philharvey66 at gmail.com)
66
67       This library is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69

REFERENCES

71       <http://www.hoozi.com/Articles/AESEncryption.htm>
72       <http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf>
73       <http://www.faqs.org/rfcs/rfc3602.html>
74

SEE ALSO

76       Image::ExifTool(3pm)
77
78
79
80perl v5.30.1                      2020-01-31           Image::ExifTool::AES(3)
Impressum