1Rijndael(3) User Contributed Perl Documentation Rijndael(3)
2
3
4
6 Crypt::Rijndael - Crypt::CBC compliant Rijndael encryption module
7
9 Version 1.13
10
12 use Crypt::Rijndael;
13
14 # keysize() is 32, but 24 and 16 are also possible
15 # blocksize() is 16
16
17 $cipher = Crypt::Rijndael->new( "a" x 32, Crypt::Rijndael::MODE_CBC() );
18
19 $cipher->set_iv($iv);
20 $crypted = $cipher->encrypt($plaintext);
21 # - OR -
22 $plaintext = $cipher->decrypt($crypted);
23
25 This module implements the Rijndael cipher, which has just been
26 selected as the Advanced Encryption Standard.
27
28 keysize
29 Returns the keysize, which is 32 (bytes). The Rijndael cipher
30 actually supports keylengths of 16, 24 or 32 bytes, but there is no
31 way to communicate this to "Crypt::CBC".
32
33 blocksize
34 The blocksize for Rijndael is 16 bytes (128 bits), although the
35 algorithm actually supports any blocksize that is any multiple of
36 our bytes. 128 bits, is however, the AES-specified block size, so
37 this is all we support.
38
39 $cipher = Crypt::Rijndael->new( $key [, $mode] )
40 Create a new "Crypt::Rijndael" cipher object with the given key
41 (which must be 128, 192 or 256 bits long). The additional $mode
42 argument is the encryption mode, either "MODE_ECB" (electronic
43 codebook mode, the default), "MODE_CBC" (cipher block chaining, the
44 same that "Crypt::CBC" does), "MODE_CFB" (128-bit cipher feedback),
45 "MODE_OFB" (128-bit output feedback), or "MODE_CTR" (counter mode).
46
47 ECB mode is very insecure (read a book on cryptography if you don't
48 know why!), so you should probably use CBC mode.
49
50 $cipher->set_iv($iv)
51 This allows you to change the initial value vector used by the
52 chaining modes. It is not relevant for ECB mode.
53
54 $cipher->encrypt($data)
55 Encrypt data. The size of $data must be a multiple of "blocksize"
56 (16 bytes), otherwise this function will croak. Apart from that, it
57 can be of (almost) any length.
58
59 $cipher->decrypt($data)
60 Decrypts $data.
61
62 Encryption modes
63 Use these constants to select the cipher type:
64
65 MODE_CBC - Cipher Block Chaining
66 MODE_CFB - Cipher feedback
67 MODE_CTR - Counter mode
68 MODE_ECB - Electronic cookbook mode
69 MODE_OFB - Output feedback
70 MODE_PCBC - ignore this one for now :)
71
73 Crypt::CBC, http://www.csrc.nist.gov/encryption/aes/
74
76 Should EXPORT or EXPORT_OK the MODE constants.
77
79 Currently maintained by Leon Timmermans "leont@cpan.org".
80
81 Previously maintained by brian d foy, "<bdfoy@cpan.org>".
82
83 Original code by Rafael R. Sevilla.
84
85 The Rijndael Algorithm was developed by Vincent Rijmen and Joan Daemen,
86 and has been selected as the US Government's Advanced Encryption
87 Standard.
88
90 This code is in Github:
91
92 git://github.com/leont/crypt-rijndael.git
93
95 This software is licensed under the Lesser GNU Public License v3 (29
96 June 2007). See the included COPYING file for details.
97
98
99
100perl v5.28.0 2015-05-23 Rijndael(3)