Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_crypto.h File Reference

APR-UTIL Crypto library. More...

#include "apu.h"
#include "apr_pools.h"
#include "apr_tables.h"
#include "apr_hash.h"
#include "apu_errno.h"
#include "apr_thread_proc.h"
Include dependency graph for apr_crypto.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  apr_crypto_block_key_digest_t
 
struct  apr_crypto_block_key_type_t
 
struct  apr_crypto_block_key_mode_t
 
struct  apr_crypto_passphrase_t
 
struct  apr_crypto_secret_t
 
struct  apr_crypto_key_hash_t
 
struct  apr_crypto_key_hmac_t
 
struct  apr_crypto_key_cmac_t
 
struct  apr_crypto_digest_hash_t
 
struct  apr_crypto_digest_sign_t
 
struct  apr_crypto_digest_verify_t
 
struct  apr_crypto_key_rec_t
 
struct  apr_crypto_digest_rec_t
 

Typedefs

typedef struct
apr_crypto_block_key_digest_t 
apr_crypto_block_key_digest_t
 
typedef struct apr_crypto_driver_t apr_crypto_driver_t
 
typedef struct apr_crypto_t apr_crypto_t
 
typedef struct apr_crypto_config_t apr_crypto_config_t
 
typedef struct apr_crypto_key_t apr_crypto_key_t
 
typedef struct apr_crypto_block_t apr_crypto_block_t
 
typedef struct apr_crypto_digest_t apr_crypto_digest_t
 
typedef struct
apr_crypto_block_key_type_t 
apr_crypto_block_key_type_t
 
typedef struct
apr_crypto_block_key_mode_t 
apr_crypto_block_key_mode_t
 
typedef struct
apr_crypto_passphrase_t 
apr_crypto_passphrase_t
 
typedef struct apr_crypto_secret_t apr_crypto_secret_t
 
typedef struct
apr_crypto_key_hash_t 
apr_crypto_key_hash_t
 
typedef struct
apr_crypto_key_hmac_t 
apr_crypto_key_hmac_t
 
typedef struct
apr_crypto_key_cmac_t 
apr_crypto_key_cmac_t
 
typedef struct
apr_crypto_digest_hash_t 
apr_crypto_digest_hash_t
 
typedef struct
apr_crypto_digest_sign_t 
apr_crypto_digest_sign_t
 
typedef struct
apr_crypto_digest_verify_t 
apr_crypto_digest_verify_t
 
typedef struct apr_crypto_key_rec_t apr_crypto_key_rec_t
 
typedef struct
apr_crypto_digest_rec_t 
apr_crypto_digest_rec_t
 

Enumerations

enum  apr_crypto_block_key_type_e {
  APR_KEY_NONE, APR_KEY_3DES_192, APR_KEY_AES_128, APR_KEY_AES_192,
  APR_KEY_AES_256
}
 
enum  apr_crypto_block_key_mode_e { APR_MODE_NONE, APR_MODE_ECB, APR_MODE_CBC }
 
enum  apr_crypto_block_key_digest_e {
  APR_CRYPTO_DIGEST_NONE, APR_CRYPTO_DIGEST_MD5, APR_CRYPTO_DIGEST_SHA1, APR_CRYPTO_DIGEST_SHA224,
  APR_CRYPTO_DIGEST_SHA256, APR_CRYPTO_DIGEST_SHA384, APR_CRYPTO_DIGEST_SHA512
}
 
enum  apr_crypto_key_type {
  APR_CRYPTO_KTYPE_PASSPHRASE = 1, APR_CRYPTO_KTYPE_SECRET = 2, APR_CRYPTO_KTYPE_HASH = 3, APR_CRYPTO_KTYPE_HMAC = 4,
  APR_CRYPTO_KTYPE_CMAC = 5
}
 
enum  apr_crypto_digest_type_e { APR_CRYPTO_DTYPE_HASH = 1, APR_CRYPTO_DTYPE_SIGN = 2, APR_CRYPTO_DTYPE_VERIFY = 3 }
 

Functions

apr_status_t apr_crypto_init (apr_pool_t *pool)
 Perform once-only initialisation. Call once only. More...
 
apr_status_t apr_crypto_lib_version (const char *name, const char **version)
 
apr_status_t apr_crypto_lib_init (const char *name, const char *params, const apu_err_t **result, apr_pool_t *pool)
 
apr_status_t apr_crypto_lib_term (const char *name)
 
int apr_crypto_lib_is_active (const char *name)
 
apr_status_t apr_crypto_clear (apr_pool_t *pool, void *buffer, apr_size_t size)
 Zero out the buffer provided when the pool is cleaned up. More...
 
apr_status_t apr_crypto_memzero (void *buffer, apr_size_t size)
 Always zero out the buffer provided, without being optimized out by the compiler. More...
 
int apr_crypto_equals (const void *buf1, const void *buf2, apr_size_t size)
 Timing attacks safe buffers comparison, where the executing time does not depend on the bytes compared but solely on the number of bytes. More...
 
apr_status_t apr_crypto_get_driver (const apr_crypto_driver_t **driver, const char *name, const char *params, const apu_err_t **result, apr_pool_t *pool)
 Get the driver struct for a name. More...
 
const char * apr_crypto_driver_name (const apr_crypto_driver_t *driver)
 Return the name of the driver. More...
 
