CryptMT  1.0
データ構造 | Public メソッド
クラス cryptmt::CryptMT

CryptMT ストリーム暗号 [詳細]

#include <cryptmt.h>

データ構造

class  stage_exception
 CryptMT の状態エラー [詳細]
 

Public メソッド

cryptmt::CryptMT::stage_exception
std::runtime_error 
CryptMT (const uint8_t *key, int keysize, int ivsize) throw (std::bad_alloc,std::invalid_argument)
 キー長とIV長はビット単位の長さであり、128 の倍数で maxKeySize(), 以下の数である必要がある。 この条件に違反するとinvalid_argument 例外が発生する。 必要な内部メモリ割り当てに失敗するとbad_alloc例外が発生する。 [詳細]
 
void IVSetUp (const uint8_t *iv)
 初期化ベクトル設定 [詳細]
 
void encrypt (const uint8_t *plaintext, uint8_t *ciphertext, uint64_t msglen) throw (stage_exception)
 plaintext を暗号化して ciphertext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
void decrypt (const uint8_t *ciphertext, uint8_t *plaintext, uint64_t msglen) throw (stage_exception)
 ciphertext を復号して plaintext にセットする。 stream 暗号の場合、暗号化と復号は同じ処理である。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
void encryptPacket (const uint8_t *iv, const uint8_t *plaintext, uint8_t *ciphertext, uint64_t msglen)
 iv でsetUpIV() してから、 plaintext を暗号化して ciphertext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
void decryptPacket (const uint8_t *iv, const uint8_t *ciphertext, uint8_t *plaintext, uint64_t msglen)
 iv でsetUpIV() してから、 ciphertext を復号して plaintext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
void encryptBlocks (const uint8_t *plaintext, uint8_t *ciphertext, uint32_t blocks) throw (stage_exception)
 plaintext を暗号化して ciphertext にセットする。 1 ブロックの長さは、 blockLength() で取得できる。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
void decryptBlocks (const uint8_t *ciphertext, uint8_t *plaintext, uint32_t blocks) throw (stage_exception)
 ciphertext を復号して plaintext にセットする。 1 ブロックの長さは、 blockLength() で取得できる。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。 [詳細]
 
uint32_t blockLength ()
 encryptBlocks(), decryptBlocks() を使うときに 必要となるブロック長を返す。 [詳細]
 

説明

CryptMT ストリーム暗号

コンストラクタとデストラクタ

cryptmt::CryptMT::stage_exception std::runtime_error cryptmt::CryptMT::CryptMT ( const uint8_t *  key,
int  keysize,
int  ivsize 
) throw (std::bad_alloc,std::invalid_argument)

キー長とIV長はビット単位の長さであり、128 の倍数で maxKeySize(), 以下の数である必要がある。 この条件に違反するとinvalid_argument 例外が発生する。 必要な内部メモリ割り当てに失敗するとbad_alloc例外が発生する。

引数
[in]key暗号化キー
[in]keysizeビット単位のキーサイズ
[in]ivsizeビット単位のIVサイズ
例外
std::bad_alloc内部メモリの割り当てに失敗した時
std::invalid_argumentkeysize または ivsize が適切でない。

関数

uint32_t cryptmt::CryptMT::blockLength ( )

encryptBlocks(), decryptBlocks() を使うときに 必要となるブロック長を返す。

戻り値
ブロック長(バイト)
void cryptmt::CryptMT::decrypt ( const uint8_t *  ciphertext,
uint8_t *  plaintext,
uint64_t  msglen 
) throw (stage_exception)
inline

ciphertext を復号して plaintext にセットする。 stream 暗号の場合、暗号化と復号は同じ処理である。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

この関数の実行後は、IVSetUp を実行するまでは、以下の暗号化および 復号関数を実行してはならない。 encrypt(),decrypt(), encryptBlocks(),decryptBlocks().

