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

195 lines
8.9 KiB
C
Raw Normal View History

/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief Base64エンコードされた入力inを復号しoutに格納しますoutLenに出力バッファに書き込まれたサイズを設定します
\return 0 Base64エンコードされた入力の復号に成功した場合に返されます
\return BAD_FUNC_ARG
\return ASN_INPUT_E Base64の範囲([A-Za-z0-9+/=])Base64エンコードされた入力に無効な行末がある場合に返されます
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte encoded[] = { // 復号するテキストを初期化 };
byte decoded[sizeof(encoded)];
2025-10-26 00:51:40 +09:00
// 少なくとも(sizeof(encoded) * 3 + 3) / 4のスペースが必要
int outLen = sizeof(decoded);
if( Base64_Decode(encoded,sizeof(encoded), decoded, &outLen) != 0 ) {
2025-10-26 00:51:40 +09:00
// 入力バッファの復号エラー
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_Encode
\sa Base16_Decode
*/
int Base64_Decode(const byte* in, word32 inLen, byte* out,
word32* outLen);
/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief inをエンコードしBase64エンコードされた結果を出力バッファoutに格納します%0A行末の代わりに'\n'outLenを出力バッファに書き込まれたバイト数に設定します
\return 0 Base64エンコードされた入力の復号に成功した場合に返されます
\return BAD_FUNC_ARG
\return BUFFER_E
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte plain[] = { // エンコードするテキストを初期化 };
byte encoded[MAX_BUFFER_SIZE];
int outLen = sizeof(encoded);
if( Base64_Encode(plain, sizeof(plain), encoded, &outLen) != 0 ) {
2025-10-26 00:51:40 +09:00
// 入力バッファのエンコードエラー
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_EncodeEsc
\sa Base64_Decode
*/
int Base64_Encode(const byte* in, word32 inLen, byte* out,
word32* outLen);
/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief inをエンコードしBase64エンコードされた結果を出力バッファoutに格納します'\n'%0Aエスケープされた行末でデータを書き込みますoutLenを出力バッファに書き込まれたバイト数に設定します
\return 0 Base64エンコードされた入力の復号に成功した場合に返されます
\return BAD_FUNC_ARG
\return BUFFER_E
\return ASN_INPUT_E
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte plain[] = { // エンコードするテキストを初期化 };
byte encoded[MAX_BUFFER_SIZE];
int outLen = sizeof(encoded);
if( Base64_EncodeEsc(plain, sizeof(plain), encoded, &outLen) != 0 ) {
2025-10-26 00:51:40 +09:00
// 入力バッファのエンコードエラー
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_Encode
\sa Base64_Decode
*/
int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out,
word32* outLen);
/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief inをエンコードしBase64エンコードされた結果を出力バッファoutに格納しますoutLenを出力バッファに書き込まれたバイト数に設定します
\return 0 Base64エンコードされた入力の復号に成功した場合に返されます
\return BAD_FUNC_ARG
\return BUFFER_E
\return ASN_INPUT_E
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte plain[] = { // エンコードするテキストを初期化 };
byte encoded[MAX_BUFFER_SIZE];
int outLen = sizeof(encoded);
if( Base64_Encode_NoNl(plain, sizeof(plain), encoded, &outLen) != 0 ) {
2025-10-26 00:51:40 +09:00
// 入力バッファのエンコードエラー
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_Encode
\sa Base64_Decode
*/
int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out,
word32* outLen);
/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief Base16エンコードされた入力inを復号しoutに格納しますoutLenに出力バッファに書き込まれたサイズを設定します
\return 0 Base16エンコードされた入力の復号に成功した場合に返されます
\return BAD_FUNC_ARG 2
\return ASN_INPUT_E Base16の範囲([0-9A-F])
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte encoded[] = { // 復号するテキストを初期化 };
byte decoded[sizeof(encoded)];
int outLen = sizeof(decoded);
if( Base16_Decode(encoded,sizeof(encoded), decoded, &outLen) != 0 ) {
2025-10-26 00:51:40 +09:00
// 入力バッファの復号エラー
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_Encode
\sa Base64_Decode
\sa Base16_Encode
*/
int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
/*!
\ingroup Base_Encoding
2025-10-26 00:51:40 +09:00
\brief base16出力にエンコードします
\return 0
\return BAD_FUNC_ARG inoutoutLenがnullの場合outLenがinLenの2倍プラス1未満の場合に返されます
\param in
\param inLen
\param out
\param outLen
_Example_
\code
2025-10-26 00:51:40 +09:00
byte in[] = { // エンコードする何かの内容 };
byte out[NECESSARY_OUTPUT_SIZE];
word32 outSz = sizeof(out);
if(Base16_Encode(in, sizeof(in), out, &outSz) != 0)
{
2025-10-26 00:51:40 +09:00
// エンコードエラーを処理
}
\endcode
2025-10-26 00:51:40 +09:00
\sa Base64_Encode
\sa Base64_Decode
\sa Base16_Decode
*/
2025-12-03 13:39:09 +09:00
int Base16_Encode(const byte* in, word32 inLen, byte* out, word32* outLen);