/** * Imports a Rijndael 256 key * * @param string Name of the encryption profile * @param string Key encoded in base64 * @return CryptoModel */ public static function importRijnDael256Key($name, $key) { if (!isset(self::$cryptoTable)) { self::$cryptoTable = QFrame_Db_Table::getTable('crypto'); } $transactionNumber = self::startSerializableTransaction(); if (self::$cryptoTable->getCryptoID($name) !== NULL) { throw new Exception('Profile name already exists [' . $name . ']'); } if (strlen($key) !== 44) { throw new Exception('Key length must be 44 characters.'); } $row = self::$cryptoTable->createRow(); $row->name = $name; $row->cryptoKey = $key; $row->type = 'RIJNDAEL_256'; $row->save(); self::dbCommit($transactionNumber); return new CryptoModel(array('name' => $name)); }