certtool is able to set certificate policies via a template
[gnutls.git] / lib / gnutls_pk.h
blob29af4c421669989a2ef24be25a2ea72f43eecd8c
1 /*
2 * Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef GNUTLS_PK_H
24 #define GNUTLS_PK_H
26 extern int crypto_pk_prio;
27 extern gnutls_crypto_pk_st _gnutls_pk_ops;
29 #define _gnutls_pk_encrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.encrypt( algo, ciphertext, plaintext, params)
30 #define _gnutls_pk_decrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.decrypt( algo, ciphertext, plaintext, params)
31 #define _gnutls_pk_sign( algo, sig, data, params) _gnutls_pk_ops.sign( algo, sig, data, params)
32 #define _gnutls_pk_verify( algo, data, sig, params) _gnutls_pk_ops.verify( algo, data, sig, params)
33 #define _gnutls_pk_verify_params( algo, params) _gnutls_pk_ops.verify_params( algo, params)
34 #define _gnutls_pk_derive( algo, out, pub, priv) _gnutls_pk_ops.derive( algo, out, pub, priv)
35 #define _gnutls_pk_generate( algo, bits, priv) _gnutls_pk_ops.generate( algo, bits, priv)
36 #define _gnutls_pk_hash_algorithm( pk, sig, params, hash) _gnutls_pk_ops.hash_algorithm(pk, sig, params, hash)
38 inline static int
39 _gnutls_pk_fixup (gnutls_pk_algorithm_t algo, gnutls_direction_t direction,
40 gnutls_pk_params_st * params)
42 if (_gnutls_pk_ops.pk_fixup_private_params)
43 return _gnutls_pk_ops.pk_fixup_private_params (algo, direction, params);
44 return 0;
47 int _gnutls_pk_params_copy (gnutls_pk_params_st * dst, const gnutls_pk_params_st * src);
49 /* The internal PK interface */
50 int
51 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
52 int
53 _gnutls_encode_ber_rs_raw (gnutls_datum_t * sig_value,
54 const gnutls_datum_t *r,
55 const gnutls_datum_t *s);
57 int
58 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r,
59 bigint_t * s);
61 int
62 encode_ber_digest_info (gnutls_digest_algorithm_t hash,
63 const gnutls_datum_t * digest,
64 gnutls_datum_t * output);
66 int
67 decode_ber_digest_info (const gnutls_datum_t * info,
68 gnutls_digest_algorithm_t * hash,
69 uint8_t * digest, unsigned int *digest_size);
71 int _gnutls_pk_get_hash_algorithm (gnutls_pk_algorithm_t pk,
72 gnutls_pk_params_st*,
73 gnutls_digest_algorithm_t * dig,
74 unsigned int *mand);
76 #endif /* GNUTLS_PK_H */