引数
[in]ciphertext暗号文
[out]plaintext平文
[in]msglen暗号文の長さ(バイト)
例外
stage_exceptionIVSetUp() を実行していない、または decrypt() 呼び出しの後に IVSetUp() を実行していない。

参照先 encrypt().

void cryptmt::CryptMT::decryptBlocks ( const uint8_t *  ciphertext,
uint8_t *  plaintext,
uint32_t  blocks 
) throw (stage_exception)
inline

ciphertext を復号して plaintext にセットする。 1 ブロックの長さは、 blockLength() で取得できる。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

引数
[in]ciphertext暗号文
[out]plaintext平文
[in]blocks平文の長さ(ブロック数)
例外
stage_exceptionIVSetUp() を実行していない、または decrypt() 呼び出しの後に IVSetUp() を実行していない。

参照先 encryptBlocks().

void cryptmt::CryptMT::decryptPacket ( const uint8_t *  iv,
const uint8_t *  ciphertext,
uint8_t *  plaintext,
uint64_t  msglen 
)
inline

iv でsetUpIV() してから、 ciphertext を復号して plaintext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

この関数の実行後は、IVSetUp を実行するまでは、以下の暗号化および 復号関数を実行してはならない。 encrypt(),decrypt(), encryptBlocks(),decryptBlocks().

引数
[in]iv初期化ベクトル
[in]ciphertext暗号文
[out]plaintext平文
[in]msglen平文の長さ(バイト)

参照先 encryptPacket().

void cryptmt::CryptMT::encrypt ( const uint8_t *  plaintext,
uint8_t *  ciphertext,
uint64_t  msglen 
) throw (stage_exception)

plaintext を暗号化して ciphertext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

この関数の実行後は、IVSetUp を実行するまでは、以下の暗号化および 復号関数を実行してはならない。 encrypt(), decrypt(), encryptBlocks(), decryptBlocks().

引数
[in]plaintext平文
[out]ciphertext暗号文
[in]msglen平文の長さ(バイト)
例外
stage_exceptionIVSetUp() を実行していない、または encrypt() 呼び出しの後に IVSetUp() を実行していない。

参照元 decrypt(), と encryptPacket().

void cryptmt::CryptMT::encryptBlocks ( const uint8_t *  plaintext,
uint8_t *  ciphertext,
uint32_t  blocks 
) throw (stage_exception)

plaintext を暗号化して ciphertext にセットする。 1 ブロックの長さは、 blockLength() で取得できる。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

引数
[in]plaintext平文
[out]ciphertext暗号文
[in]blocks平文の長さ(ブロック数)
例外
stage_exceptionIVSetUp() を実行していない、または decrypt() 呼び出しの後に IVSetUp() を実行していない。

参照元 decryptBlocks().

void cryptmt::CryptMT::encryptPacket ( const uint8_t *  iv,
const uint8_t *  plaintext,
uint8_t *  ciphertext,
uint64_t  msglen 
)
inline

iv でsetUpIV() してから、 plaintext を暗号化して ciphertext にセットする。 plaintextciphertext のアドレスは整列されて いなければならない。aligned_alloc() を使用すれば整列された アドレスのメモリが取得できる。

この関数の実行後は、IVSetUp を実行するまでは、以下の暗号化および 復号関数を実行してはならない。 encrypt(),decrypt(), encryptBlocks(),decryptBlocks().

引数
[in]iv初期化ベクトル
[in]plaintext平文
[out]ciphertext暗号文
[in]msglen平文の長さ(バイト)

参照先 encrypt(), と IVSetUp().

参照元 decryptPacket().

void cryptmt::CryptMT::IVSetUp ( const uint8_t *  iv)

初期化ベクトル設定

暗号化をする前に初期ベクトル設定をしなければならない。 この条件に反すると、stage_exception 例外が発生する。

引数
iv初期化ベクトル

参照元 encryptPacket().


このクラスの説明は次のファイルから生成されました: