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

116 lines
6.3 KiB
C
Raw Normal View History

/*!
\ingroup HMAC
\brief HMACオブジェクトを初期化しHMACの長さを設定します
\return 0 HMACオブジェクトの初期化に成功しました
\return BAD_FUNC_ARG .MD5SHASHA256SHA384SHA3-224SHA3-256SHA3-384SHA3-512
\return MEMORY_E 使
\return HMAC_MIN_KEYLEN_E FIPS実装を使用するときに返されることがありFIPS規格よりも短いです
\param hmac HMACオブジェクトへのポインタ
\param type HMACオブジェクトを使用する暗号化方式を指定します.MD5SHASHA256SHA384SHA3-224SHA3-256SHA3-384SHA3-512
\param key HMACオブジェクトを初期化するキーを含むバッファへのポインタ
_Example_
\code
Hmac hmac;
byte key[] = { // initialize with key to use for encryption };
if (wc_HmacSetKey(&hmac, MD5, key, sizeof(key)) != 0) {
// error initializing Hmac object
}
\endcode
\sa wc_HmacUpdate
\sa wc_HmacFinal
*/
int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 keySz);
/*!
\ingroup HMAC
\brief HMACを使用して認証するメッセージを更新しますHMACオブジェクトがWC_HMACSETKEYで初期化された後に呼び出されるべきですwc_hmacupdateを呼び出した後wc_hmacfinalを呼び出す必要があります
\return 0
\return MEMORY_E 使
\param hmac HMACオブジェクトへのポインタ
\param msg
_Example_
\code
Hmac hmac;
byte msg[] = { // initialize with message to authenticate };
byte msg2[] = { // initialize with second half of message };
// initialize hmac
if( wc_HmacUpdate(&hmac, msg, sizeof(msg)) != 0) {
// error updating message
}
if( wc_HmacUpdate(&hmac, msg2, sizeof(msg)) != 0) {
// error updating with second message
}
\endcode
\sa wc_HmacSetKey
\sa wc_HmacFinal
*/
int wc_HmacUpdate(Hmac* hmac, const byte* in, word32 sz);
/*!
\ingroup HMAC
\brief HMACオブジェクトのメッセージの最終ハッシュを計算します
\return 0
\return MEMORY_E 使
\param hmac HMACオブジェクトへのポインタ
_Example_
\code
Hmac hmac;
byte hash[MD5_DIGEST_SIZE];
// initialize hmac with MD5 as type
// wc_HmacUpdate() with messages
if (wc_HmacFinal(&hmac, hash) != 0) {
// error computing hash
}
\endcode
\sa wc_HmacSetKey
\sa wc_HmacUpdate
*/
int wc_HmacFinal(Hmac* hmac, byte* out);
/*!
\ingroup HMAC
\brief 使HMACダイジェストサイズを返します
\return Success 使HMACダイジェストサイズを返します
_Example_
\code
int maxDigestSz = wolfSSL_GetHmacMaxSize();
\endcode
\sa none
*/
int wolfSSL_GetHmacMaxSize(void);
/*!
\ingroup HMAC
\brief HMACキー導出機能HKDFHMACを利用してSALTとオプションの情報を派生したキーに変換します0NULLが指定されている場合MD5になります
\return 0
\return BAD_FUNC_ARG .MD5SHASHA256SHA384SHA3-224SHA3-256SHA3-384SHA3-512
\return MEMORY_E
\return HMAC_MIN_KEYLEN_E FIPS実装を使用するときに返されることがありFIPS規格よりも短いです
\param type HKDFに使用するハッシュタイプ.MD5SHASHA256SHA384SHA3-224SHA3-256SHA3-384SHA3-512
\param inKey KDFに使用するキーを含むバッファへのポインタ
\param inKeySz
\param salt 使NULLを使用してください
\param saltSz 使0使
\param info NULLを使用してください
\param infoSz 使0使
\param out
_Example_
\code
byte key[] = { // initialize with key };
byte salt[] = { // initialize with salt };
byte derivedKey[MAX_DIGEST_SIZE];
int ret = wc_HKDF(SHA512, key, sizeof(key), salt, sizeof(salt),
NULL, 0, derivedKey, sizeof(derivedKey));
if ( ret != 0 ) {
// error generating derived key
}
\endcode
\sa wc_HmacSetKey
*/
int wc_HKDF(int type, const byte* inKey, word32 inKeySz,
const byte* salt, word32 saltSz,
const byte* info, word32 infoSz,
byte* out, word32 outSz);