add methods to decrypt return data from router
[GitHub/Stricted/speedport-hybrid-php-api.git] / CryptLib / Cipher / Block / Cipher / AES.php
diff --git a/CryptLib/Cipher/Block/Cipher/AES.php b/CryptLib/Cipher/Block/Cipher/AES.php
new file mode 100644 (file)
index 0000000..41d9785
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/**
+ * An implementation of the AES cipher, using the phpseclib implementation
+ * 
+ * This was forked from phpseclib and modified to use CryptLib conventions
+ *
+ * PHP version 5.3
+ *
+ * @category   PHPCryptLib
+ * @package    Cipher
+ * @subpackage Block
+ * @author     Anthony Ferrara <ircmaxell@ircmaxell.com>
+ * @author     Jim Wigginton <terrafrost@php.net>
+ * @copyright  2011 The Authors
+ * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
+ * @version    Build @@version@@
+ */
+
+namespace CryptLib\Cipher\Block\Cipher;
+
+/**
+ * An implementation of the AES cipher, using the phpseclib implementation
+ *
+ * @category   PHPCryptLib
+ * @package    Cipher
+ * @subpackage Block
+ * @author     Anthony Ferrara <ircmaxell@ircmaxell.com>
+ */
+class AES extends Rijndael {
+
+    /**
+     * Get a list of supported ciphers for this class implementation
+     *
+     * @return array A list of supported ciphers
+     */
+    public static function getSupportedCiphers() {
+        return array(
+            'aes-128',
+            'aes-192',
+            'aes-256',
+        );
+    }
+
+    /**
+     * Construct the instance for the supplied cipher name
+     *
+     * @param string $cipher The cipher to implement
+     *
+     * @return void
+     * @throws InvalidArgumentException if the cipher is not supported
+     */
+    public function __construct($cipher) {
+        parent::__construct($cipher);
+        list (, $bits) = explode('-', $cipher, 2);
+        $this->setBlockSize(128);
+        $this->setKeySize($bits);
+    }
+
+}