|
DynXX-C
|
#include "Types.h"Go to the source code of this file.
Enumerations | |
| enum | DynXXCryptoRSAPadding { DynXXCryptoRSAPaddingPKCS1 = 1 , DynXXCryptoRSAPaddingSSLV23 = 2 , DynXXCryptoRSAPaddingNO = 3 , DynXXCryptoRSAPaddingPKCS1_OAEP = 4 , DynXXCryptoRSAPaddingX931 = 5 , DynXXCryptoRSAPaddingPKCS1_PSS = 6 } |
| RSA padding. More... | |
Functions | |
| DYNXX_EXTERN_C_BEGIN const byte * | dynxx_crypto_rand (size_t len) |
| Generate random bytes. | |
| const byte * | dynxx_crypto_aes_encrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, DYNXX_OUT size_t *outLen) |
| AES Encrypt. | |
| const byte * | dynxx_crypto_aes_decrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, DYNXX_OUT size_t *outLen) |
| AES Decrypt. | |
| const byte * | dynxx_crypto_aes_gcm_encrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, const byte *initVectorBytes, size_t initVectorLen, const byte *aadBytes, size_t aadLen, size_t tagBits, DYNXX_OUT size_t *outLen) |
| AES GCM Encrypt. | |
| const byte * | dynxx_crypto_aes_gcm_decrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, const byte *initVectorBytes, size_t initVectorLen, const byte *aadBytes, size_t aadLen, size_t tagBits, DYNXX_OUT size_t *outLen) |
| AES GCM Decrypt. | |
| const char * | dynxx_crypto_rsa_gen_key (const char *base64, bool isPublic) |
| const byte * | dynxx_crypto_rsa_encrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, DynXXCryptoRSAPadding padding, DYNXX_OUT size_t *outLen) |
| RSA Encrypt. | |
| const byte * | dynxx_crypto_rsa_decrypt (const byte *inBytes, size_t inLen, const byte *keyBytes, size_t keyLen, DynXXCryptoRSAPadding padding, DYNXX_OUT size_t *outLen) |
| RSA Decrypt. | |
| const byte * | dynxx_crypto_hash_md5 (const byte *inBytes, size_t inLen, DYNXX_OUT size_t *outLen) |
| MD5 hash. | |
| const byte * | dynxx_crypto_hash_sha1 (const byte *inBytes, size_t inLen, DYNXX_OUT size_t *outLen) |
| SHA1. | |
| const byte * | dynxx_crypto_hash_sha256 (const byte *inBytes, size_t inLen, DYNXX_OUT size_t *outLen) |
| SHA256. | |
| const byte * | dynxx_crypto_base64_encode (const byte *inBytes, size_t inLen, bool noNewLines, DYNXX_OUT size_t *outLen) |
| Base64 encode. | |
| const byte * | dynxx_crypto_base64_decode (const byte *inBytes, size_t inLen, bool noNewLines, DYNXX_OUT size_t *outLen) |
| Base64 decode. | |
| const byte * dynxx_crypto_aes_decrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
AES Decrypt.
| inBytes | input bytes data |
| inLen | input bytes length |
| keyBytes | key bytes data |
| keyLen | key bytes length(MUST BE 16/24/32!!) |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_aes_encrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
AES Encrypt.
| inBytes | input bytes data |
| inLen | input bytes length |
| keyBytes | key bytes data |
| keyLen | key bytes length(MUST BE 16/24/32!!) |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_aes_gcm_decrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| const byte * | initVectorBytes, | ||
| size_t | initVectorLen, | ||
| const byte * | aadBytes, | ||
| size_t | aadLen, | ||
| size_t | tagBits, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
AES GCM Decrypt.
| inBytes | bytes data to be decrypt(with a tag on tail) |
| inLen | bytes length to be decrypt(include the tag) |
| keyBytes | key bytes data |
| keyLen | key bytes length(MUST BE 16/24/32!!) |
| initVectorBytes | initVector bytes data |
| initVectorLen | initVector bytes length(MUST BE 12!!) |
| aadBytes | Additional Authentication Data (AAD) bytes(Can be nullptr) |
| aadLen | Additional Authentication Data (AAD) length(Must <= 16) |
| tagBits | tag bits length(MUST BE 96/104/112/120/128!!) |
| outLen | output bytes length(Not include the tag) |
| const byte * dynxx_crypto_aes_gcm_encrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| const byte * | initVectorBytes, | ||
| size_t | initVectorLen, | ||
| const byte * | aadBytes, | ||
| size_t | aadLen, | ||
| size_t | tagBits, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
AES GCM Encrypt.
| inBytes | bytes data to be encrypt |
| inLen | bytes length to be encrypt |
| keyBytes | key bytes data |
| keyLen | key bytes length(MUST BE 16/24/32!!) |
| initVectorBytes | initVector bytes data |
| initVectorLen | initVector bytes length(MUST BE 12!!) |
| tagBits | tag bits length(MUST BE 96/104/112/120/128!!) |
| aadBytes | Additional Authentication Data (AAD) bytes(Can be nullptr) |
| aadLen | Additional Authentication Data (AAD) length(Must <= 16) |
| outLen | output bytes length(include the tag) |
| const byte * dynxx_crypto_base64_decode | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| bool | noNewLines, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
Base64 decode.
| inBytes | input bytes data |
| inLen | input bytes length |
| noNewLines | whether to add newlines |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_base64_encode | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| bool | noNewLines, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
Base64 encode.
| inBytes | input bytes data |
| inLen | input bytes length |
| noNewLines | whether to add newlines |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_hash_md5 | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
MD5 hash.
| inBytes | input bytes data |
| inLen | input bytes length |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_hash_sha1 | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
SHA1.
| inBytes | input bytes data |
| inLen | input bytes length |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_hash_sha256 | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
SHA256.
| inBytes | input bytes data |
| inLen | input bytes length |
| outLen | a pointer to read output bytes length |
| DYNXX_EXTERN_C_BEGIN const byte * dynxx_crypto_rand | ( | size_t | len | ) |
Generate random bytes.
| len | bytes length |
| const byte * dynxx_crypto_rsa_decrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| DynXXCryptoRSAPadding | padding, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
RSA Decrypt.
| inBytes | input bytes data |
| inLen | input bytes length |
| keyBytes | Private-Key bytes data |
| keyLen | Private-Key bytes length |
| padding | see DynXXCryptoRSAPadding |
| outLen | a pointer to read output bytes length |
| const byte * dynxx_crypto_rsa_encrypt | ( | const byte * | inBytes, |
| size_t | inLen, | ||
| const byte * | keyBytes, | ||
| size_t | keyLen, | ||
| DynXXCryptoRSAPadding | padding, | ||
| DYNXX_OUT size_t * | outLen | ||
| ) |
RSA Encrypt.
| inBytes | input bytes data |
| inLen | input bytes length |
| keyBytes | Public-Key bytes data |
| keyLen | Public-Key bytes length |
| padding | see DynXXCryptoRSAPadding |
| outLen | a pointer to read output bytes length |
| const char * dynxx_crypto_rsa_gen_key | ( | const char * | base64, |
| bool | isPublic | ||
| ) |