rpmpgp.h
Go to the documentation of this file.
#ifndef H_RPMPGP
#define H_RPMPGP
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <rpm/rpmtypes.h>
#include <rpm/rpmstring.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct DIGEST_CTX_s * DIGEST_CTX;
typedef struct rpmDigestBundle_s * rpmDigestBundle;
typedef struct pgpDig_s * pgpDig;
typedef struct pgpDigParams_s * pgpDigParams;
typedef uint8_t pgpKeyID_t[8];
typedef uint8_t pgpTime_t[4];
typedef enum pgpTag_e {
PGPTAG_RESERVED = 0,
PGPTAG_PUBLIC_SESSION_KEY = 1,
PGPTAG_SIGNATURE = 2,
PGPTAG_SYMMETRIC_SESSION_KEY= 3,
PGPTAG_ONEPASS_SIGNATURE = 4,
PGPTAG_SECRET_KEY = 5,
PGPTAG_PUBLIC_KEY = 6,
PGPTAG_SECRET_SUBKEY = 7,
PGPTAG_COMPRESSED_DATA = 8,
PGPTAG_SYMMETRIC_DATA = 9,
PGPTAG_MARKER = 10,
PGPTAG_LITERAL_DATA = 11,
PGPTAG_TRUST = 12,
PGPTAG_USER_ID = 13,
PGPTAG_PUBLIC_SUBKEY = 14,
PGPTAG_COMMENT_OLD = 16,
PGPTAG_PHOTOID = 17,
PGPTAG_ENCRYPTED_MDC = 18,
PGPTAG_MDC = 19,
PGPTAG_PRIVATE_60 = 60,
PGPTAG_COMMENT = 61,
PGPTAG_PRIVATE_62 = 62,
PGPTAG_CONTROL = 63
} pgpTag;
typedef struct pgpPktPubkey_s {
uint8_t version;
pgpKeyID_t keyid;
uint8_t algo;
} pgpPktPubkey;
typedef enum pgpSigType_e {
PGPSIGTYPE_BINARY = 0x00,
PGPSIGTYPE_TEXT = 0x01,
PGPSIGTYPE_STANDALONE = 0x02,
PGPSIGTYPE_GENERIC_CERT = 0x10,
PGPSIGTYPE_PERSONA_CERT = 0x11,
PGPSIGTYPE_CASUAL_CERT = 0x12,
PGPSIGTYPE_POSITIVE_CERT = 0x13,
PGPSIGTYPE_SUBKEY_BINDING = 0x18,
PGPSIGTYPE_SIGNED_KEY = 0x1F,
PGPSIGTYPE_KEY_REVOKE = 0x20,
PGPSIGTYPE_SUBKEY_REVOKE = 0x28,
PGPSIGTYPE_CERT_REVOKE = 0x30,
PGPSIGTYPE_TIMESTAMP = 0x40
} pgpSigType;
typedef enum pgpPubkeyAlgo_e {
PGPPUBKEYALGO_RSA = 1,
PGPPUBKEYALGO_RSA_ENCRYPT = 2,
PGPPUBKEYALGO_RSA_SIGN = 3,
PGPPUBKEYALGO_ELGAMAL_ENCRYPT = 16,
PGPPUBKEYALGO_DSA = 17,
PGPPUBKEYALGO_EC = 18,
PGPPUBKEYALGO_ECDSA = 19,
PGPPUBKEYALGO_ELGAMAL = 20,
PGPPUBKEYALGO_DH = 21
} pgpPubkeyAlgo;
typedef enum pgpSymkeyAlgo_e {
PGPSYMKEYALGO_PLAINTEXT = 0,
PGPSYMKEYALGO_IDEA = 1,
PGPSYMKEYALGO_TRIPLE_DES = 2,
PGPSYMKEYALGO_CAST5 = 3,
PGPSYMKEYALGO_BLOWFISH = 4,
PGPSYMKEYALGO_SAFER = 5,
PGPSYMKEYALGO_DES_SK = 6,
PGPSYMKEYALGO_AES_128 = 7,
PGPSYMKEYALGO_AES_192 = 8,
PGPSYMKEYALGO_AES_256 = 9,
PGPSYMKEYALGO_TWOFISH = 10,
PGPSYMKEYALGO_NOENCRYPT = 110
} pgpSymkeyAlgo;
typedef enum pgpCompressAlgo_e {
PGPCOMPRESSALGO_NONE = 0,
PGPCOMPRESSALGO_ZIP = 1,
PGPCOMPRESSALGO_ZLIB = 2,
PGPCOMPRESSALGO_BZIP2 = 3
} pgpCompressAlgo;
typedef enum pgpHashAlgo_e {
PGPHASHALGO_MD5 = 1,
PGPHASHALGO_SHA1 = 2,
PGPHASHALGO_RIPEMD160 = 3,
PGPHASHALGO_MD2 = 5,
PGPHASHALGO_TIGER192 = 6,
PGPHASHALGO_HAVAL_5_160 = 7,
PGPHASHALGO_SHA256 = 8,
PGPHASHALGO_SHA384 = 9,
PGPHASHALGO_SHA512 = 10,
PGPHASHALGO_SHA224 = 11,
} pgpHashAlgo;
typedef struct pgpPktSigV3_s {
uint8_t version;
uint8_t hashlen;
uint8_t sigtype;
pgpTime_t time;
pgpKeyID_t signid;
uint8_t pubkey_algo;
uint8_t hash_algo;
uint8_t signhash16[2];
} * pgpPktSigV3;
typedef struct pgpPktSigV4_s {
uint8_t version;
uint8_t sigtype;
uint8_t pubkey_algo;
uint8_t hash_algo;
uint8_t hashlen[2];
} * pgpPktSigV4;
typedef enum pgpSubType_e {
PGPSUBTYPE_NONE = 0,
PGPSUBTYPE_SIG_CREATE_TIME = 2,
PGPSUBTYPE_SIG_EXPIRE_TIME = 3,
PGPSUBTYPE_EXPORTABLE_CERT = 4,
PGPSUBTYPE_TRUST_SIG = 5,
PGPSUBTYPE_REGEX = 6,
PGPSUBTYPE_REVOCABLE = 7,
PGPSUBTYPE_KEY_EXPIRE_TIME = 9,
PGPSUBTYPE_ARR = 10,
PGPSUBTYPE_PREFER_SYMKEY = 11,
PGPSUBTYPE_REVOKE_KEY = 12,
PGPSUBTYPE_ISSUER_KEYID = 16,
PGPSUBTYPE_NOTATION = 20,
PGPSUBTYPE_PREFER_HASH = 21,
PGPSUBTYPE_PREFER_COMPRESS = 22,
PGPSUBTYPE_KEYSERVER_PREFERS= 23,
PGPSUBTYPE_PREFER_KEYSERVER = 24,
PGPSUBTYPE_PRIMARY_USERID = 25,
PGPSUBTYPE_POLICY_URL = 26,
PGPSUBTYPE_KEY_FLAGS = 27,
PGPSUBTYPE_SIGNER_USERID = 28,
PGPSUBTYPE_REVOKE_REASON = 29,
PGPSUBTYPE_FEATURES = 30,
PGPSUBTYPE_EMBEDDED_SIG = 32,
PGPSUBTYPE_INTERNAL_100 = 100,
PGPSUBTYPE_INTERNAL_101 = 101,
PGPSUBTYPE_INTERNAL_102 = 102,
PGPSUBTYPE_INTERNAL_103 = 103,
PGPSUBTYPE_INTERNAL_104 = 104,
PGPSUBTYPE_INTERNAL_105 = 105,
PGPSUBTYPE_INTERNAL_106 = 106,
PGPSUBTYPE_INTERNAL_107 = 107,
PGPSUBTYPE_INTERNAL_108 = 108,
PGPSUBTYPE_INTERNAL_109 = 109,
PGPSUBTYPE_INTERNAL_110 = 110,
PGPSUBTYPE_CRITICAL = 128
} pgpSubType;
typedef union pgpPktSig_u {
struct pgpPktSigV3_s v3;
struct pgpPktSigV4_s v4;
} * pgpPktSig;
typedef struct pgpPktSymkey_s {
uint8_t version;
uint8_t symkey_algo;
uint8_t s2k[1];
} pgpPktSymkey;
typedef struct pgpPktOnepass_s {
uint8_t version;
uint8_t sigtype;
uint8_t hash_algo;
uint8_t pubkey_algo;
pgpKeyID_t signid;
uint8_t nested;
} * pgpPktOnepass;
typedef struct pgpPktKeyV3_s {
uint8_t version;
pgpTime_t time;
uint8_t valid[2];
uint8_t pubkey_algo;
} * pgpPktKeyV3;
typedef struct pgpPktKeyV4_s {
uint8_t version;
pgpTime_t time;
uint8_t pubkey_algo;
} * pgpPktKeyV4;
typedef union pgpPktKey_u {
struct pgpPktKeyV3_s v3;
struct pgpPktKeyV4_s v4;
} pgpPktKey;
/* \ingroup rpmpgp
* 5.6. Compressed Data Packet (Tag 8)
*
* The Compressed Data packet contains compressed data. Typically, this
* packet is found as the contents of an encrypted packet, or following
* a Signature or One-Pass Signature packet, and contains literal data
* packets.
*
* The body of this packet consists of:
* - One octet that gives the algorithm used to compress the packet.
* - The remainder of the packet is compressed data.
*
* A Compressed Data Packet's body contains an block that compresses
* some set of packets. See section "Packet Composition" for details on
* how messages are formed.
*
* ZIP-compressed packets are compressed with raw RFC 1951 DEFLATE
* blocks. Note that PGP V2.6 uses 13 bits of compression. If an
* implementation uses more bits of compression, PGP V2.6 cannot
* decompress it.
*
* ZLIB-compressed packets are compressed with RFC 1950 ZLIB-style
* blocks.
*/
typedef struct pgpPktCdata_s {
uint8_t compressalgo;
uint8_t data[1];
} pgpPktCdata;
/* \ingroup rpmpgp
* 5.7. Symmetrically Encrypted Data Packet (Tag 9)
*
* The Symmetrically Encrypted Data packet contains data encrypted with
* a symmetric-key algorithm. When it has been decrypted, it will
* typically contain other packets (often literal data packets or
* compressed data packets).
*
* The body of this packet consists of:
* - Encrypted data, the output of the selected symmetric-key cipher
* operating in PGP's variant of Cipher Feedback (CFB) mode.
*
* The symmetric cipher used may be specified in an Public-Key or
* Symmetric-Key Encrypted Session Key packet that precedes the
* Symmetrically Encrypted Data Packet. In that case, the cipher
* algorithm octet is prefixed to the session key before it is
* encrypted. If no packets of these types precede the encrypted data,
* the IDEA algorithm is used with the session key calculated as the MD5
* hash of the passphrase.
*
* The data is encrypted in CFB mode, with a CFB shift size equal to the
* cipher's block size. The Initial Vector (IV) is specified as all
* zeros. Instead of using an IV, OpenPGP prefixes a 10-octet string to
* the data before it is encrypted. The first eight octets are random,
* and the 9th and 10th octets are copies of the 7th and 8th octets,
* respectively. After encrypting the first 10 octets, the CFB state is
* resynchronized if the cipher block size is 8 octets or less. The
* last 8 octets of ciphertext are passed through the cipher and the
* block boundary is reset.
*
* The repetition of 16 bits in the 80 bits of random data prefixed to
* the message allows the receiver to immediately check whether the
* session key is incorrect.
*/
typedef struct pgpPktEdata_s {
uint8_t data[1];
} pgpPktEdata;
/* \ingroup rpmpgp
* 5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)
*
* An experimental version of PGP used this packet as the Literal
* packet, but no released version of PGP generated Literal packets with
* this tag. With PGP 5.x, this packet has been re-assigned and is
* reserved for use as the Marker packet.
*
* The body of this packet consists of:
* - The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8).
*
* Such a packet MUST be ignored when received. It may be placed at the
* beginning of a message that uses features not available in PGP 2.6.x
* in order to cause that version to report that newer software is
* necessary to process the message.
*/
/* \ingroup rpmpgp
* 5.9. Literal Data Packet (Tag 11)
*
* A Literal Data packet contains the body of a message; data that is
* not to be further interpreted.
*
* The body of this packet consists of:
* - A one-octet field that describes how the data is formatted.
*
* If it is a 'b' (0x62), then the literal packet contains binary data.
* If it is a 't' (0x74), then it contains text data, and thus may need
* line ends converted to local form, or other text-mode changes. RFC
* 1991 also defined a value of 'l' as a 'local' mode for machine-local
* conversions. This use is now deprecated.
* - File name as a string (one-octet length, followed by file name),
* if the encrypted data should be saved as a file.
*
* If the special name "_CONSOLE" is used, the message is considered to
* be "for your eyes only". This advises that the message data is
* unusually sensitive, and the receiving program should process it more
* carefully, perhaps avoiding storing the received data to disk, for
* example.
* - A four-octet number that indicates the modification date of the
* file, or the creation time of the packet, or a zero that
* indicates the present time.
* - The remainder of the packet is literal data.
*
* Text data is stored with <CR><LF> text endings (i.e. network-normal
* line endings). These should be converted to native line endings by
* the receiving software.
*/
typedef struct pgpPktLdata_s {
uint8_t format;
uint8_t filenamelen;
uint8_t filename[1];
} pgpPktLdata;
/* \ingroup rpmpgp
* 5.10. Trust Packet (Tag 12)
*
* The Trust packet is used only within keyrings and is not normally
* exported. Trust packets contain data that record the user's
* specifications of which key holders are trustworthy introducers,
* along with other information that implementing software uses for
* trust information.
*
* Trust packets SHOULD NOT be emitted to output streams that are
* transferred to other users, and they SHOULD be ignored on any input
* other than local keyring files.
*/
typedef struct pgpPktTrust_s {
uint8_t flag;
} pgpPktTrust;
/* \ingroup rpmpgp
* 5.11. User ID Packet (Tag 13)
*
* A User ID packet consists of data that is intended to represent the
* name and email address of the key holder. By convention, it includes
* an RFC 822 mail name, but there are no restrictions on its content.
* The packet length in the header specifies the length of the user id.
* If it is text, it is encoded in UTF-8.
*
*/
typedef struct pgpPktUid_s {
uint8_t userid[1];
} pgpPktUid;
union pgpPktPre_u {
pgpPktPubkey pubkey;
pgpPktSig sig;
pgpPktSymkey symkey;
pgpPktOnepass onepass;
pgpPktKey key;
pgpPktCdata cdata;
pgpPktEdata edata;
pgpPktLdata ldata;
pgpPktTrust tdata;
pgpPktUid uid;
};
typedef enum pgpArmor_e {
PGPARMOR_ERR_CRC_CHECK = -7,
PGPARMOR_ERR_BODY_DECODE = -6,
PGPARMOR_ERR_CRC_DECODE = -5,
PGPARMOR_ERR_NO_END_PGP = -4,
PGPARMOR_ERR_UNKNOWN_PREAMBLE_TAG = -3,
PGPARMOR_ERR_UNKNOWN_ARMOR_TYPE = -2,
PGPARMOR_ERR_NO_BEGIN_PGP = -1,
#define PGPARMOR_ERROR PGPARMOR_ERR_NO_BEGIN_PGP
PGPARMOR_NONE = 0,
PGPARMOR_MESSAGE = 1,
PGPARMOR_PUBKEY = 2,
PGPARMOR_SIGNATURE = 3,
PGPARMOR_SIGNED_MESSAGE = 4,
PGPARMOR_FILE = 5,
PGPARMOR_PRIVKEY = 6,
PGPARMOR_SECKEY = 7
} pgpArmor;
typedef enum pgpArmorKey_e {
PGPARMORKEY_VERSION = 1,
PGPARMORKEY_COMMENT = 2,
PGPARMORKEY_MESSAGEID = 3,
PGPARMORKEY_HASH = 4,
PGPARMORKEY_CHARSET = 5
} pgpArmorKey;
typedef enum pgpValType_e {
PGPVAL_TAG = 1,
PGPVAL_ARMORBLOCK = 2,
PGPVAL_ARMORKEY = 3,
PGPVAL_SIGTYPE = 4,
PGPVAL_SUBTYPE = 5,
PGPVAL_PUBKEYALGO = 6,
PGPVAL_SYMKEYALGO = 7,
PGPVAL_COMPRESSALGO = 8,
PGPVAL_HASHALGO = 9,
PGPVAL_SERVERPREFS = 10,
} pgpValType;
enum rpmDigestFlags_e {
RPMDIGEST_NONE = 0
};
typedef rpmFlags rpmDigestFlags;
const char * pgpValString(pgpValType type, uint8_t val);
static inline
unsigned int pgpGrab(const uint8_t *s, size_t nbytes)
{
size_t i = 0;
size_t nb = (nbytes <= sizeof(i) ? nbytes : sizeof(i));
while (nb--)
i = (i << 8) | *s++;
return i;
}
char * pgpHexStr(const uint8_t *p, size_t plen);
int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen,
uint8_t **fp, size_t *fplen);
int pgpPubkeyKeyID(const uint8_t * pkt, size_t pktlen, pgpKeyID_t keyid);
int pgpPrtParams(const uint8_t *pkts, size_t pktlen, unsigned int pkttype,
pgpDigParams * ret);
int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen,
pgpDigParams mainkey, pgpDigParams **subkeys,
int *subkeysCount);
int pgpPrtPkts(const uint8_t *pkts, size_t pktlen, pgpDig dig, int printing);
pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen);
pgpArmor pgpParsePkts(const char *armor, uint8_t ** pkt, size_t * pktlen);
int pgpPubKeyCertLen(const uint8_t *pkts, size_t pktslen, size_t *certlen);
char * pgpArmorWrap(int atype, const unsigned char * s, size_t ns);
pgpDig pgpNewDig(void);
void pgpCleanDig(pgpDig dig);
pgpDig pgpFreeDig(pgpDig dig);
pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype);
int pgpDigParamsCmp(pgpDigParams p1, pgpDigParams p2);
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype);
pgpDigParams pgpDigParamsFree(pgpDigParams digp);
rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx);
rpmRC pgpVerifySig(pgpDig dig, DIGEST_CTX hashctx);
char *pgpIdentItem(pgpDigParams digp);
int rpmInitCrypto(void);
int rpmFreeCrypto(void);
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx);
size_t rpmDigestLength(int hashalgo);
DIGEST_CTX rpmDigestInit(int hashalgo, rpmDigestFlags flags);
int rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len);
int rpmDigestFinal(DIGEST_CTX ctx,
void ** datap,
size_t * lenp, int asAscii);
rpmDigestBundle rpmDigestBundleNew(void);
rpmDigestBundle rpmDigestBundleFree(rpmDigestBundle bundle);
int rpmDigestBundleAdd(rpmDigestBundle bundle, int algo,
rpmDigestFlags flags);
int rpmDigestBundleAddID(rpmDigestBundle bundle, int algo, int id,
rpmDigestFlags flags);
int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len);
int rpmDigestBundleFinal(rpmDigestBundle bundle, int id,
void ** datap, size_t * lenp, int asAscii);
DIGEST_CTX rpmDigestBundleDupCtx(rpmDigestBundle bundle, int id);
#ifdef __cplusplus
}
#endif
#endif /* H_RPMPGP */
pgpPktUid_s::userid
uint8_t userid[1]
Definition: rpmpgp.h:869
pgpPktSig_u::v3
struct pgpPktSigV3_s v3
Definition: rpmpgp.h:460
PGPHASHALGO_HAVAL_5_160
Definition: rpmpgp.h:264
PGPSYMKEYALGO_AES_128
Definition: rpmpgp.h:206
pgpPktKeyV3_s
5.5.1.
Definition: rpmpgp.h:608
pgpPktSigV4_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:328
PGPSIGTYPE_GENERIC_CERT
Definition: rpmpgp.h:123
pgpPktEdata_s
Definition: rpmpgp.h:784
pgpParsePkts
pgpArmor pgpParsePkts(const char *armor, uint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from memory.
pgpPubkeyAlgo
enum pgpPubkeyAlgo_e pgpPubkeyAlgo
9.1.
PGPARMOR_ERR_BODY_DECODE
Definition: rpmpgp.h:892
pgpNewDig
pgpDig pgpNewDig(void)
Create a container for parsed OpenPGP packet(s).
PGPSUBTYPE_EMBEDDED_SIG
Definition: rpmpgp.h:422
pgpPktOnepass_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:530
pgpPktSigV4
struct pgpPktSigV4_s * pgpPktSigV4
5.2.3.
PGPSUBTYPE_INTERNAL_108
Definition: rpmpgp.h:432
PGPHASHALGO_TIGER192
Definition: rpmpgp.h:263
PGPTAG_RESERVED
Definition: rpmpgp.h:47
pgpPktOnepass_s
5.4.
Definition: rpmpgp.h:527
PGPARMOR_ERR_NO_END_PGP
Definition: rpmpgp.h:894
PGPSUBTYPE_FEATURES
Definition: rpmpgp.h:421
pgpPktPubkey
struct pgpPktPubkey_s pgpPktPubkey
5.1.
pgpPktPre_u::cdata
pgpPktCdata cdata
Definition: rpmpgp.h:880
pgpPktKeyV4_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:649
pgpPktCdata_s
Definition: rpmpgp.h:745
pgpPktKeyV3
struct pgpPktKeyV3_s * pgpPktKeyV3
5.5.1.
pgpValType_e
pgpValType_e
Definition: rpmpgp.h:919
pgpSymkeyAlgo
enum pgpSymkeyAlgo_e pgpSymkeyAlgo
9.2.
pgpPktUid_s
Definition: rpmpgp.h:868
PGPSUBTYPE_REVOCABLE
Definition: rpmpgp.h:405
PGPCOMPRESSALGO_BZIP2
Definition: rpmpgp.h:232
PGPVAL_TAG
Definition: rpmpgp.h:920
PGPTAG_MDC
Definition: rpmpgp.h:65
PGPSUBTYPE_ISSUER_KEYID
Definition: rpmpgp.h:410
PGPTAG_SECRET_KEY
Definition: rpmpgp.h:52
pgpPktPre_u::onepass
pgpPktOnepass onepass
Definition: rpmpgp.h:878
PGPARMOR_SIGNED_MESSAGE
Definition: rpmpgp.h:903
PGPVAL_SUBTYPE
Definition: rpmpgp.h:924
PGPARMOR_ERR_UNKNOWN_PREAMBLE_TAG
Definition: rpmpgp.h:895
pgpPktKeyV4_s::time
pgpTime_t time
Definition: rpmpgp.h:648
pgpDigParamsCmp
int pgpDigParamsCmp(pgpDigParams p1, pgpDigParams p2)
Compare OpenPGP packet parameters param p1 1st parameter container param p2 2nd parameter container r...
pgpTag_e
pgpTag_e
4.3.
Definition: rpmpgp.h:46
PGPTAG_PRIVATE_60
Definition: rpmpgp.h:66
pgpReadPkts
pgpArmor pgpReadPkts(const char *fn, uint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
PGPARMOR_ERR_UNKNOWN_ARMOR_TYPE
Definition: rpmpgp.h:896
pgpPktSigV3_s::version
uint8_t version
Definition: rpmpgp.h:293
pgpPktKeyV3_s::version
uint8_t version
Definition: rpmpgp.h:609
PGPSUBTYPE_NONE
Definition: rpmpgp.h:399
PGPSYMKEYALGO_NOENCRYPT
Definition: rpmpgp.h:210
rpmDigestBundleFree
rpmDigestBundle rpmDigestBundleFree(rpmDigestBundle bundle)
Free a digest bundle and all contained digest contexts.
PGPSUBTYPE_INTERNAL_107
Definition: rpmpgp.h:431
PGPSIGTYPE_PERSONA_CERT
Definition: rpmpgp.h:125
PGPVAL_ARMORBLOCK
Definition: rpmpgp.h:921
pgpPktSigV3_s::signhash16
uint8_t signhash16[2]
Definition: rpmpgp.h:300
PGPTAG_ONEPASS_SIGNATURE
Definition: rpmpgp.h:51
pgpPubkeyAlgo_e
pgpPubkeyAlgo_e
9.1.
Definition: rpmpgp.h:162
pgpPktOnepass_s::version
uint8_t version
Definition: rpmpgp.h:528
PGPSUBTYPE_SIG_CREATE_TIME
Definition: rpmpgp.h:400
pgpPktKeyV4
struct pgpPktKeyV4_s * pgpPktKeyV4
The version 4 format is similar to the version 3 format except for the absence of a validity period...
rpmDigestFinal
int rpmDigestFinal(DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii)
Return digest and destroy context.
DIGEST_CTX
struct DIGEST_CTX_s * DIGEST_CTX
Definition: rpmpgp.h:25
pgpPktSigV4_s
5.2.3.
Definition: rpmpgp.h:324
PGPARMORKEY_CHARSET
Definition: rpmpgp.h:916
pgpCompressAlgo
enum pgpCompressAlgo_e pgpCompressAlgo
9.3.
PGPHASHALGO_RIPEMD160
Definition: rpmpgp.h:261
rpmDigestBundleDupCtx
DIGEST_CTX rpmDigestBundleDupCtx(rpmDigestBundle bundle, int id)
Duplicate a digest context from a bundle.
rpmDigestInit
DIGEST_CTX rpmDigestInit(int hashalgo, rpmDigestFlags flags)
Initialize digest.
PGPTAG_PUBLIC_KEY
Definition: rpmpgp.h:53
PGPTAG_SYMMETRIC_DATA
Definition: rpmpgp.h:56
RPMDIGEST_NONE
Definition: rpmpgp.h:936
PGPPUBKEYALGO_DSA
Definition: rpmpgp.h:167
PGPTAG_PHOTOID
Definition: rpmpgp.h:63
pgpPktPubkey_s::version
uint8_t version
Definition: rpmpgp.h:107
pgpPktPre_u::sig
pgpPktSig sig
Definition: rpmpgp.h:876
pgpArmorKey
enum pgpArmorKey_e pgpArmorKey
PGPTAG_MARKER
Definition: rpmpgp.h:57
pgpPktSigV4_s::version
uint8_t version
Definition: rpmpgp.h:325
pgpPktKeyV3_s::valid
uint8_t valid[2]
Definition: rpmpgp.h:611
pgpArmorKey_e
pgpArmorKey_e
Definition: rpmpgp.h:911
pgpPktOnepass_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:531
PGPSUBTYPE_INTERNAL_106
Definition: rpmpgp.h:430
PGPSIGTYPE_TIMESTAMP
Definition: rpmpgp.h:136
PGPPUBKEYALGO_EC
Definition: rpmpgp.h:168
pgpFreeDig
pgpDig pgpFreeDig(pgpDig dig)
Destroy a container for parsed OpenPGP packet(s).
pgpPktTrust_s::flag
uint8_t flag
Definition: rpmpgp.h:855
pgpDig
struct pgpDig_s * pgpDig
Definition: rpmpgp.h:30
pgpVerifySignature
rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
Verify a PGP signature.
PGPSUBTYPE_REVOKE_KEY
Definition: rpmpgp.h:409
PGPTAG_PRIVATE_62
Definition: rpmpgp.h:68
pgpPktSigV3_s
5.2.2.
Definition: rpmpgp.h:292
PGPSIGTYPE_BINARY
Definition: rpmpgp.h:120
pgpPubkeyKeyID
int pgpPubkeyKeyID(const uint8_t *pkt, size_t pktlen, pgpKeyID_t keyid)
Calculate OpenPGP public key Key ID.
pgpPktKey_u
5.5.3.
Definition: rpmpgp.h:716
pgpPktTrust
struct pgpPktTrust_s pgpPktTrust
pgpPktPre_u
Definition: rpmpgp.h:874
pgpPktEdata
struct pgpPktEdata_s pgpPktEdata
PGPSUBTYPE_KEY_EXPIRE_TIME
Definition: rpmpgp.h:406
PGPTAG_PUBLIC_SUBKEY
Definition: rpmpgp.h:61
PGPSIGTYPE_POSITIVE_CERT
Definition: rpmpgp.h:129
PGPHASHALGO_SHA512
Definition: rpmpgp.h:267
pgpKeyID_t
uint8_t pgpKeyID_t[8]
Definition: rpmpgp.h:36
pgpPktSymkey_s::s2k
uint8_t s2k[1]
Definition: rpmpgp.h:495
rpmDigestBundleFinal
int rpmDigestBundleFinal(rpmDigestBundle bundle, int id, void **datap, size_t *lenp, int asAscii)
Return digest from a bundle and destroy context, see rpmDigestFinal().
PGPSIGTYPE_KEY_REVOKE
Definition: rpmpgp.h:133
pgpGrab
static unsigned int pgpGrab(const uint8_t *s, size_t nbytes)
Return (native-endian) integer from big-endian representation.
Definition: rpmpgp.h:956
PGPPUBKEYALGO_RSA_ENCRYPT
Definition: rpmpgp.h:164
PGPVAL_COMPRESSALGO
Definition: rpmpgp.h:927
rpmDigestBundle
struct rpmDigestBundle_s * rpmDigestBundle
Definition: rpmpgp.h:26
pgpPktSigV4_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:327
pgpPktCdata_s::data
uint8_t data[1]
Definition: rpmpgp.h:747
rpmDigestFlags
rpmFlags rpmDigestFlags
Definition: rpmpgp.h:939
PGPVAL_SYMKEYALGO
Definition: rpmpgp.h:926
PGPARMOR_ERR_CRC_CHECK
Definition: rpmpgp.h:891
PGPSUBTYPE_INTERNAL_101
Definition: rpmpgp.h:425
PGPHASHALGO_MD2
Definition: rpmpgp.h:262
PGPSIGTYPE_CASUAL_CERT
Definition: rpmpgp.h:127
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
pgpArmor_e
pgpArmor_e
Definition: rpmpgp.h:890
pgpPktLdata
struct pgpPktLdata_s pgpPktLdata
PGPSYMKEYALGO_PLAINTEXT
Definition: rpmpgp.h:199
PGPARMOR_ERR_CRC_DECODE
Definition: rpmpgp.h:893
PGPHASHALGO_SHA224
Definition: rpmpgp.h:268
PGPARMOR_PUBKEY
Definition: rpmpgp.h:901
PGPSUBTYPE_PREFER_COMPRESS
Definition: rpmpgp.h:413
pgpPktPre_u::pubkey
pgpPktPubkey pubkey
Definition: rpmpgp.h:875
PGPSUBTYPE_INTERNAL_110
Definition: rpmpgp.h:434
PGPSUBTYPE_REVOKE_REASON
Definition: rpmpgp.h:420
PGPVAL_SIGTYPE
Definition: rpmpgp.h:923
PGPSUBTYPE_INTERNAL_102
Definition: rpmpgp.h:426
PGPSYMKEYALGO_IDEA
Definition: rpmpgp.h:200
pgpHashAlgo
enum pgpHashAlgo_e pgpHashAlgo
9.4.
PGPARMOR_PRIVKEY
Definition: rpmpgp.h:905
PGPSUBTYPE_INTERNAL_104
Definition: rpmpgp.h:428
pgpValType
enum pgpValType_e pgpValType
PGPPUBKEYALGO_ELGAMAL
Definition: rpmpgp.h:170
pgpPktSymkey_s::version
uint8_t version
Definition: rpmpgp.h:493
pgpPktUid
struct pgpPktUid_s pgpPktUid
PGPVAL_ARMORKEY
Definition: rpmpgp.h:922
pgpPktSymkey_s::symkey_algo
uint8_t symkey_algo
Definition: rpmpgp.h:494
pgpPktEdata_s::data
uint8_t data[1]
Definition: rpmpgp.h:785
PGPARMORKEY_MESSAGEID
Definition: rpmpgp.h:914
PGPVAL_HASHALGO
Definition: rpmpgp.h:928
rpmDigestUpdate
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
rpmDigestDup
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
Duplicate a digest context.
PGPSIGTYPE_SUBKEY_REVOKE
Definition: rpmpgp.h:134
pgpPktLdata_s::format
uint8_t format
Definition: rpmpgp.h:836
pgpPktSigV4_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:326
PGPTAG_SYMMETRIC_SESSION_KEY
Definition: rpmpgp.h:50
PGPSUBTYPE_EXPORTABLE_CERT
Definition: rpmpgp.h:402
PGPCOMPRESSALGO_NONE
Definition: rpmpgp.h:229
PGPTAG_TRUST
Definition: rpmpgp.h:59
PGPSUBTYPE_POLICY_URL
Definition: rpmpgp.h:417
pgpPktSigV3_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:299
PGPTAG_CONTROL
Definition: rpmpgp.h:69
PGPSYMKEYALGO_SAFER
Definition: rpmpgp.h:204
pgpHexStr
char * pgpHexStr(const uint8_t *p, size_t plen)
Return hex formatted representation of bytes.
pgpPktPre_u::key
pgpPktKey key
Definition: rpmpgp.h:879
pgpDigParamsFree
pgpDigParams pgpDigParamsFree(pgpDigParams digp)
Destroy parsed OpenPGP packet parameter(s).
rpmDigestFlags_e
rpmDigestFlags_e
Bit(s) to control digest operation.
Definition: rpmpgp.h:935
pgpDigGetParams
pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype)
Retrieve parameters for parsed OpenPGP packet(s).
PGPTAG_COMMENT_OLD
Definition: rpmpgp.h:62
pgpPktKey
union pgpPktKey_u pgpPktKey
5.5.3.
PGPPUBKEYALGO_ECDSA
Definition: rpmpgp.h:169
pgpPktCdata
struct pgpPktCdata_s pgpPktCdata
pgpVerifySig
rpmRC pgpVerifySig(pgpDig dig, DIGEST_CTX hashctx)
Verify a PGP signature.
rpmDigestBundleUpdate
int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len)
Update contexts within bundle with next plain text buffer.
rpmDigestBundleNew
rpmDigestBundle rpmDigestBundleNew(void)
Create a new digest bundle.
PGPHASHALGO_SHA256
Definition: rpmpgp.h:265
pgpPubkeyFingerprint
int pgpPubkeyFingerprint(const uint8_t *pkt, size_t pktlen, uint8_t **fp, size_t *fplen)
Calculate OpenPGP public key fingerprint.
pgpSubType
enum pgpSubType_e pgpSubType
5.2.3.1.
PGPSYMKEYALGO_DES_SK
Definition: rpmpgp.h:205
PGPHASHALGO_SHA1
Definition: rpmpgp.h:260
PGPARMOR_MESSAGE
Definition: rpmpgp.h:900
pgpPktPubkey_s
5.1.
Definition: rpmpgp.h:106
PGPSIGTYPE_SIGNED_KEY
Definition: rpmpgp.h:132
PGPSUBTYPE_NOTATION
Definition: rpmpgp.h:411
pgpPktPubkey_s::algo
uint8_t algo
Definition: rpmpgp.h:109
pgpPktKeyV3_s::time
pgpTime_t time
Definition: rpmpgp.h:610
pgpSubType_e
pgpSubType_e
5.2.3.1.
Definition: rpmpgp.h:398
PGPVAL_SERVERPREFS
Definition: rpmpgp.h:929
PGPSUBTYPE_SIGNER_USERID
Definition: rpmpgp.h:419
PGPSUBTYPE_PREFER_KEYSERVER
Definition: rpmpgp.h:415
pgpPktPre_u::ldata
pgpPktLdata ldata
Definition: rpmpgp.h:883
PGPSYMKEYALGO_TWOFISH
Definition: rpmpgp.h:209
PGPCOMPRESSALGO_ZLIB
Definition: rpmpgp.h:231
PGPTAG_ENCRYPTED_MDC
Definition: rpmpgp.h:64
PGPSUBTYPE_KEYSERVER_PREFERS
Definition: rpmpgp.h:414
pgpArmorWrap
char * pgpArmorWrap(int atype, const unsigned char *s, size_t ns)
Wrap a OpenPGP packets in ascii armor for transport.
pgpPktOnepass_s::nested
uint8_t nested
Definition: rpmpgp.h:533
PGPSUBTYPE_PREFER_SYMKEY
Definition: rpmpgp.h:408
PGPSUBTYPE_INTERNAL_105
Definition: rpmpgp.h:429
pgpPktCdata_s::compressalgo
uint8_t compressalgo
Definition: rpmpgp.h:746
pgpHashAlgo_e
pgpHashAlgo_e
9.4.
Definition: rpmpgp.h:258
PGPSYMKEYALGO_AES_256
Definition: rpmpgp.h:208
pgpPktLdata_s::filename
uint8_t filename[1]
Definition: rpmpgp.h:838
pgpPktSigV3_s::time
pgpTime_t time
Definition: rpmpgp.h:296
pgpPktSigV4_s::hashlen
uint8_t hashlen[2]
Definition: rpmpgp.h:329
pgpPktSigV3
struct pgpPktSigV3_s * pgpPktSigV3
5.2.2.
pgpPktSigV3_s::signid
pgpKeyID_t signid
Definition: rpmpgp.h:297
PGPSUBTYPE_ARR
Definition: rpmpgp.h:407
PGPSUBTYPE_SIG_EXPIRE_TIME
Definition: rpmpgp.h:401
PGPARMORKEY_VERSION
Definition: rpmpgp.h:912
pgpPktPre_u::uid
pgpPktUid uid
Definition: rpmpgp.h:885
PGPARMOR_ERR_NO_BEGIN_PGP
Definition: rpmpgp.h:897
pgpTag
enum pgpTag_e pgpTag
4.3.
PGPPUBKEYALGO_RSA
Definition: rpmpgp.h:163
PGPSUBTYPE_INTERNAL_109
Definition: rpmpgp.h:433
PGPHASHALGO_SHA384
Definition: rpmpgp.h:266
pgpTime_t
uint8_t pgpTime_t[4]
Definition: rpmpgp.h:37
pgpDigParamsAlgo
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype)
Retrieve OpenPGP algorithm parameters param digp parameter container param algotype PGPVAL_HASHALGO /...
pgpPktKeyV4_s::version
uint8_t version
Definition: rpmpgp.h:647
PGPARMOR_SIGNATURE
Definition: rpmpgp.h:902
PGPSIGTYPE_TEXT
Definition: rpmpgp.h:121
pgpPktKeyV3_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:612
PGPSUBTYPE_INTERNAL_103
Definition: rpmpgp.h:427
pgpPktSymkey_s
5.3.
Definition: rpmpgp.h:492
PGPSIGTYPE_STANDALONE
Definition: rpmpgp.h:122
rpmDigestBundleAddID
int rpmDigestBundleAddID(rpmDigestBundle bundle, int algo, int id, rpmDigestFlags flags)
Add a new type of digest to a bundle.
rpmInitCrypto
int rpmInitCrypto(void)
Perform cryptography initialization.
pgpIdentItem
char * pgpIdentItem(pgpDigParams digp)
Return a string identification of a PGP signature/pubkey.
pgpPktPre_u::edata
pgpPktEdata edata
Definition: rpmpgp.h:881
pgpSigType_e
pgpSigType_e
5.2.1.
Definition: rpmpgp.h:119
pgpPktKey_u::v4
struct pgpPktKeyV4_s v4
Definition: rpmpgp.h:718
PGPTAG_PUBLIC_SESSION_KEY
Definition: rpmpgp.h:48
PGPARMOR_FILE
Definition: rpmpgp.h:904
pgpPktSigV3_s::hashlen
uint8_t hashlen
Definition: rpmpgp.h:294
pgpPktPre_u::tdata
pgpPktTrust tdata
Definition: rpmpgp.h:884
pgpPktSigV3_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:298
pgpPktSig_u
5.2.
Definition: rpmpgp.h:459
pgpPktSig_u::v4
struct pgpPktSigV4_s v4
Definition: rpmpgp.h:461
PGPTAG_SECRET_SUBKEY
Definition: rpmpgp.h:54
PGPARMOR_NONE
Definition: rpmpgp.h:899
PGPTAG_SIGNATURE
Definition: rpmpgp.h:49
PGPPUBKEYALGO_DH
Definition: rpmpgp.h:171
pgpPktPubkey_s::keyid
pgpKeyID_t keyid
Definition: rpmpgp.h:108
pgpDigParams
struct pgpDigParams_s * pgpDigParams
Definition: rpmpgp.h:34
rpmFreeCrypto
int rpmFreeCrypto(void)
Shutdown cryptography.
pgpPubKeyCertLen
int pgpPubKeyCertLen(const uint8_t *pkts, size_t pktslen, size_t *certlen)
Return a length of the first public key certificate in a buffer given by pkts that contains one or mo...
pgpPktSymkey
struct pgpPktSymkey_s pgpPktSymkey
5.3.
pgpSymkeyAlgo_e
pgpSymkeyAlgo_e
9.2.
Definition: rpmpgp.h:198
pgpPrtParamsSubkeys
int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, pgpDigParams mainkey, pgpDigParams **subkeys, int *subkeysCount)
Parse subkey parameters from OpenPGP packet(s).
PGPARMORKEY_COMMENT
Definition: rpmpgp.h:913
pgpPktKey_u::v3
struct pgpPktKeyV3_s v3
Definition: rpmpgp.h:717
PGPTAG_USER_ID
Definition: rpmpgp.h:60
PGPSUBTYPE_INTERNAL_100
Definition: rpmpgp.h:424
pgpValString
const char * pgpValString(pgpValType type, uint8_t val)
Return string representation of am OpenPGP value.
PGPSIGTYPE_CERT_REVOKE
Definition: rpmpgp.h:135
pgpSigType
enum pgpSigType_e pgpSigType
5.2.1.
pgpPktLdata_s
Definition: rpmpgp.h:835
PGPVAL_PUBKEYALGO
Definition: rpmpgp.h:925
PGPTAG_COMMENT
Definition: rpmpgp.h:67
PGPSUBTYPE_CRITICAL
Definition: rpmpgp.h:436
PGPSUBTYPE_KEY_FLAGS
Definition: rpmpgp.h:418
pgpPrtParams
int pgpPrtParams(const uint8_t *pkts, size_t pktlen, unsigned int pkttype, pgpDigParams *ret)
Parse a OpenPGP packet(s).
PGPSIGTYPE_SUBKEY_BINDING
Definition: rpmpgp.h:131
pgpPktSig
union pgpPktSig_u * pgpPktSig
5.2.
PGPSUBTYPE_PREFER_HASH
Definition: rpmpgp.h:412
pgpPktSigV3_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:295
PGPPUBKEYALGO_ELGAMAL_ENCRYPT
Definition: rpmpgp.h:166
PGPSYMKEYALGO_BLOWFISH
Definition: rpmpgp.h:203
PGPARMORKEY_HASH
Definition: rpmpgp.h:915
rpmDigestBundleAdd
int rpmDigestBundleAdd(rpmDigestBundle bundle, int algo, rpmDigestFlags flags)
Add a new type of digest to a bundle.
PGPCOMPRESSALGO_ZIP
Definition: rpmpgp.h:230
PGPARMOR_SECKEY
Definition: rpmpgp.h:906
pgpCleanDig
void pgpCleanDig(pgpDig dig)
Release (malloc&#39;d) data from container.
pgpCompressAlgo_e
pgpCompressAlgo_e
9.3.
Definition: rpmpgp.h:228
PGPSYMKEYALGO_CAST5
Definition: rpmpgp.h:202
PGPSUBTYPE_REGEX
Definition: rpmpgp.h:404
pgpPrtPkts
int pgpPrtPkts(const uint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
pgpPktKeyV4_s
The version 4 format is similar to the version 3 format except for the absence of a validity period...
Definition: rpmpgp.h:646
pgpPktTrust_s
Definition: rpmpgp.h:854
PGPHASHALGO_MD5
Definition: rpmpgp.h:259
pgpPktOnepass_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:529
PGPSYMKEYALGO_AES_192
Definition: rpmpgp.h:207
pgpPktOnepass_s::signid
pgpKeyID_t signid
Definition: rpmpgp.h:532
PGPPUBKEYALGO_RSA_SIGN
Definition: rpmpgp.h:165
pgpArmor
enum pgpArmor_e pgpArmor
PGPTAG_COMPRESSED_DATA
Definition: rpmpgp.h:55
pgpPktLdata_s::filenamelen
uint8_t filenamelen
Definition: rpmpgp.h:837
rpmRC
enum rpmRC_e rpmRC
Package read return codes.
PGPTAG_LITERAL_DATA
Definition: rpmpgp.h:58
PGPSYMKEYALGO_TRIPLE_DES
Definition: rpmpgp.h:201
rpmDigestLength
size_t rpmDigestLength(int hashalgo)
Obtain digest length in bytes.
pgpPktPre_u::symkey
pgpPktSymkey symkey
Definition: rpmpgp.h:877
PGPSUBTYPE_TRUST_SIG
Definition: rpmpgp.h:403
pgpPktOnepass
struct pgpPktOnepass_s * pgpPktOnepass
5.4.
PGPSUBTYPE_PRIMARY_USERID
Definition: rpmpgp.h:416