Thu Apr 28 2011 16:57:08

Asterisk developer's documentation


crypto.h File Reference

Provide cryptographic signature routines. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AST_KEY_PRIVATE   (1 << 1)
#define AST_KEY_PUBLIC   (1 << 0)

Variables

int(* ast_check_signature )(struct ast_key *key, const char *msg, const char *sig)
 Check the authenticity of a message signature using a given public key.
int(* ast_check_signature_bin )(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig)
 Check the authenticity of a message signature using a given public key.
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.
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.
struct ast_key *(* ast_key_get )(const char *key, int type)
 Retrieve a key.
int(* ast_sign )(struct ast_key *key, char *msg, char *sig)
 Sign a message signature using a given private key.
int(* ast_sign_bin )(struct ast_key *key, const char *msg, int msglen, unsigned char *sig)
 Sign a message signature using a given private key.

Detailed Description

Provide cryptographic signature routines.

Definition in file crypto.h.


Define Documentation

#define AST_KEY_PRIVATE   (1 << 1)
#define AST_KEY_PUBLIC   (1 << 0)

Variable Documentation

int(* ast_check_signature)(struct ast_key *key, const char *msg, const char *sig)

Check the authenticity of a message signature using a given public key.

Parameters:
keya public key to use to verify
msgthe message that has been signed
sigthe proposed valid signature in mime64-like encoding
Return values:
0if the signature is valid.
-1otherwise.

Referenced by authenticate_verify(), crypto_init(), and register_verify().

int(* ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig)

Check the authenticity of a message signature using a given public key.

Parameters:
keya public key to use to verify
msgthe message that has been signed
sigthe proposed valid signature in raw binary representation
Return values:
0if the signature is valid.
-1otherwise.

Referenced by __ast_check_signature(), check_key(), and crypto_init().

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.

Parameters:
keya private key to use to decrypt
srcthe message to decrypt
srclenthe length of the message to decrypt
dsta pointer to a buffer of at least srclen bytes in which the decrypted answer will be stored
Return values:
lengthof dencrypted data on success.
-1on failure.

Referenced by check_key(), and crypto_init().

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.

Parameters:
keya private key to use to encrypt
srcthe message to encrypt
srclenthe length of the message to encrypt
dsta pointer to a buffer of at least srclen * 1.5 bytes in which the encrypted answer will be stored
Return values:
lengthof encrypted data on success.
-1on failure.

Referenced by crypto_init(), and update_key().

struct ast_key*(* ast_key_get)(const char *key, int type)

Retrieve a key.

Parameters:
nameof the key we are retrieving
inttype of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE)
Return values:
thekey on success.
NULLon failure.

Definition at line 60 of file cryptostub.c.

Referenced by authenticate(), authenticate_verify(), check_key(), crypto_init(), register_verify(), and update_key().

int(* ast_sign)(struct ast_key *key, char *msg, char *sig)

Sign a message signature using a given private key.

Parameters:
keya private key to use to create the signature
msgthe message to sign
siga pointer to a buffer of at least 256 bytes in which the mime64-like encoded signature will be stored
Return values:
0on success.
-1on failure.

Referenced by authenticate(), and crypto_init().

int(* ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig)

Sign a message signature using a given private key.

Parameters:
keya private key to use to create the signature
msgthe message to sign
siga pointer to a buffer of at least 128 bytes in which the raw encoded signature will be stored
Return values:
0on success.
-1on failure.

Referenced by __ast_sign(), crypto_init(), and update_key().