.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Rijndael 3pm" .TH Rijndael 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Crypt::Rijndael \- Crypt::CBC compliant Rijndael encryption module .SH VERSION .IX Header "VERSION" Version 1.16 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Crypt::Rijndael; \& \& # keysize() is 32, but 24 and 16 are also possible \& # blocksize() is 16 \& \& $cipher = Crypt::Rijndael\->new( "a" x 32, Crypt::Rijndael::MODE_CBC() ); \& \& $cipher\->set_iv($iv); \& $crypted = $cipher\->encrypt($plaintext); \& # \- OR \- \& $plaintext = $cipher\->decrypt($crypted); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module implements the Rijndael cipher, which has just been selected as the Advanced Encryption Standard. .IP keysize 4 .IX Item "keysize" Returns the keysize, which is 32 (bytes). The Rijndael cipher actually supports keylengths of 16, 24 or 32 bytes, but there is no way to communicate this to \f(CW\*(C`Crypt::CBC\*(C'\fR. .IP blocksize 4 .IX Item "blocksize" The blocksize for Rijndael is 16 bytes (128 bits), although the algorithm actually supports any blocksize that is any multiple of our bytes. 128 bits, is however, the AES-specified block size, so this is all we support. .ie n .IP "$cipher = Crypt::Rijndael\->new( $key [, $mode] )" 4 .el .IP "\f(CW$cipher\fR = Crypt::Rijndael\->new( \f(CW$key\fR [, \f(CW$mode\fR] )" 4 .IX Item "$cipher = Crypt::Rijndael->new( $key [, $mode] )" Create a new \f(CW\*(C`Crypt::Rijndael\*(C'\fR cipher object with the given key (which must be 128, 192 or 256 bits long). The additional \f(CW$mode\fR argument is the encryption mode, either \f(CW\*(C`MODE_ECB\*(C'\fR (electronic codebook mode, the default), \f(CW\*(C`MODE_CBC\*(C'\fR (cipher block chaining, the same that \f(CW\*(C`Crypt::CBC\*(C'\fR does), \f(CW\*(C`MODE_CFB\*(C'\fR (128\-bit cipher feedback), \&\f(CW\*(C`MODE_OFB\*(C'\fR (128\-bit output feedback), or \f(CW\*(C`MODE_CTR\*(C'\fR (counter mode). .Sp ECB mode is very insecure (read a book on cryptography if you don't know why!), so you should probably use CBC mode. .ie n .IP $cipher\->set_iv($iv) 4 .el .IP \f(CW$cipher\fR\->set_iv($iv) 4 .IX Item "$cipher->set_iv($iv)" This allows you to change the initial value vector used by the chaining modes. It is not relevant for ECB mode. .ie n .IP $cipher\->encrypt($data) 4 .el .IP \f(CW$cipher\fR\->encrypt($data) 4 .IX Item "$cipher->encrypt($data)" Encrypt data. The size of \f(CW$data\fR must be a multiple of \f(CW\*(C`blocksize\*(C'\fR (16 bytes), otherwise this function will croak. Apart from that, it can be of (almost) any length. .ie n .IP $cipher\->decrypt($data) 4 .el .IP \f(CW$cipher\fR\->decrypt($data) 4 .IX Item "$cipher->decrypt($data)" Decrypts \f(CW$data\fR. .SS "Encryption modes" .IX Subsection "Encryption modes" Use these constants to select the cipher type: .IP "MODE_CBC \- Cipher Block Chaining" 4 .IX Item "MODE_CBC - Cipher Block Chaining" .PD 0 .IP "MODE_CFB \- Cipher feedback" 4 .IX Item "MODE_CFB - Cipher feedback" .IP "MODE_CTR \- Counter mode" 4 .IX Item "MODE_CTR - Counter mode" .IP "MODE_ECB \- Electronic cookbook mode" 4 .IX Item "MODE_ECB - Electronic cookbook mode" .IP "MODE_OFB \- Output feedback" 4 .IX Item "MODE_OFB - Output feedback" .IP "MODE_PCBC \- ignore this one for now :)" 4 .IX Item "MODE_PCBC - ignore this one for now :)" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" Crypt::CBC, http://www.csrc.nist.gov/encryption/aes/ .SH BUGS .IX Header "BUGS" Should EXPORT or EXPORT_OK the MODE constants. .SH AUTHOR .IX Header "AUTHOR" Currently maintained by Leon Timmermans \f(CW\*(C`leont@cpan.org\*(C'\fR. .PP Previously maintained by brian d foy, \f(CW\*(C`\*(C'\fR. .PP Original code by Rafael R. Sevilla. .PP The Rijndael Algorithm was developed by Vincent Rijmen and Joan Daemen, and has been selected as the US Government's Advanced Encryption Standard. .SH SOURCE .IX Header "SOURCE" This code is in Github: .PP .Vb 1 \& git://github.com/leont/crypt\-rijndael.git .Ve .SH LICENSE .IX Header "LICENSE" This software is licensed under the Lesser GNU Public License v3 (29 June 2007). See the included COPYING file for details.