Use libtasn1 v2.4.
[gnutls.git] / lib / gnutls_pk.h
blob0a0f7c0fb18a8b13c1646ba5a202906ebed8eb4c
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2010 Free
3 * Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GNUTLS.
9 * The GNUTLS library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA
26 #ifndef GNUTLS_PK_H
27 # define GNUTLS_PK_H
29 extern int crypto_pk_prio;
30 extern gnutls_crypto_pk_st _gnutls_pk_ops;
32 #define _gnutls_pk_encrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.encrypt( algo, ciphertext, plaintext, params)
33 #define _gnutls_pk_decrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.decrypt( algo, ciphertext, plaintext, params)
34 #define _gnutls_pk_sign( algo, sig, data, params) _gnutls_pk_ops.sign( algo, sig, data, params)
35 #define _gnutls_pk_verify( algo, data, sig, params) _gnutls_pk_ops.verify( algo, data, sig, params)
37 inline static int
38 _gnutls_pk_fixup( gnutls_pk_algorithm_t algo, gnutls_direction_t direction, gnutls_pk_params_st* params)
40 if (_gnutls_pk_ops.pk_fixup_private_params) return _gnutls_pk_ops.pk_fixup_private_params(algo, direction, params);
41 return 0;
44 int _gnutls_pk_params_copy( gnutls_pk_params_st* dst, bigint_t* params, int params_len);
46 int _gnutls_rsa_generate_params (bigint_t * resarr, unsigned int *resarr_len, int bits);
47 int _gnutls_dsa_generate_params (bigint_t * resarr, unsigned int *resarr_len, int bits);
49 /* The internal PK interface */
50 int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
51 const gnutls_datum_t * plaintext,
52 bigint_t * params, unsigned params_len,
53 unsigned btype);
54 int _gnutls_dsa_sign (gnutls_datum_t * signature,
55 const gnutls_datum_t * plaintext, bigint_t * params,
56 unsigned params_len);
57 int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext,
58 const gnutls_datum_t * ciphertext,
59 bigint_t * params, unsigned params_len,
60 unsigned btype);
61 int _gnutls_rsa_verify (const gnutls_datum_t * vdata,
62 const gnutls_datum_t * ciphertext, bigint_t * params,
63 int params_len, int btype);
64 int _gnutls_dsa_verify (const gnutls_datum_t * vdata,
65 const gnutls_datum_t * sig_value, bigint_t * params,
66 int params_len);
68 int
69 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
71 int
72 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r, bigint_t * s);
74 #endif /* GNUTLS_PK_H */