Provide cryptographic signature routines. More...
#include "asterisk/optional_api.h"
#include "asterisk/logger.h"
#include "openssl/aes.h"
Go to the source code of this file.
Defines | |
#define | AST_KEY_PRIVATE (1 << 1) |
#define | AST_KEY_PUBLIC (1 << 0) |
Typedefs | |
typedef AES_KEY | ast_aes_decrypt_key |
typedef AES_KEY | ast_aes_encrypt_key |
Functions | |
AST_OPTIONAL_API (int, ast_crypto_loaded,(void),{return 0;}) | |
AST_OPTIONAL_API (void, ast_aes_decrypt,(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx),{ast_log(LOG_WARNING,"AES encryption disabled. Install OpenSSL.\n");return;}) | |
AES decrypt data. | |
AST_OPTIONAL_API (void, ast_aes_encrypt,(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx),{ast_log(LOG_WARNING,"AES encryption disabled. Install OpenSSL.\n");return;}) | |
AES encrypt data. | |
AST_OPTIONAL_API (int, ast_aes_set_decrypt_key,(const unsigned char *key, ast_aes_decrypt_key *ctx),{ast_log(LOG_WARNING,"AES encryption disabled. Install OpenSSL.\n");return-1;}) | |
Set a decryption key. | |
AST_OPTIONAL_API (int, ast_aes_set_encrypt_key,(const unsigned char *key, ast_aes_encrypt_key *ctx),{ast_log(LOG_WARNING,"AES encryption disabled. Install OpenSSL.\n");return-1;}) | |
Set an encryption key. | |
AST_OPTIONAL_API (int, ast_decrypt_bin,(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key),{return-1;}) | |
Decrypt a message using a given private key. | |
AST_OPTIONAL_API (int, ast_encrypt_bin,(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key),{return-1;}) | |
Encrypt a message using a given private key. | |
AST_OPTIONAL_API (int, ast_sign_bin,(struct ast_key *key, const char *msg, int msglen, unsigned char *sig),{return-1;}) | |
Sign a message signature using a given private key. | |
AST_OPTIONAL_API (int, ast_sign,(struct ast_key *key, char *msg, char *sig),{return-1;}) | |
Sign a message signature using a given private key. | |
AST_OPTIONAL_API (int, ast_check_signature_bin,(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig),{return-1;}) | |
Check the authenticity of a message signature using a given public key. | |
AST_OPTIONAL_API (int, ast_check_signature,(struct ast_key *key, const char *msg, const char *sig),{return-1;}) | |
Check the authenticity of a message signature using a given public key. | |
AST_OPTIONAL_API (struct ast_key *, ast_key_get,(const char *key, int type),{return NULL;}) | |
Retrieve a key. |
Provide cryptographic signature routines.
Definition in file crypto.h.
#define AST_KEY_PRIVATE (1 << 1) |
Definition at line 43 of file crypto.h.
Referenced by ast_decrypt_bin(), ast_sign_bin(), authenticate(), check_key(), pw_cb(), try_load_key(), and update_key().
#define AST_KEY_PUBLIC (1 << 0) |
Definition at line 42 of file crypto.h.
Referenced by ast_check_signature_bin(), ast_encrypt_bin(), authenticate_verify(), check_key(), handle_cli_keys_show(), register_verify(), try_load_key(), and update_key().
typedef AES_KEY ast_aes_decrypt_key |
typedef AES_KEY ast_aes_encrypt_key |
AST_OPTIONAL_API | ( | int | , | |
ast_crypto_loaded | , | |||
(void) | ||||
) |
AST_OPTIONAL_API | ( | void | , | |
ast_aes_decrypt | , | |||
(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx) | ||||
) |
AES decrypt data.
in | encrypted data | |
out | pointer to a buffer to hold the decrypted output | |
ctx | address of an aes encryption context filled in with ast_aes_set_decrypt_key |
AST_OPTIONAL_API | ( | void | , | |
ast_aes_encrypt | , | |||
(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx) | ||||
) |
AES encrypt data.
in | data to be encrypted | |
out | pointer to a buffer to hold the encrypted output | |
ctx | address of an aes encryption context filled in with ast_aes_set_encrypt_key |
AST_OPTIONAL_API | ( | int | , | |
ast_aes_set_decrypt_key | , | |||
(const unsigned char *key, ast_aes_decrypt_key *ctx) | ||||
) |
Set a decryption key.
key | a 16 char key | |
ctx | address of an aes encryption context |
0 | success | |
nonzero | failure |
AST_OPTIONAL_API | ( | int | , | |
ast_aes_set_encrypt_key | , | |||
(const unsigned char *key, ast_aes_encrypt_key *ctx) | ||||
) |
Set an encryption key.
key | a 16 char key | |
ctx | address of an aes encryption context |
0 | success | |
nonzero | failure |
AST_OPTIONAL_API | ( | int | , | |
ast_decrypt_bin | , | |||
(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) | ||||
) |
Decrypt a message using a given private key.
key | a private key to use to decrypt | |
src | the message to decrypt | |
srclen | the length of the message to decrypt | |
dst | a pointer to a buffer of at least srclen bytes in which the decrypted answer will be stored |
length | of dencrypted data on success. | |
-1 | on failure. |
AST_OPTIONAL_API | ( | int | , | |
ast_encrypt_bin | , | |||
(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) | ||||
) |
Encrypt a message using a given private key.
key | a private key to use to encrypt | |
src | the message to encrypt | |
srclen | the length of the message to encrypt | |
dst | a pointer to a buffer of at least srclen * 1.5 bytes in which the encrypted answer will be stored |
length | of encrypted data on success. | |
-1 | on failure. |
AST_OPTIONAL_API | ( | int | , | |
ast_sign_bin | , | |||
(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) | ||||
) |
AST_OPTIONAL_API | ( | int | , | |
ast_sign | , | |||
(struct ast_key *key, char *msg, char *sig) | ||||
) |
AST_OPTIONAL_API | ( | int | , | |
ast_check_signature_bin | , | |||
(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) | ||||
) |
AST_OPTIONAL_API | ( | int | , | |
ast_check_signature | , | |||
(struct ast_key *key, const char *msg, const char *sig) | ||||
) |
AST_OPTIONAL_API | ( | struct ast_key * | , | |
ast_key_get | , | |||
(const char *key, int type) | ||||
) |
Retrieve a key.
name | of the key we are retrieving | |
int | type of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE) |
the | key on success. | |
NULL | on failure. |