rpm
4.5
|
Routines to handle RFC-2440 detached signatures. More...
Go to the source code of this file.
Data Structures | |
struct | pgpPkt_s |
Macros | |
#define | TOKEQ(_s, _tok) (!strncmp((_s), (_tok), sizeof(_tok)-1)) |
Functions | |
static void | pgpPrtNL (void) |
static void | pgpPrtInt (const char *pre, int i) |
static void | pgpPrtStr (const char *pre, const char *s) |
static void | pgpPrtHex (const char *pre, const byte *p, unsigned int plen) |
void | pgpPrtVal (const char *pre, pgpValTbl vs, byte val) |
Print an OpenPGP value. More... | |
static const char * | pgpMpiHex (const byte *p) |
static int | pgpHexSet (const char *pre, int lbits, mpnumber *mpn, const byte *p, const byte *pend) |
int | pgpPrtSubType (const byte *h, unsigned int hlen, pgpSigType sigtype) |
Print/parse an OpenPGP subtype packet. More... | |
static int | pgpPrtSigParams (const pgpPkt pp, byte pubkey_algo, byte sigtype, const byte *p) |
int | pgpPrtSig (const pgpPkt pp) |
Print/parse an OpenPGP signature packet. More... | |
static const byte * | pgpPrtPubkeyParams (const pgpPkt pp, byte pubkey_algo, const byte *p) |
static const byte * | pgpPrtSeckeyParams (const pgpPkt pp, byte pubkey_algo, const byte *p) |
int | pgpPrtKey (const pgpPkt pp) |
Print/parse an OpenPGP key packet. More... | |
int | pgpPrtUserID (const pgpPkt pp) |
Print/parse an OpenPGP userid packet. More... | |
int | pgpPrtComment (const pgpPkt pp) |
Print/parse an OpenPGP comment packet. More... | |
int | pgpPktLen (const byte *pkt, unsigned int pleft, pgpPkt pp) |
Return lenth of a OpenPGP packet. More... | |
int | pgpPubkeyFingerprint (const byte *pkt, unsigned int pktlen, byte *keyid) |
Calculate OpenPGP public key fingerprint. More... | |
int | pgpExtractPubkeyFingerprint (const char *b64pkt, byte *keyid) |
Extract OpenPGP public key fingerprint from base64 encoded packet. More... | |
int | pgpPrtPkt (const byte *pkt, unsigned int pleft) |
Print/parse next OpenPGP packet. More... | |
pgpDig | pgpNewDig (void) |
Create a container for parsed OpenPGP packates. More... | |
void | pgpCleanDig (pgpDig dig) |
Release (malloc'd) data from container. More... | |
pgpDig | pgpFreeDig (pgpDig dig) |
Destroy a container for parsed OpenPGP packates. More... | |
static int | pgpGrabPkts (const byte *pkts, unsigned int pktlen, byte ***pppkts, int *pnpkts) |
int | pgpPrtPkts (const byte *pkts, unsigned int pktlen, pgpDig dig, int printing) |
Print/parse a OpenPGP packet(s). More... | |
pgpArmor | pgpReadPkts (const char *fn, const byte **pkt, size_t *pktlen) |
Parse armored OpenPGP packets from a file. More... | |
char * | pgpArmorWrap (int atype, const unsigned char *s, size_t ns) |
Wrap a OpenPGP packets in ascii armor for transport. More... | |
Variables | |
static int | _debug = 0 |
static int | _print = 0 |
static pgpDig | _dig = NULL |
static pgpDigParams | _digp = NULL |
struct pgpValTbl_s | pgpSigTypeTbl [] |
struct pgpValTbl_s | pgpPubkeyTbl [] |
struct pgpValTbl_s | pgpSymkeyTbl [] |
Symmetric key (string, value) pairs. More... | |
struct pgpValTbl_s | pgpCompressionTbl [] |
Compression (string, value) pairs. More... | |
struct pgpValTbl_s | pgpHashTbl [] |
Hash (string, value) pairs. More... | |
struct pgpValTbl_s | pgpKeyServerPrefsTbl [] |
struct pgpValTbl_s | pgpSubTypeTbl [] |
Subtype (string, value) pairs. More... | |
struct pgpValTbl_s | pgpTagTbl [] |
struct pgpValTbl_s | pgpArmorTbl [] |
Armor (string, value) pairs. More... | |
struct pgpValTbl_s | pgpArmorKeyTbl [] |
Armor key (string, value) pairs. More... | |
static const char * | pgpSigRSA [] |
static const char * | pgpSigDSA [] |
static const char * | pgpPublicRSA [] |
static const char * | pgpPublicDSA [] |
static const char * | pgpPublicELGAMAL [] |
Routines to handle RFC-2440 detached signatures.
Definition in file rpmpgp.c.
#define TOKEQ | ( | _s, | |
_tok | |||
) | (!strncmp((_s), (_tok), sizeof(_tok)-1)) |
Referenced by pgpReadPkts().
char* pgpArmorWrap | ( | int | atype, |
const unsigned char * | s, | ||
size_t | ns | ||
) |
Wrap a OpenPGP packets in ascii armor for transport.
atype | type of armor |
s | binary pkt data |
ns | binary pkt data length |
Definition at line 1444 of file rpmpgp.c.
References _free(), pgpValStr(), stpcpy(), pgpValTbl_s::val, VERSION, and xmalloc().
Referenced by armorFormat(), and processMetadataFile().
void pgpCleanDig | ( | pgpDig | dig | ) |
Release (malloc'd) data from container.
dig | container |
Definition at line 1115 of file rpmpgp.c.
References _free(), pgpDig_s::c, pgpDigParams_s::hash, pgpDig_s::hm, pgpDig_s::m, pgpDig_s::md5, pgpDig_s::npkts, pgpDigParams_s::params, pgpDig_s::ppkts, pgpDig_s::pubkey, pgpDig_s::r, pgpDig_s::rsa_pk, pgpDig_s::rsahm, pgpDig_s::s, pgpDig_s::sha1, pgpDig_s::signature, and pgpDigParams_s::userid.
Referenced by pgpFreeDig(), and rpmVerifySignatures().
int pgpExtractPubkeyFingerprint | ( | const char * | b64pkt, |
byte * | keyid | ||
) |
Extract OpenPGP public key fingerprint from base64 encoded packet.
b64pkt | base64 encoded openpgp packet |
keyid[8] | public key fingerprint |
Definition at line 1033 of file rpmpgp.c.
References _free(), and pgpPubkeyFingerprint().
Referenced by rpmdbAdd(), and rpmdbRemove().
Destroy a container for parsed OpenPGP packates.
dig | container |
Definition at line 1152 of file rpmpgp.c.
References _free(), pgpDig_s::c, pgpDig_s::g, pgpDig_s::hdrmd5ctx, pgpDig_s::hdrsha1ctx, pgpDig_s::hm, pgpDig_s::m, pgpDig_s::md5ctx, pgpDig_s::p, pgpCleanDig(), pgpDig_s::q, pgpDig_s::r, rpmDigestFinal(), pgpDig_s::rsa_pk, pgpDig_s::s, pgpDig_s::sha1ctx, and pgpDig_s::y.
Referenced by getSignid(), makeGPGSignature(), makePGPSignature(), pgpsigFormat(), rpmcliImportPubkey(), and rpmtsCleanDig().
|
static |
Definition at line 1205 of file rpmpgp.c.
References _free(), alloca(), pgpPktLen(), pgpPkt_s::pktlen, and xcalloc().
Referenced by pgpPrtPkts().
|
static |
Definition at line 329 of file rpmpgp.c.
References _debug, _free(), _print, pgpMpiBits(), pgpMpiHex(), and xmalloc().
Referenced by pgpPrtSigParams().
|
static |
Definition at line 316 of file rpmpgp.c.
References pgpHexCvt(), and pgpMpiLen().
Referenced by pgpHexSet(), pgpPrtPubkeyParams(), and pgpPrtSigParams().
pgpDig pgpNewDig | ( | void | ) |
Create a container for parsed OpenPGP packates.
Definition at line 1108 of file rpmpgp.c.
References xcalloc().
Referenced by getSignid(), makeGPGSignature(), makePGPSignature(), pgpsigFormat(), rpmcliImportPubkey(), and rpmtsDig().
Return lenth of a OpenPGP packet.
pkt | OpenPGP packet (i.e. PGPTAG_PUBLIC_KEY) |
pleft | OpenPGP packet length (no. of bytes) |
pp | packet tag/ptr/len |
Definition at line 946 of file rpmpgp.c.
References pgpPkt_s::h, pgpPkt_s::hlen, pgpGrab(), pgpLen(), pgpPkt_s::pktlen, pgpPkt_s::tag, and pgpValTbl_s::val.
Referenced by pgpGrabPkts(), pgpPrtPkt(), pgpPrtPkts(), and pgpPubkeyFingerprint().
int pgpPrtComment | ( | const pgpPkt | pp | ) |
Print/parse an OpenPGP comment packet.
pp | packet tag/ptr/len |
Definition at line 917 of file rpmpgp.c.
References _print, pgpPkt_s::h, pgpPkt_s::hlen, pgpPrtHex(), pgpPrtNL(), pgpPrtVal(), and pgpPkt_s::tag.
Referenced by pgpPrtPkt().
|
static |
Definition at line 293 of file rpmpgp.c.
References _print, and pgpHexStr().
Referenced by pgpPrtComment(), pgpPrtPkt(), pgpPrtSeckeyParams(), pgpPrtSig(), and pgpPrtSubType().
|
static |
int pgpPrtKey | ( | const pgpPkt | pp | ) |
Print/parse an OpenPGP key packet.
pp | packet tag/ptr/len |
Definition at line 837 of file rpmpgp.c.
References _print, pgpPkt_s::h, pgpGrab(), pgpPrtNL(), pgpPrtPubkeyParams(), pgpPrtSeckeyParams(), pgpPrtVal(), PGPTAG_PUBLIC_KEY, PGPTAG_PUBLIC_SUBKEY, pgpDigParams_s::pubkey_algo, pgpPktKeyV3_s::pubkey_algo, pgpPktKeyV4_s::pubkey_algo, pgpDigParams_s::tag, pgpPkt_s::tag, pgpDigParams_s::time, pgpPktKeyV3_s::time, pgpPktKeyV4_s::time, pgpPktKeyV3_s::valid, pgpDigParams_s::version, pgpPktKeyV3_s::version, and pgpPktKeyV4_s::version.
Referenced by pgpPrtPkt().
|
static |
Definition at line 265 of file rpmpgp.c.
References _print.
Referenced by pgpPrtComment(), pgpPrtKey(), pgpPrtPkt(), pgpPrtPubkeyParams(), pgpPrtSeckeyParams(), pgpPrtSig(), pgpPrtSigParams(), pgpPrtSubType(), and pgpPrtUserID().
int pgpPrtPkt | ( | const byte * | pkt, |
unsigned int | pleft | ||
) |
Print/parse next OpenPGP packet.
pkt | OpenPGP packet |
pleft | no. bytes remaining |
Definition at line 1045 of file rpmpgp.c.
References alloca(), pgpPkt_s::h, pgpPkt_s::hlen, PGPDIG_SAVED_ID, pgpPktLen(), pgpPrtComment(), pgpPrtHex(), pgpPrtKey(), pgpPrtNL(), pgpPrtSig(), pgpPrtUserID(), pgpPrtVal(), pgpPubkeyFingerprint(), PGPTAG_COMMENT, PGPTAG_COMMENT_OLD, PGPTAG_COMPRESSED_DATA, PGPTAG_CONTROL, PGPTAG_ENCRYPTED_MDC, PGPTAG_LITERAL_DATA, PGPTAG_MARKER, PGPTAG_MDC, PGPTAG_PHOTOID, PGPTAG_PRIVATE_60, PGPTAG_PRIVATE_62, PGPTAG_PUBLIC_KEY, PGPTAG_PUBLIC_SESSION_KEY, PGPTAG_PUBLIC_SUBKEY, PGPTAG_RESERVED, PGPTAG_SECRET_KEY, PGPTAG_SECRET_SUBKEY, PGPTAG_SIGNATURE, PGPTAG_SYMMETRIC_DATA, PGPTAG_SYMMETRIC_SESSION_KEY, PGPTAG_TRUST, PGPTAG_USER_ID, pgpPkt_s::pktlen, pgpDigParams_s::saved, pgpDigParams_s::signid, and pgpPkt_s::tag.
Referenced by pgpPrtPkts().
Print/parse a OpenPGP packet(s).
pkts | OpenPGP packet(s) |
pktlen | OpenPGP packet(s) length (no. of bytes) |
dig | parsed output of signature/pubkey packet parameters |
printing | should packets be printed? |
Definition at line 1249 of file rpmpgp.c.
References _free(), _print, alloca(), pgpDig_s::npkts, pgpGrabPkts(), pgpPktLen(), pgpPrtPkt(), PGPTAG_SIGNATURE, pgpPkt_s::pktlen, pgpDig_s::ppkts, pgpDig_s::pubkey, pgpDig_s::signature, pgpDigParams_s::tag, and pgpValTbl_s::val.
Referenced by getSignid(), headerCheck(), makeGPGSignature(), makePGPSignature(), pgpsigFormat(), rpmcliImportPubkey(), rpmReadPackageFile(), rpmts_PgpPrtPkts(), rpmtsFindPubkey(), and rpmVerifySignatures().
Definition at line 693 of file rpmpgp.c.
References _debug, _print, pgpDig_s::g, pgpPkt_s::h, pgpPkt_s::hlen, pgpDig_s::p, pgpMpiHex(), pgpMpiLen(), pgpMpiStr(), pgpPrtNL(), pgpPrtStr(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_ELGAMAL_ENCRYPT, PGPPUBKEYALGO_RSA, pgpPublicDSA, pgpPublicELGAMAL, pgpPublicRSA, pgpDig_s::q, pgpDig_s::rsa_pk, and pgpDig_s::y.
Referenced by pgpPrtKey().
Definition at line 763 of file rpmpgp.c.
References _print, pgpPkt_s::h, pgpPkt_s::hlen, pgpMpiLen(), pgpMpiStr(), pgpPrtHex(), pgpPrtInt(), pgpPrtNL(), pgpPrtStr(), pgpPrtVal(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_ELGAMAL_ENCRYPT, and PGPPUBKEYALGO_RSA.
Referenced by pgpPrtKey().
int pgpPrtSig | ( | const pgpPkt | pp | ) |
Print/parse an OpenPGP signature packet.
pp | packet tag/ptr/len |
Definition at line 533 of file rpmpgp.c.
References _debug, _print, pgpPkt_s::h, pgpDigParams_s::hash, pgpDigParams_s::hash_algo, pgpPktSigV3_s::hash_algo, pgpPktSigV4_s::hash_algo, pgpDigParams_s::hashlen, pgpPktSigV3_s::hashlen, pgpPktSigV4_s::hashlen, pgpPkt_s::hlen, pgpGrab(), pgpHexStr(), pgpPrtHex(), pgpPrtNL(), pgpPrtSigParams(), pgpPrtSubType(), pgpPrtVal(), pgpDigParams_s::pubkey_algo, pgpPktSigV3_s::pubkey_algo, pgpPktSigV4_s::pubkey_algo, pgpDigParams_s::signhash16, pgpPktSigV3_s::signhash16, pgpDigParams_s::signid, pgpPktSigV3_s::signid, pgpDigParams_s::sigtype, pgpPktSigV3_s::sigtype, pgpPktSigV4_s::sigtype, pgpPkt_s::tag, pgpDigParams_s::time, pgpPktSigV3_s::time, pgpDigParams_s::version, pgpPktSigV3_s::version, pgpPktSigV4_s::version, and xmalloc().
Referenced by pgpPrtPkt().
|
static |
Definition at line 476 of file rpmpgp.c.
References _debug, _print, pgpDig_s::c, pgpPkt_s::h, pgpPkt_s::hlen, pgpHexSet(), pgpMpiHex(), pgpMpiLen(), pgpMpiStr(), pgpPrtNL(), pgpPrtStr(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_RSA, pgpSigDSA, pgpSigRSA, PGPSIGTYPE_BINARY, PGPSIGTYPE_TEXT, pgpDig_s::r, and pgpDig_s::s.
Referenced by pgpPrtSig().
|
static |
Definition at line 283 of file rpmpgp.c.
References _print.
Referenced by pgpPrtPubkeyParams(), pgpPrtSeckeyParams(), and pgpPrtSigParams().
int pgpPrtSubType | ( | const byte * | h, |
unsigned int | hlen, | ||
pgpSigType | sigtype | ||
) |
Print/parse an OpenPGP subtype packet.
h | packet |
hlen | packet length (no. of bytes) |
sigtype | signature type |
Definition at line 362 of file rpmpgp.c.
References _print, PGPDIG_SAVED_ID, PGPDIG_SAVED_TIME, pgpGrab(), pgpLen(), pgpPrtHex(), pgpPrtNL(), pgpPrtVal(), PGPSIGTYPE_BINARY, PGPSIGTYPE_POSITIVE_CERT, PGPSIGTYPE_STANDALONE, PGPSIGTYPE_TEXT, PGPSUBTYPE_ARR, PGPSUBTYPE_CRITICAL, PGPSUBTYPE_EMBEDDED_SIG, PGPSUBTYPE_EXPORTABLE_CERT, PGPSUBTYPE_FEATURES, PGPSUBTYPE_INTERNAL_100, PGPSUBTYPE_INTERNAL_101, PGPSUBTYPE_INTERNAL_102, PGPSUBTYPE_INTERNAL_103, PGPSUBTYPE_INTERNAL_104, PGPSUBTYPE_INTERNAL_105, PGPSUBTYPE_INTERNAL_106, PGPSUBTYPE_INTERNAL_107, PGPSUBTYPE_INTERNAL_108, PGPSUBTYPE_INTERNAL_109, PGPSUBTYPE_INTERNAL_110, PGPSUBTYPE_ISSUER_KEYID, PGPSUBTYPE_KEY_EXPIRE_TIME, PGPSUBTYPE_KEY_FLAGS, PGPSUBTYPE_KEYSERVER_PREFERS, PGPSUBTYPE_NOTATION, PGPSUBTYPE_POLICY_URL, PGPSUBTYPE_PREFER_COMPRESS, PGPSUBTYPE_PREFER_HASH, PGPSUBTYPE_PREFER_KEYSERVER, PGPSUBTYPE_PREFER_SYMKEY, PGPSUBTYPE_PRIMARY_USERID, PGPSUBTYPE_REGEX, PGPSUBTYPE_REVOCABLE, PGPSUBTYPE_REVOKE_KEY, PGPSUBTYPE_REVOKE_REASON, PGPSUBTYPE_SIG_CREATE_TIME, PGPSUBTYPE_SIG_EXPIRE_TIME, PGPSUBTYPE_SIGNER_USERID, PGPSUBTYPE_TRUST_SIG, pgpDigParams_s::saved, pgpDigParams_s::signid, and pgpDigParams_s::time.
Referenced by pgpPrtSig().
int pgpPrtUserID | ( | const pgpPkt | pp | ) |
Print/parse an OpenPGP userid packet.
pp | packet tag/ptr/len |
Definition at line 899 of file rpmpgp.c.
References _free(), _print, pgpPkt_s::h, pgpPkt_s::hlen, pgpPrtNL(), pgpPrtVal(), pgpPkt_s::tag, pgpDigParams_s::userid, and xmalloc().
Referenced by pgpPrtPkt().
Print an OpenPGP value.
pre | output prefix |
vs | table of (string,value) pairs |
val | byte value to print |
Definition at line 303 of file rpmpgp.c.
References _print, and pgpValStr().
Referenced by pgpPrtComment(), pgpPrtKey(), pgpPrtPkt(), pgpPrtSeckeyParams(), pgpPrtSig(), pgpPrtSubType(), and pgpPrtUserID().
Calculate OpenPGP public key fingerprint.
pkt | OpenPGP packet (i.e. PGPTAG_PUBLIC_KEY) |
pktlen | OpenPGP packet length (no. of bytes) |
keyid | publick key fingerprint |
Definition at line 976 of file rpmpgp.c.
References _free(), alloca(), pgpPkt_s::h, PGPHASHALGO_SHA1, pgpMpiLen(), pgpPktLen(), PGPPUBKEYALGO_DSA, PGPPUBKEYALGO_RSA, PGPTAG_PUBLIC_KEY, pgpPktKeyV3_s::pubkey_algo, pgpPktKeyV4_s::pubkey_algo, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), and pgpPkt_s::tag.
Referenced by pgpExtractPubkeyFingerprint(), and pgpPrtPkt().
Parse armored OpenPGP packets from a file.
fn | file name |
pkt | dearmored OpenPGP packet(s) |
pktlen | dearmored OpenPGP packet(s) length in bytes |
Definition at line 1292 of file rpmpgp.c.
References _free(), PGPARMOR_ERR_BODY_DECODE, PGPARMOR_ERR_CRC_CHECK, PGPARMOR_ERR_CRC_DECODE, PGPARMOR_ERR_NO_BEGIN_PGP, PGPARMOR_ERR_NO_END_PGP, PGPARMOR_ERR_UNKNOWN_ARMOR_TYPE, PGPARMOR_NONE, PGPARMOR_PUBKEY, pgpCRC(), pgpGrab(), pgpIsPkt(), pgpValTok(), rpmioSlurp(), and TOKEQ.
Referenced by processMetadataFile(), rpmcliImportPubkeys(), and rpmtsFindPubkey().
|
static |
Definition at line 16 of file rpmpgp.c.
Referenced by pgpHexSet(), pgpPrtPubkeyParams(), pgpPrtSig(), and pgpPrtSigParams().
|
static |
|
static |
Definition at line 19 of file rpmpgp.c.
Referenced by pgpHexSet(), pgpPrtComment(), pgpPrtHex(), pgpPrtInt(), pgpPrtKey(), pgpPrtNL(), pgpPrtPkts(), pgpPrtPubkeyParams(), pgpPrtSeckeyParams(), pgpPrtSig(), pgpPrtSigParams(), pgpPrtStr(), pgpPrtSubType(), pgpPrtUserID(), and pgpPrtVal().
struct pgpValTbl_s pgpArmorKeyTbl[] |
Armor key (string, value) pairs.
struct pgpValTbl_s pgpArmorTbl[] |
Armor (string, value) pairs.
struct pgpValTbl_s pgpCompressionTbl[] |
Compression (string, value) pairs.
struct pgpValTbl_s pgpHashTbl[] |
Hash (string, value) pairs.
struct pgpValTbl_s pgpKeyServerPrefsTbl[] |
struct pgpValTbl_s pgpPubkeyTbl[] |
|
static |
Definition at line 660 of file rpmpgp.c.
Referenced by pgpPrtPubkeyParams().
|
static |
Definition at line 677 of file rpmpgp.c.
Referenced by pgpPrtPubkeyParams().
|
static |
Definition at line 642 of file rpmpgp.c.
Referenced by pgpPrtPubkeyParams().
|
static |
Definition at line 469 of file rpmpgp.c.
Referenced by pgpPrtSigParams().
|
static |
Definition at line 463 of file rpmpgp.c.
Referenced by pgpPrtSigParams().
struct pgpValTbl_s pgpSigTypeTbl[] |
struct pgpValTbl_s pgpSubTypeTbl[] |
struct pgpValTbl_s pgpSymkeyTbl[] |
Symmetric key (string, value) pairs.
struct pgpValTbl_s pgpTagTbl[] |