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