root/openpgpsdk/trunk/include/crypto.h

Revision 140 (checked in by ben, 8 years ago)

Don't die.

Line 
1 /** \file
2  */
3
4 #include "util.h"
5 #include "packet.h"
6
7 #ifndef OPS_CRYPTO_H
8 #define OPS_CRYPTO_H
9
10 #define OPS_MAX_HASH    20
11
12 typedef struct _ops_hash_t ops_hash_t;
13
14 typedef void ops_hash_init_t(ops_hash_t *hash);
15 typedef void ops_hash_add_t(ops_hash_t *hash,const unsigned char *data,
16                         unsigned length);
17 typedef unsigned ops_hash_finish_t(ops_hash_t *hash,unsigned char *out);
18
19 struct _ops_hash_t
20     {
21     ops_hash_init_t *init;
22     ops_hash_add_t *add;
23     ops_hash_finish_t *finish;
24     void *data;
25     };
26
27 void ops_crypto_init(void);
28 void ops_crypto_finish(void);
29 void ops_hash_md5(ops_hash_t *hash);
30 void ops_hash_sha1(ops_hash_t *hash);
31
32 void hash_add_int(ops_hash_t *hash,unsigned n,unsigned length);
33
34 ops_boolean_t ops_dsa_verify(const unsigned char *hash,size_t hash_length,
35                              const ops_dsa_signature_t *sig,
36                              const ops_dsa_public_key_t *dsa);
37 int ops_rsa_public_decrypt(unsigned char *out,const unsigned char *in,
38                            size_t length,const ops_rsa_public_key_t *rsa);
39 int ops_rsa_private_encrypt(unsigned char *out,const unsigned char *in,
40                             size_t length,const ops_rsa_secret_key_t *srsa,
41                             const ops_rsa_public_key_t *rsa);
42
43 #endif
44
Note: See TracBrowser for help on using the browser.