ESAPI-C 1.0
The OWASP Enterprise Security API for C
|
Cryptographic module header. More...
Go to the source code of this file.
Defines | |
#define | GCRYPT_NO_DEPRECATED 1 |
Do not include defintions for deprecated features. | |
#define | GCRYPT_NO_MPI_MACROS 1 |
Do not define the shorthand macros. | |
Functions | |
char * | esapi_encrypt (struct esapi_ctx *, const char *) |
Encrypts the provided plaintext characters using the cipher transformation specified by the property Encryptor.CipherTransformation and the master encryption key as specified by the property Encryptor.MasterKey as defined in the ESAPI.properties file. | |
char * | esapi_decrypt (struct esapi_ctx *, const char *) |
Decrypts the provided cyphertext string using the master encryption key as specified by the property Encryptor.MasterKey as defined in the ESAPI.properties file. | |
char * | esapi_hash (struct esapi_ctx *, const char *) |
Returns a string representation of the hash of the provided plaintext and salt. | |
gcry_sexp_t * | esapi_sign (struct esapi_ctx *, void *, int) |
Returns a signature of the given message. | |
void | esapi_fill_random_token (struct esapi_ctx *, char *, int) |
Generate a random secret key using a cryptographic algorithm and entropy source appropriate for the generation of short term unique keys. | |
void | esapi_fill_crypto_key (struct esapi_ctx *, char *, int) |
Generate a random secret key using a cryptographic algorithm and entropy source appropriate for the generation of long term cryptographic keys. | |
void | esapi_crypto_init (struct esapi_ctx *) |
Initializes the cryptographic engine. | |
int | esapi_verify_signature (struct esapi_ctx *, void *, int, gcry_sexp_t *) |
Incomplete function implementation. | |
gcry_sexp_t | convert_to_asymmetric_key (void *, int) |
Cryptographic module header.
This module provides some convenience methods for encryption, decryption, etc.
All the cryptographic operations use the default cryptographic properties as defined in ESAPI.properties; e.g., default cipher transformation, default key size, default IV type (where applicable), etc.
Definition in file crypto.h.
void esapi_crypto_init | ( | struct esapi_ctx * | ) |
Initializes the cryptographic engine.
This function must be called before calling any of the other functions in this module.
ctx | A properly initialized ESAPI context structure returned by |
char* esapi_decrypt | ( | struct esapi_ctx * | , |
const char * | |||
) |
Decrypts the provided cyphertext string using the master encryption key as specified by the property Encryptor.MasterKey as defined in the ESAPI.properties file.
ciphertext | A Base64 encoded cyphertext character array to be decrypted. |
Definition at line 117 of file crypto.c.
Referenced by get_property().
char* esapi_encrypt | ( | struct esapi_ctx * | , |
const char * | |||
) |
Encrypts the provided plaintext characters using the cipher transformation specified by the property Encryptor.CipherTransformation
and the master encryption key as specified by the property Encryptor.MasterKey as defined in the ESAPI.properties file.
plaintext | A character array containing the plaintext to be encrypted. |
Definition at line 33 of file crypto.c.
Referenced by set_property().
void esapi_fill_crypto_key | ( | struct esapi_ctx * | , |
char * | , | ||
int | |||
) |
Generate a random secret key using a cryptographic algorithm and entropy source appropriate for the generation of long term cryptographic keys.
ctx | A properly initialized ESAPI context structure returned by |
buff | A character array to hold the resulting key |
len | The requested length of the key |
void esapi_fill_random_token | ( | struct esapi_ctx * | , |
char * | , | ||
int | |||
) |
Generate a random secret key using a cryptographic algorithm and entropy source appropriate for the generation of short term unique keys.
ctx | A properly initialized ESAPI context structure returned by |
buff | A character array to hold the resulting key |
len | The requested length of the key |
Definition at line 296 of file crypto.c.
Referenced by esapi_get_unique_reference().
char* esapi_hash | ( | struct esapi_ctx * | , |
const char * | |||
) |
Returns a string representation of the hash of the provided plaintext and salt.
The salt helps to protect against a rainbow table attack by mixing in some extra data with the plaintext. Some good choices for a salt might be an account name or some other string that is known to the application but not to an attacker. See this article for more information about hashing as it pertains to password schemes.
ctx | A valid esapi_ctx from which properly initialized cryptographic engine settings may be retrieved. |
plaintext | the plaintext String to encrypt |
salt | the salt to add to the plaintext String before hashing |
gcry_sexp_t* esapi_sign | ( | struct esapi_ctx * | , |
void * | , | ||
int | |||
) |
Returns a signature of the given message.
ctx | A valid esapi_ctx from which properly initialized cryptographic engine settings may be retrieved. |
msg | A character array containing the message |
len | The length of the message |