apr_status_t apr_crypto_error (const apu_err_t **result, const apr_crypto_t *f)
 Get the result of the last operation on a context. If the result is NULL, the operation was successful. More...
 
apr_status_t apr_crypto_make (apr_crypto_t **f, const apr_crypto_driver_t *driver, const char *params, apr_pool_t *pool)
 Create a context for supporting encryption. Keys, certificates, algorithms and other parameters will be set per context. More than one context can be created at one time. A cleanup will be automatically registered with the given pool to guarantee a graceful shutdown. More...
 
apr_status_t apr_crypto_get_block_key_digests (apr_hash_t **digests, const apr_crypto_t *f)
 Get a hash table of key digests, keyed by the name of the digest against a pointer to apr_crypto_block_key_digest_t, which in turn begins with an integer. More...
 
apr_status_t apr_crypto_get_block_key_types (apr_hash_t **types, const apr_crypto_t *f)
 Get a hash table of key types, keyed by the name of the type against a pointer to apr_crypto_block_key_type_t, which in turn begins with an integer. More...
 
apr_status_t apr_crypto_get_block_key_modes (apr_hash_t **modes, const apr_crypto_t *f)
 Get a hash table of key modes, keyed by the name of the mode against a pointer to apr_crypto_block_key_mode_t, which in turn begins with an integer. More...
 
apr_crypto_key_rec_tapr_crypto_key_rec_make (apr_crypto_key_type ktype, apr_pool_t *p)
 Create a key record to be passed to apr_crypto_key(). More...
 
apr_crypto_digest_rec_tapr_crypto_digest_rec_make (apr_crypto_digest_type_e dtype, apr_pool_t *p)
 Create a digest record to be passed to apr_crypto_digest_init(). More...
 
apr_status_t apr_crypto_key (apr_crypto_key_t **key, const apr_crypto_key_rec_t *rec, const apr_crypto_t *f, apr_pool_t *p)
 Create a key from the provided secret or passphrase. The key is cleaned up when the context is cleaned, and may be reused with multiple encryption, decryption, signing or verifying operations. The choice of key type much match the intended operation. More...
 
apr_status_t apr_crypto_passphrase (apr_crypto_key_t **key, apr_size_t *ivSize, const char *pass, apr_size_t passLen, const unsigned char *salt, apr_size_t saltLen, const apr_crypto_block_key_type_e type, const apr_crypto_block_key_mode_e mode, const int doPad, const int iterations, const apr_crypto_t *f, apr_pool_t *p)
 Create a key from the given passphrase. By default, the PBKDF2 algorithm is used to generate the key from the passphrase. It is expected that the same pass phrase will generate the same key, regardless of the backend crypto platform used. The key is cleaned up when the context is cleaned, and may be reused with multiple encryption or decryption operations. More...
 
apr_status_t apr_crypto_block_encrypt_init (apr_crypto_block_t **ctx, const unsigned char **iv, const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p)
 Initialise a context for encrypting arbitrary data using the given key. More...
 
apr_status_t apr_crypto_block_encrypt (unsigned char **out, apr_size_t *outlen, const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx)
 Encrypt data provided by in, write it to out. More...
 
apr_status_t apr_crypto_block_encrypt_finish (unsigned char *out, apr_size_t *outlen, apr_crypto_block_t *ctx)
 Encrypt final data block, write it to out. More...
 
apr_status_t apr_crypto_block_decrypt_init (apr_crypto_block_t **ctx, apr_size_t *blockSize, const unsigned char *iv, const apr_crypto_key_t *key, apr_pool_t *p)
 Initialise a context for decrypting arbitrary data using the given key. More...
 
apr_status_t apr_crypto_block_decrypt (unsigned char **out, apr_size_t *outlen, const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx)
 Decrypt data provided by in, write it to out. More...
 
apr_status_t apr_crypto_block_decrypt_finish (unsigned char *out, apr_size_t *outlen, apr_crypto_block_t *ctx)
 Decrypt final data block, write it to out. More...
 
apr_status_t apr_crypto_block_cleanup (apr_crypto_block_t *ctx)
 Clean encryption / decryption context. More...
 
apr_status_t apr_crypto_digest_init (apr_crypto_digest_t **d, const apr_crypto_key_t *key, apr_crypto_digest_rec_t *rec, apr_pool_t *p)
 Initialise a context for hashing, signing or verifying arbitrary data. More...
 
apr_status_t apr_crypto_digest_update (apr_crypto_digest_t *digest, const unsigned char *in, apr_size_t inlen)
 Update the digest with data provided by in. More...
 
apr_status_t apr_crypto_digest_final (apr_crypto_digest_t *digest)
 Finalise the digest and write the result. More...
 
apr_status_t apr_crypto_digest (const apr_crypto_key_t *key, apr_crypto_digest_rec_t *rec, const unsigned char *in, apr_size_t inlen, apr_pool_t *p)
 One shot digest on a single memory buffer. More...
 
apr_status_t apr_crypto_digest_cleanup (apr_crypto_digest_t *ctx)
 Clean digest context. More...
 
apr_status_t apr_crypto_cleanup (apr_crypto_t *f)
 Clean encryption / decryption context. More...
 
apr_status_t apr_crypto_shutdown (const apr_crypto_driver_t *driver)
 Shutdown the crypto library. More...
 

Detailed Description

APR-UTIL Crypto library.