X-Git-Url: https://git.stricted.de/?p=GitHub%2FStricted%2Fspeedport-hybrid-php-api.git;a=blobdiff_plain;f=CryptLib%2FCipher%2FBlock%2FCipher.php;fp=CryptLib%2FCipher%2FBlock%2FCipher.php;h=e250ab59b0049b77a45a5e368ca96b039f89105d;hp=0000000000000000000000000000000000000000;hb=14d4f286d33b631a93207e4d13086c0a3bc0df12;hpb=c9e082da5cc662b64a74d3770f13d1270068678f diff --git a/CryptLib/Cipher/Block/Cipher.php b/CryptLib/Cipher/Block/Cipher.php new file mode 100644 index 0000000..e250ab5 --- /dev/null +++ b/CryptLib/Cipher/Block/Cipher.php @@ -0,0 +1,90 @@ + + * @copyright 2011 The Authors + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version Build @@version@@ + */ + +namespace CryptLib\Cipher\Block; + +/** + * The interface that all block ciphers must implement + * + * @category PHPCryptLib + * @package Cipher + * @subpackage Block + * @author Anthony Ferrara + * @codeCoverageIgnore + */ +interface Cipher { + + /** + * Get a list of supported ciphers by this cipher. + * + * @return array An array of supported cipher names (strings) + */ + public static function getSupportedCiphers(); + + /** + * Decrypt a block of data using the supplied string key. + * + * Note that the supplied data should be the same size as the block size of + * the cipher being used. + * + * @param string $data The data to decrypt + * + * @return string The result decrypted data + */ + public function decryptBlock($data); + + /** + * Encrypt a block of data using the supplied string key. + * + * Note that the supplied data should be the same size as the block size of + * the cipher being used. + * + * @param string $data The data to encrypt + * + * @return string The result encrypted data + */ + public function encryptBlock($data); + + /** + * Get the block size for the current initialized cipher. + * + * @return int The block size for the current cipher + */ + public function getBlockSize(); + + /** + * Get the key size for the current initialized cipher + * + * @return int The key size for the current cipher + */ + public function getKeySize(); + + /** + * Get the string name of the current cipher instance. + * + * @return string The current instantiated cipher + */ + public function getCipher(); + + /** + * Set the key to be used in this instance + * + * @param string $key The key the data will be encrypted with + * + * @return void + */ + public function setKey($key); + +}