3 The RSA publickey algorithm, RSAREF compatible interface.
5 Copyright (C) 2001 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_RSA_COMPAT_H_INCLUDED
35 #define NETTLE_RSA_COMPAT_H_INCLUDED
44 #define R_SignInit nettle_R_SignInit
45 #define R_SignUpdate nettle_R_SignUpdate
46 #define R_SignFinal nettle_R_SignFinal
47 #define R_VerifyInit nettle_R_VerifyInit
48 #define R_VerifyUpdate nettle_R_VerifyUpdate
49 #define R_VerifyFinal nettle_R_VerifyFinal
51 /* 256 octets or 2048 bits */
52 #define MAX_RSA_MODULUS_LEN 256
57 uint8_t modulus[MAX_RSA_MODULUS_LEN];
58 uint8_t exponent[MAX_RSA_MODULUS_LEN];
64 uint8_t modulus[MAX_RSA_MODULUS_LEN];
65 uint8_t publicExponent[MAX_RSA_MODULUS_LEN];
66 uint8_t exponent[MAX_RSA_MODULUS_LEN];
67 uint8_t prime[2][MAX_RSA_MODULUS_LEN];
68 uint8_t primeExponent[2][MAX_RSA_MODULUS_LEN];
69 uint8_t coefficient[MAX_RSA_MODULUS_LEN];
72 /* Only MD5 is supported for now */
78 /* Digest algorithms */
79 /* DA_MD2 not implemented */
85 RE_CONTENT_ENCODING, /* encryptedContent has RFC 1421 encoding error */
86 RE_DATA, /* other party's private value out of range */
87 RE_DIGEST_ALGORITHM, /* message-digest algorithm is invalid */
88 RE_ENCODING, /* encoded block has RFC 1421 encoding error */
89 RE_ENCRYPTION_ALGORITHM, /* encryption algorithm is invalid */
90 RE_KEY, /* recovered data encryption key cannot decrypt */
91 RE_KEY_ENCODING, /* encrypted key has RFC 1421 encoding error */
92 RE_LEN, /* signatureLen out of range */
93 RE_MODULUS_LEN, /* modulus length invalid */
94 RE_NEED_RANDOM, /* random structure is not seeded */
95 RE_PRIVATE_KEY, /* private key cannot encrypt message digest, */
96 RE_PUBLIC_KEY, /* publicKey cannot decrypt signature */
97 RE_SIGNATURE, /* signature is incorrect */
98 RE_SIGNATURE_ENCODING, /* encodedSignature has RFC 1421 encoding error */
102 R_SignInit(R_SIGNATURE_CTX *ctx,
103 int digestAlgorithm);
106 R_SignUpdate(R_SIGNATURE_CTX *ctx,
108 /* Length is an unsigned char according to rsaref.txt,
109 * but that must be a typo. */
113 R_SignFinal(R_SIGNATURE_CTX *ctx,
116 R_RSA_PRIVATE_KEY *key);
119 R_VerifyInit(R_SIGNATURE_CTX *ctx,
120 int digestAlgorithm);
123 R_VerifyUpdate(R_SIGNATURE_CTX *ctx,
125 /* Length is an unsigned char according to rsaref.txt,
126 * but that must be a typo. */
130 R_VerifyFinal(R_SIGNATURE_CTX *ctx,
133 R_RSA_PUBLIC_KEY *key);
139 #endif /* NETTLE_RSA_COMPAT_H_INCLUDED */