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