Crypt_AES

# Class: Crypt_AES

Source Location: /lib/3rdParty/phpseclib/Crypt/AES.php

### Class Overview

    Crypt_Rijndael
       |
       --Crypt_AES

Pure-PHP implementation of AES.

#### Author(s):

- Jim Wigginton <terrafrost@php.net>

#### Version:

- 0.1.0

### Methods

- Crypt_AES
- decrypt
- encrypt
- setBlockLength

### Inherited Methods

#### Class: Crypt_Rijndael

Crypt_Rijndael::Crypt_Rijndael()
  Default Constructor.
Crypt_Rijndael::decrypt()
  Decrypts a message.
Crypt_Rijndael::disableContinuousBuffer()
  Treat consecutive packets as if they are a discontinuous buffer.
Crypt_Rijndael::disablePadding()
  Do not pad packets.
Crypt_Rijndael::enableContinuousBuffer()
  Treat consecutive "packets" as if they are a continuous buffer.
Crypt_Rijndael::enablePadding()
  Pad "packets".
Crypt_Rijndael::encrypt()
  Encrypts a message.
Crypt_Rijndael::setBlockLength()
  Sets the block length
Crypt_Rijndael::setIV()
  Sets the initialization vector. (optional)
Crypt_Rijndael::setKey()
  Sets the key.
Crypt_Rijndael::setKeyLength()
  Sets the key length
Crypt_Rijndael::_generate_xor()
  Generate CTR XOR encryption key

### Class Details

[line 132]
Pure-PHP implementation of AES.

#### Tags:

author: | Jim Wigginton <terrafrost@php.net>
version: | 0.1.0
access: | public

[ Top ]

### Class Methods

### constructor Crypt_AES [line 177]

`Crypt_AES Crypt_AES( [optional $mode = CRYPT_AES_MODE_CBC])`

Default Constructor.

Determines whether or not the mcrypt extension should be used. $mode should only, at present, be CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC. If not explictly set, CRYPT_AES_MODE_CBC will be used.

#### Tags:

access: | public

#### Parameters:

optional | $mode | Integer $mode

[ Top ]

### method decrypt [line 356]

`void decrypt( String $ciphertext)`

Decrypts a message.

If strlen($ciphertext) is not a multiple of 16, null bytes will be added to the end of the string until it is.

#### Tags:

see: | Crypt_AES::encrypt()
access: | public

Overrides Crypt_Rijndael::decrypt() (Decrypts a message.)

#### Parameters:

String | $ciphertext |

[ Top ]

### method encrypt [line 278]

`void encrypt( String $plaintext)`

Encrypts a message.

$plaintext will be padded with up to 16 additional bytes. Other AES implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's necessary are discussed in the following URL:

http://www.di-mgt.com.au/cryptopad.html

An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. strlen($plaintext) will still need to be a multiple of 16, however, arbitrary values can be added to make it that length.

#### Tags:

see: | Crypt_AES::decrypt()
access: | public

Overrides Crypt_Rijndael::encrypt() (Encrypts a message.)

#### Parameters:

String | $plaintext |

[ Top ]

### method setBlockLength [line 256]

`void setBlockLength( Integer $length)`

Dummy function

Since Crypt_AES extends Crypt_Rijndael, this function is, technically, available, but it doesn't do anything.

#### Tags:

access: | public

Overrides Crypt_Rijndael::setBlockLength() (Sets the block length)

#### Parameters:

Integer | $length |

[ Top ]

Documentation generated on Tue, 22 Nov 2011 16:29:27 +0100 by phpDocumentor 1.4.1