5 Copyright (C) 2001, 2002 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_PGP_H_INCLUDED
35 #define NETTLE_PGP_H_INCLUDED
39 #include "nettle-types.h"
47 #define pgp_put_uint32 nettle_pgp_put_uint32
48 #define pgp_put_uint16 nettle_pgp_put_uint16
49 #define pgp_put_mpi nettle_pgp_put_mpi
50 #define pgp_put_string nettle_pgp_put_string
51 #define pgp_put_length nettle_pgp_put_length
52 #define pgp_put_header nettle_pgp_put_header
53 #define pgp_put_header_length nettle_pgp_put_header_length
54 #define pgp_sub_packet_start nettle_pgp_sub_packet_start
55 #define pgp_put_sub_packet nettle_pgp_put_sub_packet
56 #define pgp_sub_packet_end nettle_pgp_sub_packet_end
57 #define pgp_put_public_rsa_key nettle_pgp_put_public_rsa_key
58 #define pgp_put_rsa_sha1_signature nettle_pgp_put_rsa_sha1_signature
59 #define pgp_put_userid nettle_pgp_put_userid
60 #define pgp_crc24 nettle_pgp_crc24
61 #define pgp_armor nettle_pgp_armor
64 struct rsa_public_key;
65 struct rsa_private_key;
69 pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i);
72 pgp_put_uint16(struct nettle_buffer *buffer, unsigned i);
75 pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x);
78 pgp_put_string(struct nettle_buffer *buffer,
83 pgp_put_length(struct nettle_buffer *buffer,
87 pgp_put_header(struct nettle_buffer *buffer,
88 unsigned tag, unsigned length);
91 pgp_put_header_length(struct nettle_buffer *buffer,
92 /* start of the header */
97 pgp_sub_packet_start(struct nettle_buffer *buffer);
100 pgp_put_sub_packet(struct nettle_buffer *buffer,
103 const uint8_t *data);
106 pgp_sub_packet_end(struct nettle_buffer *buffer, unsigned start);
109 pgp_put_public_rsa_key(struct nettle_buffer *,
110 const struct rsa_public_key *key,
114 pgp_put_rsa_sha1_signature(struct nettle_buffer *buffer,
115 const struct rsa_private_key *key,
116 const uint8_t *keyid,
118 struct sha1_ctx *hash);
121 pgp_put_userid(struct nettle_buffer *buffer,
123 const uint8_t *name);
126 pgp_crc24(unsigned length, const uint8_t *data);
129 pgp_armor(struct nettle_buffer *buffer,
132 const uint8_t *data);
134 /* Values that can be passed to pgp_put_header when the size of the
135 * length field, but not the length itself, is known. Also the minimum length
136 * for the given field size. */
139 PGP_LENGTH_ONE_OCTET = 0,
140 PGP_LENGTH_TWO_OCTETS = 192,
141 PGP_LENGTH_FOUR_OCTETS = 8384,
144 enum pgp_public_key_algorithm
149 PGP_EL_GAMAL_ENCRYPT = 16,
154 enum pgp_symmetric_algorithm
167 enum pgp_compression_algorithm
169 PGP_UNCOMPRESSED = 0,
174 enum pgp_hash_algorithm
186 PGP_TAG_PUBLIC_SESSION_KEY = 1,
187 PGP_TAG_SIGNATURE = 2,
188 PGP_TAG_SYMMETRIC_SESSION_KEY = 3,
189 PGP_TAG_ONE_PASS_SIGNATURE = 4,
190 PGP_TAG_SECRET_KEY = 5,
191 PGP_TAG_PUBLIC_KEY = 6,
192 PGP_TAG_SECRET_SUBKEY = 7,
193 PGP_TAG_COMPRESSED = 8,
194 PGP_TAG_ENCRYPTED = 9,
196 PGP_TAG_LITERAL = 11,
199 PGP_TAG_PUBLIC_SUBKEY = 14,
202 enum pgp_signature_type
206 PGP_SIGN_STANDALONE = 2,
207 PGP_SIGN_CERTIFICATION = 0x10,
208 PGP_SIGN_CERTIFICATION_PERSONA = 0x11,
209 PGP_SIGN_CERTIFICATION_CASUAL = 0x12,
210 PGP_SIGN_CERTIFICATION_POSITIVE = 0x13,
211 PGP_SIGN_SUBKEY = 0x18,
213 PGP_SIGN_REVOCATION = 0x20,
214 PGP_SIGN_REVOCATION_SUBKEY = 0x28,
215 PGP_SIGN_REVOCATION_CERTIFICATE = 0x30,
216 PGP_SIGN_TIMESTAMP = 0x40,
219 enum pgp_subpacket_tag
221 PGP_SUBPACKET_CREATION_TIME = 2,
222 PGP_SUBPACKET_SIGNATURE_EXPIRATION_TIME = 3,
223 PGP_SUBPACKET_EXPORTABLE_CERTIFICATION = 4,
224 PGP_SUBPACKET_TRUST_SIGNATURE = 5,
225 PGP_SUBPACKET_REGULAR_EXPRESSION = 6,
226 PGP_SUBPACKET_REVOCABLE = 7,
227 PGP_SUBPACKET_KEY_EXPIRATION_TIME = 9,
228 PGP_SUBPACKET_PLACEHOLDER = 10 ,
229 PGP_SUBPACKET_PREFERRED_SYMMETRIC_ALGORITHMS = 11,
230 PGP_SUBPACKET_REVOCATION_KEY = 12,
231 PGP_SUBPACKET_ISSUER_KEY_ID = 16,
232 PGP_SUBPACKET_NOTATION_DATA = 20,
233 PGP_SUBPACKET_PREFERRED_HASH_ALGORITHMS = 21,
234 PGP_SUBPACKET_PREFERRED_COMPRESSION_ALGORITHMS = 22,
235 PGP_SUBPACKET_KEY_SERVER_PREFERENCES = 23,
236 PGP_SUBPACKET_PREFERRED_KEY_SERVER = 24,
237 PGP_SUBPACKET_PRIMARY_USER_ID = 25,
238 PGP_SUBPACKET_POLICY_URL = 26,
239 PGP_SUBPACKET_KEY_FLAGS = 27,
240 PGP_SUBPACKET_SIGNERS_USER_ID = 28,
241 PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
248 #endif /* NETTLE_PGP_H_INCLUDED */