Document of c-modernization-kit (porter) 1.0.0
Loading...
Searching...
No Matches
crypto.h
Go to the documentation of this file.
1
34
35#ifndef CRYPTO_H
36#define CRYPTO_H
37
38#include <stddef.h>
39#include <stdint.h>
40
41#include <porter_const.h>
42
43#ifdef __cplusplus
44extern "C"
45{
46#endif /* __cplusplus */
47
65extern int potr_encrypt(uint8_t *dst,
66 size_t *dst_len,
67 const uint8_t *src,
68 size_t src_len,
69 const uint8_t *key,
70 const uint8_t *nonce,
71 const uint8_t *aad,
72 size_t aad_len);
73
90extern int potr_decrypt(uint8_t *dst,
91 size_t *dst_len,
92 const uint8_t *src,
93 size_t src_len,
94 const uint8_t *key,
95 const uint8_t *nonce,
96 const uint8_t *aad,
97 size_t aad_len);
98
112extern int potr_passphrase_to_key(uint8_t *key,
113 const uint8_t *passphrase,
114 size_t passphrase_len);
115
116#ifdef __cplusplus
117}
118#endif /* __cplusplus */
119
120#endif /* CRYPTO_H */
int potr_passphrase_to_key(uint8_t *key, const uint8_t *passphrase, size_t passphrase_len)
任意のパスフレーズを SHA-256 ハッシュにより AES-256 鍵に変換します。
int potr_encrypt(uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len, const uint8_t *key, const uint8_t *nonce, const uint8_t *aad, size_t aad_len)
AES-256-GCM でデータを暗号化します。
int potr_decrypt(uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len, const uint8_t *key, const uint8_t *nonce, const uint8_t *aad, size_t aad_len)
AES-256-GCM でデータを復号し、認証タグを検証します。
通信ライブラリの定数ファイル。