aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/crypto.h
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-18 03:59:51 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-18 03:59:51 +0000
commit4fcbfbedea878e22848d235acda3e08a67e5b047 (patch)
tree2312ff86b75e85d7a846b8661d5e20ebacc5c0aa /include/asterisk/crypto.h
parent904af1c1a97d99e4351ccbed0457da52f0dc7041 (diff)
Add extra checks for keys and convenience encrypt/decrypt functions
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3803 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/crypto.h')
-rwxr-xr-xinclude/asterisk/crypto.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asterisk/crypto.h b/include/asterisk/crypto.h
index 227957a9b..dff70e6b0 100755
--- a/include/asterisk/crypto.h
+++ b/include/asterisk/crypto.h
@@ -85,6 +85,29 @@ extern int ast_sign(struct ast_key *key, char *msg, char *sig);
*/
extern int ast_sign_bin(struct ast_key *key, char *msg, int msglen, unsigned char *sig);
+/*!
+ * \param key a private key to use to encrypt
+ * \param src the message to encrypt
+ * \param srclen the length of the message to encrypt
+ * \param dst a pointer to a buffer of at least srclen * 1.5 bytes in which the encrypted
+ * answer will be stored
+ *
+ * Returns length of encrypted data on success or -1 on failure.
+ *
+ */
+extern int ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+
+/*!
+ * \param key a private key to use to decrypt
+ * \param src the message to decrypt
+ * \param srclen the length of the message to decrypt
+ * \param dst a pointer to a buffer of at least srclen bytes in which the decrypted
+ * answer will be stored
+ *
+ * Returns length of decrypted data on success or -1 on failure.
+ *
+ */
+extern int ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif