|
libcmutils 0.6.5
Multi-platform C99 utility library
|
Data Structures | |
| struct | CMUTIL_BlockCrypto |
| Block cipher encryption/decryption object. More... | |
| struct | CMUTIL_RSAKey |
| RSA key object (can be either a private or public key). More... | |
| struct | CMUTIL_RSACrypto |
| RSA encryption/decryption and signature object. More... | |
Typedefs | |
| typedef CMUTIL_RSAKey | CMUTIL_PrivateKey |
| An RSA key that can decrypt and sign. | |
| typedef CMUTIL_RSAKey | CMUTIL_PublicKey |
| An RSA key that can encrypt and verify. | |
Functions | |
| CMUTIL_BlockCrypto * | CMUTIL_BlockCryptoCreate (const char *algo, const char *mode, const char *padding, int key_bits) |
| Creates a new block crypto object. | |
| CMUTIL_PrivateKey * | CMUTIL_PrivateKeyCreateFromPEM (const char *pem, const uint8_t *passphrase) |
| Creates a private key object from a PEM-formatted string. | |
| CMUTIL_PublicKey * | CMUTIL_PublicKeyCreateFromPEM (const char *pem) |
| Creates a public key object from a PEM-formatted string. | |
| CMUTIL_PrivateKey * | CMUTIL_PrivateKeyCreateFromFile (const char *file_path, const uint8_t *passphrase) |
| Creates a private key object from a PEM-formatted file. | |
| CMUTIL_PublicKey * | CMUTIL_PublicKeyCreateFromFile (const char *file_path) |
| Creates a public key object from a PEM-formatted file. | |
| CMUTIL_RSACrypto * | CMUTIL_RSACryptoCreate (void) |
| Creates a new RSA crypto object. | |
| void | CMUTIL_CryptoRandom (uint8_t *buf, size_t len) |
| Generates cryptographically strong random bytes. | |
| typedef CMUTIL_RSAKey CMUTIL_PrivateKey |
An RSA key that can decrypt and sign.
The same object as CMUTIL_RSAKey; the two names exist to say which half of a key pair a function expects.
| typedef CMUTIL_RSAKey CMUTIL_PublicKey |
An RSA key that can encrypt and verify.
The same object as CMUTIL_RSAKey; the two names exist to say which half of a key pair a function expects.
| CMUTIL_BlockCrypto * CMUTIL_BlockCryptoCreate | ( | const char * | algo, |
| const char * | mode, | ||
| const char * | padding, | ||
| int | key_bits | ||
| ) |
Creates a new block crypto object.
| algo | The encryption algorithm (e.g., "AES"). |
| mode | The encryption mode (e.g., "CBC"). |
| padding | The padding scheme (e.g., "PKCS5Padding"). |
| key_bits | The key size in bits. |
| CMUTIL_PrivateKey * CMUTIL_PrivateKeyCreateFromPEM | ( | const char * | pem, |
| const uint8_t * | passphrase | ||
| ) |
Creates a private key object from a PEM-formatted string.
| pem | The PEM-formatted private key string. |
| passphrase | The passphrase for the private key, or NULL if none. |
| CMUTIL_PublicKey * CMUTIL_PublicKeyCreateFromPEM | ( | const char * | pem | ) |
Creates a public key object from a PEM-formatted string.
| pem | The PEM-formatted public key string. |
| CMUTIL_PrivateKey * CMUTIL_PrivateKeyCreateFromFile | ( | const char * | file_path, |
| const uint8_t * | passphrase | ||
| ) |
Creates a private key object from a PEM-formatted file.
| file_path | The path to the PEM-formatted private key file. |
| passphrase | The passphrase for the private key, or NULL if none. |
| CMUTIL_PublicKey * CMUTIL_PublicKeyCreateFromFile | ( | const char * | file_path | ) |
Creates a public key object from a PEM-formatted file.
| file_path | The path to the PEM-formatted public key file. |
| CMUTIL_RSACrypto * CMUTIL_RSACryptoCreate | ( | void | ) |
Creates a new RSA crypto object.
| void CMUTIL_CryptoRandom | ( | uint8_t * | buf, |
| size_t | len | ||
| ) |
Generates cryptographically strong random bytes.
| buf | The buffer to store the random bytes. |
| len | The number of bytes to generate. |