5 Copyright (C) 2003 Niels Möller
7 This file is part of GNU Nettle.
9 GNU Nettle is free software: you can redistribute it and/or
10 modify it under the terms of either:
12 * the GNU Lesser General Public License as published by the Free
13 Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
18 * the GNU General Public License as published by the Free
19 Software Foundation; either version 2 of the License, or (at your
20 option) any later version.
22 or both in parallel, as here.
24 GNU Nettle is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 General Public License for more details.
29 You should have received copies of the GNU General Public License and
30 the GNU Lesser General Public License along with this program. If
31 not, see http://www.gnu.org/licenses/.
34 #ifndef NETTLE_PKCS1_H_INCLUDED
35 #define NETTLE_PKCS1_H_INCLUDED
37 #include "nettle-types.h"
45 #define _pkcs1_signature_prefix _nettle_pkcs1_signature_prefix
46 #define pkcs1_rsa_digest_encode nettle_pkcs1_rsa_digest_encode
47 #define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode
48 #define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest
49 #define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode
50 #define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest
51 #define pkcs1_rsa_sha256_encode nettle_pkcs1_rsa_sha256_encode
52 #define pkcs1_rsa_sha256_encode_digest nettle_pkcs1_rsa_sha256_encode_digest
53 #define pkcs1_rsa_sha512_encode nettle_pkcs1_rsa_sha512_encode
54 #define pkcs1_rsa_sha512_encode_digest nettle_pkcs1_rsa_sha512_encode_digest
55 #define pkcs1_encrypt nettle_pkcs1_encrypt
56 #define pkcs1_decrypt nettle_pkcs1_decrypt
64 _pkcs1_signature_prefix(unsigned key_size,
68 unsigned digest_size);
71 pkcs1_encrypt (size_t key_size,
73 void *random_ctx, nettle_random_func *random,
74 size_t length, const uint8_t *message,
78 pkcs1_decrypt (size_t key_size,
80 size_t *length, uint8_t *message);
83 pkcs1_rsa_digest_encode(mpz_t m, size_t key_size,
84 size_t di_length, const uint8_t *digest_info);
87 pkcs1_rsa_md5_encode(mpz_t m, size_t length, struct md5_ctx *hash);
90 pkcs1_rsa_md5_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
93 pkcs1_rsa_sha1_encode(mpz_t m, size_t length, struct sha1_ctx *hash);
96 pkcs1_rsa_sha1_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
99 pkcs1_rsa_sha256_encode(mpz_t m, size_t length, struct sha256_ctx *hash);
102 pkcs1_rsa_sha256_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
105 pkcs1_rsa_sha512_encode(mpz_t m, size_t length, struct sha512_ctx *hash);
108 pkcs1_rsa_sha512_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
114 #endif /* NETTLE_PKCS1_H_INCLUDED */