1Crypt::OpenSSL::AES(3)User Contributed Perl DocumentationCrypt::OpenSSL::AES(3)
2
3
4
6 Crypt::OpenSSL::AES - A Perl wrapper around OpenSSL's AES library
7
9 use Crypt::OpenSSL::AES;
10
11 my $cipher = new Crypt::OpenSSL::AES($key);
12
13 $encrypted = $cipher->encrypt($plaintext)
14 $decrypted = $cipher->decrypt($encrypted)
15
17 This module implements a wrapper around OpenSSL. Specifically, it
18 wraps the methods related to the US Government's Advanced Encryption
19 Standard (the Rijndael algorithm).
20
21 This module is compatible with Crypt::CBC (and likely other modules
22 that utilize a block cipher to make a stream cipher).
23
24 This module is an alternative to the implementation provided by
25 Crypt::Rijndael which implements AES itself. In contrast, this module
26 is simply a wrapper around the OpenSSL library.
27
28 The Crypt::Rijndael implementation seems to produce inaccurate results
29 on 64-bit x86 machines. By using OpenSSL, this module aims to avoid
30 architecture specific problems, allowing the OpenSSL maintainers to
31 overcome such issues.
32
33 $cipher->encrypt($data)
34 Encrypt data. The size of $data must be exactly "blocksize" in
35 length (16 bytes), otherwise this function will croak.
36
37 You should use Crypt::CBC or something similar to encrypt/decrypt
38 data of arbitrary lengths.
39
40 $cipher->decrypt($data)
41 Decrypts $data. The size of $data must be exactly "blocksize" in
42 length (16 bytes), otherwise this function will croak.
43
44 You should use Crypt::CBC or something similar to encrypt/decrypt
45 data of arbitrary lengths.
46
47 keysize
48 This method is used by Crypt::CBC to verify the key length. This
49 module actually supports key lengths of 16, 24, and 32 bytes, but
50 this method always returns 32 for Crypt::CBC's sake.
51
52 blocksize
53 This method is used by Crypt::CBC to check the block size. The
54 blocksize for AES is always 16 bytes.
55
56 USE WITH CRYPT::CBC
57 use Crypt::CBC
58
59 $cipher = Crypt::CBC->new(
60 -key => $key,
61 -cipher => "Crypt::OpenSSL::AES"
62 );
63
64 $encrypted = $cipher->encrypt($plaintext)
65 $decrypted = $cipher->decrypt($encrypted)
66
68 Crypt::CBC
69
70 http://www.openssl.org/
71
72 http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
73
74 http://www.csrc.nist.gov/encryption/aes/
75
77 Need more (and better) test cases.
78
80 Tolga Tarhan, <cpan at ttar dot org>
81
82 The US Government's Advanced Encryption Standard is the Rijndael
83 Algorithm and was developed by Vincent Rijmen and Joan Daemen.
84
86 Copyright (C) 2006 DelTel, Inc.
87
88 This library is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself, either Perl version 5.8.5 or, at
90 your option, any later version of Perl 5 you may have available.
91
92
93
94perl v5.32.0 2020-07-28 Crypt::OpenSSL::AES(3)