Files
wolfssl/doc/dox_comments/header_files-ja/ed448.h

632 lines
28 KiB
C
Raw Normal View History

/*!
\ingroup ED448
\brief ED448公開鍵を生成しますPubkeyに格納しPubkeyszでこのバッファに書き込まれたバイトを設定します
\return 0
\return BAD_FUNC_ARG IFIキーまたはPubKeyがNULLに評価された場合57ED448には57バイトのキーがあります
\return MEMORY_E
\param [in] ED448_Keyへのキーポインタ
\param [out]
_Example_
\code
int ret;
ed448_key key;
byte priv[] = { initialize with 57 byte private key };
byte pub[57];
word32 pubSz = sizeof(pub);
wc_ed448_init(&key);
wc_ed448_import_private_only(priv, sizeof(priv), &key);
ret = wc_ed448_make_public(&key, pub, &pubSz);
if (ret != 0) {
// error making public key
}
\endcode
\sa wc_ed448_init
\sa wc_ed448_import_private_only
\sa wc_ed448_make_key
*/
int wc_ed448_make_public(ed448_key* key, unsigned char* pubKey,
word32 pubKeySz);
/*!
\ingroup ED448
\brief ED448キーを生成し
\return 0 ED448_Keyを正常に作成したときに返されます
\return BAD_FUNC_ARG RNGまたはKeyがNULLに評価された場合57ED448には57バイトのキーがあります
\return MEMORY_E
\param [in] RNGキーを生成する初期化されたRNGオブジェクトへのポインタ
\param [in] keysize keyの長さを生成しますED448の場合は常に57になります
_Example_
\code
int ret;
WC_RNG rng;
ed448_key key;
wc_InitRng(&rng);
wc_ed448_init(&key);
ret = wc_ed448_make_key(&rng, 57, &key);
if (ret != 0) {
// error making key
}
\endcode
\sa wc_ed448_init
*/
int wc_ed448_make_key(WC_RNG* rng, int keysize, ed448_key* key);
/*!
\ingroup ED448
\brief ED448_Keyオブジェクトを使用したメッセージに正解を保証します
\return 0
\return BAD_FUNC_ARG NULLに評価された場合
\return MEMORY_E
\param [in]
\param [in]
\param [out]
\param [in,out]
_Example_
\code
ed448_key key;
WC_RNG rng;
int ret, sigSz;
byte sig[114]; // will hold generated signature
sigSz = sizeof(sig);
byte message[] = { initialize with message };
wc_InitRng(&rng); // initialize rng
wc_ed448_init(&key); // initialize key
wc_ed448_make_key(&rng, 57, &key); // make public/private key pair
ret = wc_ed448_sign_msg(message, sizeof(message), sig, &sigSz, &key);
if (ret != 0 ) {
// error generating message signature
}
\endcode
\sa wc_ed448ph_sign_hash
\sa wc_ed448ph_sign_msg
\sa wc_ed448_verify_msg
*/
int wc_ed448_sign_msg(const byte* in, word32 inlen, byte* out,
word32 *outlen, ed448_key* key);
/*!
\ingroup ED448
\brief Ed448_Keyオブジェクトを使用してメッセージダイジェストに署名して信頼性を保証します使Shake-256
\return 0
\return BAD_FUNC_ARG NULLに評価されます
\return MEMORY_E
\param [in]
\param [in]
\param [out]
\param [in,out]
\param [in] ED448_Keyへのキーポインタ
\param [in]
_Example_
\code
ed448_key key;
WC_RNG rng;
int ret, sigSz;
byte sig[114]; // will hold generated signature
sigSz = sizeof(sig);
byte hash[] = { initialize with SHAKE-256 hash of message };
byte context[] = { initialize with context of signing };
wc_InitRng(&rng); // initialize rng
wc_ed448_init(&key); // initialize key
wc_ed448_make_key(&rng, 57, &key); // make public/private key pair
ret = wc_ed448ph_sign_hash(hash, sizeof(hash), sig, &sigSz, &key,
context, sizeof(context));
if (ret != 0) {
// error generating message signature
}
\endcode
\sa wc_ed448_sign_msg
\sa wc_ed448ph_sign_msg
\sa wc_ed448ph_verify_hash
*/
int wc_ed448ph_sign_hash(const byte* hash, word32 hashLen, byte* out,
word32 *outLen, ed448_key* key,
const byte* context, byte contextLen);
/*!
\ingroup ED448
\brief ED448_Keyオブジェクトを使用したメッセージに正解を保証します
\return 0
\return BAD_FUNC_ARG NULLに評価されます
\return MEMORY_E
\param [in]
\param [in]
\param [out]
\param [in,out]
\param [in] ED448_Keyへのキーポインタ
\param [in]
_Example_
\code
ed448_key key;
WC_RNG rng;
int ret, sigSz;
byte sig[114]; // will hold generated signature
sigSz = sizeof(sig);
byte message[] = { initialize with message };
byte context[] = { initialize with context of signing };
wc_InitRng(&rng); // initialize rng
wc_ed448_init(&key); // initialize key
wc_ed448_make_key(&rng, 57, &key); // make public/private key pair
ret = wc_ed448ph_sign_msg(message, sizeof(message), sig, &sigSz, &key,
context, sizeof(context));
if (ret != 0) {
// error generating message signature
}
\endcode
\sa wc_ed448_sign_msg
\sa wc_ed448ph_sign_hash
\sa wc_ed448ph_verify_msg
*/
int wc_ed448ph_sign_msg(const byte* in, word32 inLen, byte* out,
word32 *outLen, ed448_key* key, const byte* context,
byte contextLen);
/*!
\ingroup ED448
\brief ED448署名を確認して信頼性を確保しますRESを介して返され10
\return 0
\return BAD_FUNC_ARG NULLに評価された場合SIGLENが署名の実際の長さと一致しない場合に返されます
\return SIG_VERIFY_E
\param [in] SIGポインタ
\param [in]
\param [in] MSGポインタを確認する
\param [in] MSGlen長
\param [in] ED448キーへのキーポインタ
\param [in]
_Example_
\code
ed448_key key;
int ret, verified = 0;
byte sig[] { initialize with received signature };
byte msg[] = { initialize with message };
byte context[] = { initialize with context of signature };
// initialize key with received public key
ret = wc_ed448_verify_msg(sig, sizeof(sig), msg, sizeof(msg), &verified,
&key, context, sizeof(context));
if (ret < 0) {
// error performing verification
} else if (verified == 0)
// the signature is invalid
}
\endcode
\sa wc_ed448ph_verify_hash
\sa wc_ed448ph_verify_msg
\sa wc_ed448_sign_msg
*/
int wc_ed448_verify_msg(const byte* sig, word32 siglen, const byte* msg,
word32 msgLen, int* res, ed448_key* key,
const byte* context, byte contextLen);
/*!
\ingroup ED448
\brief ED448シグネチャを検証して使Shake-256RESを介して返され10
\return 0
\return BAD_FUNC_ARG NULLに評価された場合SIGLENが署名の実際の長さと一致しない場合に返されます
\return SIG_VERIFY_E
\param [in] SIGポインタ
\param [in]
\param [in]
\param [in]
\param [in] ED448キーへのキーポインタ
\param [in]
_Example_
\code
ed448_key key;
int ret, verified = 0;
byte sig[] { initialize with received signature };
byte hash[] = { initialize with SHAKE-256 hash of message };
byte context[] = { initialize with context of signature };
// initialize key with received public key
ret = wc_ed448ph_verify_hash(sig, sizeof(sig), hash, sizeof(hash),
&verified, &key, context, sizeof(context));
if (ret < 0) {
// error performing verification
} else if (verified == 0)
// the signature is invalid
}
\endcode
\sa wc_ed448_verify_msg
\sa wc_ed448ph_verify_msg
\sa wc_ed448ph_sign_hash
*/
int wc_ed448ph_verify_hash(const byte* sig, word32 siglen, const byte* hash,
word32 hashlen, int* res, ed448_key* key,
const byte* context, byte contextLen);
/*!
\ingroup ED448
\brief ED448署名を確認して信頼性を確保しますRESを介して返され10
\return 0
\return BAD_FUNC_ARG NULLに評価された場合SIGLENが署名の実際の長さと一致しない場合に返されます
\return SIG_VERIFY_E
\param [in] SIGポインタ
\param [in]
\param [in] MSGポインタを確認する
\param [in] MSGlen長
\param [in] ED448キーへのキーポインタ
\param [in]
_Example_
\code
ed448_key key;
int ret, verified = 0;
byte sig[] { initialize with received signature };
byte msg[] = { initialize with message };
byte context[] = { initialize with context of signature };
// initialize key with received public key
ret = wc_ed448ph_verify_msg(sig, sizeof(sig), msg, sizeof(msg), &verified,
&key, context, sizeof(context));
if (ret < 0) {
// error performing verification
} else if (verified == 0)
// the signature is invalid
}
\endcode
\sa wc_ed448_verify_msg
\sa wc_ed448ph_verify_hash
\sa wc_ed448ph_sign_msg
*/
int wc_ed448ph_verify_msg(const byte* sig, word32 siglen, const byte* msg,
word32 msgLen, int* res, ed448_key* key,
const byte* context, byte contextLen);
/*!
\ingroup ED448
\brief 使ED448_Keyオブジェクトを初期化します
\return 0 ED448_Keyオブジェクトの初期化に成功したら返されます
\return BAD_FUNC_ARG NULLの場合は返されます
_Example_
\code
ed448_key key;
wc_ed448_init(&key);
\endcode
\sa wc_ed448_make_key
\sa wc_ed448_free
*/
int wc_ed448_init(ed448_key* key);
/*!
\ingroup ED448
\brief 使ED448オブジェクトを解放します
_Example_
\code
ed448_key key;
// initialize key and perform secure exchanges
...
wc_ed448_free(&key);
\endcode
\sa wc_ed448_init
*/
void wc_ed448_free(ed448_key* key);
/*!
\ingroup ED448
\brief Public ED448_Keyペアをインポートします
\return 0 ED448_Keyのインポートに成功しました
\return BAD_FUNC_ARG INまたはKEYがNULLに評価されている場合INLENがED448キーのサイズより小さい場合に返されます
\param [in]
\param [in]
_Example_
\code
int ret;
byte pub[] = { initialize Ed448 public key };
ed_448 key;
wc_ed448_init_key(&key);
ret = wc_ed448_import_public(pub, sizeof(pub), &key);
if (ret != 0) {
// error importing key
}
\endcode
\sa wc_ed448_import_private_key
\sa wc_ed448_export_public
*/
int wc_ed448_import_public(const byte* in, word32 inLen, ed448_key* key);
/*!
\ingroup ED448
\brief ed448秘密鍵をバッファからのみインポートします
\return 0 ED448秘密鍵のインポートに成功しました
\return BAD_FUNC_ARG INまたはKEYがNULLに評価された場合PRIVSZがED448_KEY_SIZEよりも小さい場合に返されます
\param [in] PRIVポインタ
\param [in] Privsz長さ
_Example_
\code
int ret;
byte priv[] = { initialize with 57 byte private key };
ed448_key key;
wc_ed448_init_key(&key);
ret = wc_ed448_import_private_only(priv, sizeof(priv), &key);
if (ret != 0) {
// error importing private key
}
\endcode
\sa wc_ed448_import_public
\sa wc_ed448_import_private_key
\sa wc_ed448_export_private_only
*/
int wc_ed448_import_private_only(const byte* priv, word32 privSz,
ed448_key* key);
/*!
\ingroup ED448
\brief /ED448キーペアをインポートします
\return 0 ED448キーのインポートに成功しました
\return BAD_FUNC_ARG INまたはKEYがNULLに評価された場合PROVSZがED448_KEY_SIZEまたはPUBSZのいずれかがeD448_PUB_KEY_SIZEよりも小さい場合に返されます
\param [in] PRIVポインタ
\param [in] Privsz長さ
\param [in] Pubポインタ
\param [in] Pubszの長さ
_Example_
\code
int ret;
byte priv[] = { initialize with 57 byte private key };
byte pub[] = { initialize with the corresponding public key };
ed448_key key;
wc_ed448_init_key(&key);
ret = wc_ed448_import_private_key(priv, sizeof(priv), pub, sizeof(pub),
&key);
if (ret != 0) {
// error importing key
}
\endcode
\sa wc_ed448_import_public
\sa wc_ed448_import_private_only
\sa wc_ed448_export_private
*/
int wc_ed448_import_private_key(const byte* priv, word32 privSz,
const byte* pub, word32 pubSz, ed448_key* key);
/*!
\ingroup ED448
\brief ED448_Key構造体から秘密鍵をエクスポートしますounterenでこのバッファに書き込まれたバイトを設定します
\return 0
\return BAD_FUNC_ARG NULLに評価された場合に返されます
\return BUFFER_E outlenに必要なサイズを設定します
\param [in] ED448_Key構造体へのキーポインタ
\param [out]
_Example_
\code
int ret;
ed448_key key;
// initialize key, make key
char pub[57];
word32 pubSz = sizeof(pub);
ret = wc_ed448_export_public(&key, pub, &pubSz);
if (ret != 0) {
// error exporting public key
}
\endcode
\sa wc_ed448_import_public
\sa wc_ed448_export_private_only
*/
int wc_ed448_export_public(ed448_key* key, byte* out, word32* outLen);
/*!
\ingroup ED448
\brief ED448_Key構造体からの秘密鍵のみをエクスポートしますoutlenにこのバッファに書き込まれたバイトを設定します
\return 0
\return ECC_BAD_ARG_E NULLに評価された場合に返されます
\return BUFFER_E
\param [in] ED448_Key構造体へのキーポインタ
\param [out]
_Example_
\code
int ret;
ed448_key key;
// initialize key, make key
char priv[57]; // 57 bytes because only private key
word32 privSz = sizeof(priv);
ret = wc_ed448_export_private_only(&key, priv, &privSz);
if (ret != 0) {
// error exporting private key
}
\endcode
\sa wc_ed448_export_public
\sa wc_ed448_import_private_key
*/
int wc_ed448_export_private_only(ed448_key* key, byte* out, word32* outLen);
/*!
\ingroup ED448
\brief ED448_Key構造体からキーペアをエクスポートしますOUTに格納しounterenでこのバッファに書き込まれたバイトを設定します
\return 0
\return ECC_BAD_ARG_E NULLに評価された場合に返されます
\return BUFFER_E
\param [in] ED448_Key構造体へのキーポインタ
\param [out]
_Example_
\code
ed448_key key;
wc_ed448_init(&key);
WC_RNG rng;
wc_InitRng(&rng);
wc_ed448_make_key(&rng, 57, &key); // initialize 57 byte Ed448 key
byte out[114]; // out needs to be a sufficient buffer size
word32 outLen = sizeof(out);
int key_size = wc_ed448_export_private(&key, out, &outLen);
if (key_size == BUFFER_E) {
// Check size of out compared to outLen to see if function reset outLen
}
\endcode
\sa wc_ed448_import_private
\sa wc_ed448_export_private_only
*/
int wc_ed448_export_private(ed448_key* key, byte* out, word32* outLen);
/*!
\ingroup ED448
\brief ED448_Key構造体とは別にプライベートキーと公開鍵をエクスポートしますPrivに格納しPRIVSZでこのバッファに書き込まれたバイトを設定しますPUBに格納しPubszでこのバッファに書き込まれたバイトを設定します
\return 0
\return ECC_BAD_ARG_E NULLに評価された場合に返されます
\return BUFFER_E
\param [in] ED448_Key構造体へのキーポインタ
\param [out] PRIVポインタ
\param [in,out] PRIVSZ PIVINSZポインタサイズが表示されているサイズを持つWord32オブジェクトへのポインタ
\param [out] Pub
_Example_
\code
int ret;
ed448_key key;
// initialize key, make key
char pub[57];
word32 pubSz = sizeof(pub);
char priv[57];
word32 privSz = sizeof(priv);
ret = wc_ed448_export_key(&key, priv, &pubSz, pub, &pubSz);
if (ret != 0) {
// error exporting private and public key
}
\endcode
\sa wc_ed448_export_private
\sa wc_ed448_export_public
*/
int wc_ed448_export_key(ed448_key* key,
byte* priv, word32 *privSz,
byte* pub, word32 *pubSz);
/*!
\ingroup ED448
\brief ed448_key構造体の公開鍵をチェックします
\return 0
\return BAD_FUNC_ARGS NULLの場合に返されます
_Example_
\code
int ret;
byte priv[] = { initialize with 57 byte private key };
byte pub[] = { initialize with the corresponding public key };
ed448_key key;
wc_ed448_init_key(&key);
wc_ed448_import_private_key(priv, sizeof(priv), pub, sizeof(pub), &key);
ret = wc_ed448_check_key(&key);
if (ret != 0) {
// error checking key
}
\endcode
\sa wc_ed448_import_private_key
*/
int wc_ed448_check_key(ed448_key* key);
/*!
\ingroup ED448
\brief ED448秘密鍵のサイズ - 57
\return ED448_KEY_SIZE 57
\return BAD_FUNC_ARGS NULLの場合に返されます
_Example_
\code
int keySz;
ed448_key key;
// initialize key, make key
keySz = wc_ed448_size(&key);
if (keySz == 0) {
// error determining key size
}
\endcode
\sa wc_ed448_make_key
*/
int wc_ed448_size(ed448_key* key);
/*!
\ingroup ED448
\brief secret + public
\return ED448_PRV_KEY_SIZE 114
\return BAD_FUNC_ARG key引数がnullの場合は返します
_Example_
\code
ed448_key key;
wc_ed448_init(&key);
WC_RNG rng;
wc_InitRng(&rng);
wc_ed448_make_key(&rng, 57, &key); // initialize 57 byte Ed448 key
int key_size = wc_ed448_priv_size(&key);
\endcode
\sa wc_ed448_pub_size
*/
int wc_ed448_priv_size(ed448_key* key);
/*!
\ingroup ED448
\brief
\return ED448_PUB_KEY_SIZE 57
\return BAD_FUNC_ARG key引数がnullの場合は返します
_Example_
\code
ed448_key key;
wc_ed448_init(&key);
WC_RNG rng;
wc_InitRng(&rng);
wc_ed448_make_key(&rng, 57, &key); // initialize 57 byte Ed448 key
int key_size = wc_ed448_pub_size(&key);
\endcode
\sa wc_ed448_priv_size
*/
int wc_ed448_pub_size(ed448_key* key);
/*!
\ingroup ED448
\brief ED448シグネチャのサイズ114
\return ED448_SIG_SIZE ED448シグネチャ114
\return BAD_FUNC_ARG key引数がnullの場合は返します
_Example_
\code
int sigSz;
ed448_key key;
// initialize key, make key
sigSz = wc_ed448_sig_size(&key);
if (sigSz == 0) {
// error determining sig size
}
\endcode
\sa wc_ed448_sign_msg
*/
int wc_ed448_sig_size(ed448_key* key);