2 * Copyright (C) 2002-2009 Andreas Steffen
4 * Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 typedef enum pgp_packet_tag_t pgp_packet_tag_t
;
26 typedef enum pgp_sym_alg_t pgp_sym_alg_t
;
32 * OpenPGP packet tags as defined in section 4.3 of RFC 4880
34 enum pgp_packet_tag_t
{
36 PGP_PKT_PUBKEY_ENC_SESSION_KEY
= 1,
37 PGP_PKT_SIGNATURE
= 2,
38 PGP_PKT_SYMKEY_ENC_SESSION_KEY
= 3,
39 PGP_PKT_ONE_PASS_SIGNATURE_PKT
= 4,
40 PGP_PKT_SECRET_KEY
= 5,
41 PGP_PKT_PUBLIC_KEY
= 6,
42 PGP_PKT_SECRET_SUBKEY
= 7,
43 PGP_PKT_COMPRESSED_DATA
= 8,
44 PGP_PKT_SYMKEY_ENC_DATA
= 9,
46 PGP_PKT_LITERAL_DATA
= 11,
49 PGP_PKT_PUBLIC_SUBKEY
= 14,
50 PGP_PKT_USER_ATTRIBUTE
= 17,
51 PGP_PKT_SYM_ENC_INT_PROT_DATA
= 18,
52 PGP_PKT_MOD_DETECT_CODE
= 19
56 * Enum names for pgp_packet_tag_t
58 extern enum_name_t
*pgp_packet_tag_names
;
61 * OpenPGP public key algorithms as defined in section 9.1 of RFC 4880
63 enum pgp_pubkey_alg_t
{
64 PGP_PUBKEY_ALG_RSA
= 1,
65 PGP_PUBKEY_ALG_RSA_ENC_ONLY
= 2,
66 PGP_PUBKEY_ALG_RSA_SIGN_ONLY
= 3,
67 PGP_PUBKEY_ALG_ELGAMAL_ENC_ONLY
= 16,
68 PGP_PUBKEY_ALG_DSA
= 17,
69 PGP_PUBKEY_ALG_ECC
= 18,
70 PGP_PUBKEY_ALG_ECDSA
= 19,
71 PGP_PUBKEY_ALG_ELGAMAL
= 20,
72 PGP_PUBKEY_ALG_DIFFIE_HELLMAN
= 21,
76 * Enum names for pgp_pubkey_alg_t
78 extern enum_name_t
*pgp_pubkey_alg_names
;
81 * OpenPGP symmetric key algorithms as defined in section 9.2 of RFC 4880
84 PGP_SYM_ALG_PLAIN
= 0,
87 PGP_SYM_ALG_CAST5
= 3,
88 PGP_SYM_ALG_BLOWFISH
= 4,
89 PGP_SYM_ALG_SAFER
= 5,
91 PGP_SYM_ALG_AES_128
= 7,
92 PGP_SYM_ALG_AES_192
= 8,
93 PGP_SYM_ALG_AES_256
= 9,
94 PGP_SYM_ALG_TWOFISH
= 10
98 * Enum names for pgp_sym_alg_t
100 extern enum_name_t
*pgp_sym_alg_names
;
102 #define PGP_INVALID_LENGTH 0xffffffff
105 * Returns the length of an OpenPGP (RFC 4880) packet
106 * The blob pointer is advanced past the length field
108 * @param blob pointer to an OpenPGP blob
109 * @param len size of the length field
110 * @return length of the next OpenPGP packet
112 size_t pgp_length(chunk_t
*blob
, size_t len
);
114 #endif /** PGP_H_ @}*/