fix
[libexssl.git] / include / libexssl / ssl.h
blob7862dd04e988754cf5cd1c7b712da43d0f69d1d5
1 #ifndef __SSLW_H__
2 #define __SSLW_H__
4 #include <string.h>
5 #include <stdio.h>
6 #include <errno.h>
7 #include <openssl/bn.h>
8 #include <openssl/ssl.h>
9 #include <openssl/bio.h>
10 #include <openssl/err.h>
11 #include <openssl/rsa.h>
12 #include <openssl/evp.h>
13 #include <openssl/pem.h>
14 #include <openssl/sha.h>
15 #include <openssl/rand.h>
16 #include <libex/str.h>
17 #include <libex/file.h>
19 typedef struct ssl_key ssl_key_t;
20 typedef struct ssl_key_pair ssl_key_pair_t;
22 const char *ssl_key_msg (ssl_key_t *key);
23 const char *ssl_keys_msg (ssl_key_pair_t *keys);
25 int ssl_init ();
26 void ssl_done ();
28 int ssl_gen_keys (int nbits, ssl_key_pair_t *keys);
29 int ssl_gen_keys_fp (int nbits, FILE *fp_priv, FILE *fp_pub, const char *passwd, ssl_key_pair_t *keys);
30 int ssl_gen_keys_fl (int nbits, const char *priv, const char *pub, const char *passwd, ssl_key_pair_t *keys);
31 int ssl_gen_keys_buf (int nbits, strptr_t *priv, strptr_t *pub, const char *passwd, ssl_key_pair_t *keys);
32 int ssl_load_priv_fp (FILE *fp, const char *passwd, ssl_key_t *key);
33 int ssl_load_priv_fl (const char *fname, const char *passwd, ssl_key_t *key);
34 int ssl_load_priv_buf (const char *passwd, ssl_key_t *key, strptr_t *buf);
35 int ssl_load_pub_fp (FILE *fp, ssl_key_t *key);
36 int ssl_load_pub_fl (const char *fname, ssl_key_t *key);
37 int ssl_load_pub_buf (const char *buf, size_t buf_len, ssl_key_t *key);
39 int ssl_encrypt_pub (ssl_key_t *key, const char *buf, size_t buf_len, str_t **result);
40 int ssl_decrypt_priv (ssl_key_t *key, const char *buf, size_t buf_len, str_t **result);
42 int ssl_sign (const unsigned char *msg, size_t mlen, unsigned char **sig, size_t *slen, int dig, ssl_key_t *pkey);
43 int ssl_verify (const unsigned char *msg, size_t mlen, const unsigned char *sig, size_t slen, int dig, ssl_key_t *pkey);
45 ssl_key_t *ssl_key_init ();
46 ssl_key_pair_t *ssl_key_pair_init ();
48 void ssl_free_key (ssl_key_t *key);
49 void ssl_free_keys (ssl_key_pair_t *keys);
51 #endif // __SSLW_H__