rpm  4.16.0-beta1
rpmpgp.h
Go to the documentation of this file.
1 #ifndef H_RPMPGP
2 #define H_RPMPGP
3 
17 #include <string.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <rpm/rpmtypes.h>
21 #include <rpm/rpmstring.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
29 typedef struct DIGEST_CTX_s * DIGEST_CTX;
30 typedef struct rpmDigestBundle_s * rpmDigestBundle;
31 
34 typedef struct pgpDig_s * pgpDig;
35 
38 typedef struct pgpDigParams_s * pgpDigParams;
39 
40 typedef uint8_t pgpKeyID_t[8];
41 typedef uint8_t pgpTime_t[4];
42 
50 typedef enum pgpTag_e {
63  PGPTAG_TRUST = 12,
69  PGPTAG_MDC = 19,
74 } pgpTag;
75 
110 typedef struct pgpPktPubkey_s {
111  uint8_t version;
113  uint8_t algo;
114 } pgpPktPubkey;
115 
116 
123 typedef enum pgpSigType_e {
141 } pgpSigType;
142 
167 typedef enum pgpPubkeyAlgo_e {
178 } pgpPubkeyAlgo;
179 
204 typedef enum pgpSymkeyAlgo_e {
217 } pgpSymkeyAlgo;
218 
234 typedef enum pgpCompressAlgo_e {
240 
264 typedef enum pgpHashAlgo_e {
275 } pgpHashAlgo;
276 
283 typedef enum pgpCurveId_e {
291 } pgpCurveId;
292 
314 typedef struct pgpPktSigV3_s {
315  uint8_t version;
316  uint8_t hashlen;
317  uint8_t sigtype;
320  uint8_t pubkey_algo;
321  uint8_t hash_algo;
322  uint8_t signhash16[2];
323 } * pgpPktSigV3;
324 
346 typedef struct pgpPktSigV4_s {
347  uint8_t version;
348  uint8_t sigtype;
349  uint8_t pubkey_algo;
350  uint8_t hash_algo;
351  uint8_t hashlen[2];
352 } * pgpPktSigV4;
353 
420 typedef enum pgpSubType_e {
459 } pgpSubType;
460 
481 typedef union pgpPktSig_u {
484 } * pgpPktSig;
485 
514 typedef struct pgpPktSymkey_s {
515  uint8_t version;
516  uint8_t symkey_algo;
517  uint8_t s2k[1];
518 } pgpPktSymkey;
519 
549 typedef struct pgpPktOnepass_s {
550  uint8_t version;
551  uint8_t sigtype;
552  uint8_t hash_algo;
553  uint8_t pubkey_algo;
555  uint8_t nested;
556 } * pgpPktOnepass;
557 
630 typedef struct pgpPktKeyV3_s {
631  uint8_t version;
633  uint8_t valid[2];
634  uint8_t pubkey_algo;
635 } * pgpPktKeyV3;
636 
673 typedef struct pgpPktKeyV4_s {
674  uint8_t version;
676  uint8_t pubkey_algo;
677 } * pgpPktKeyV4;
678 
743 typedef union pgpPktKey_u {
746 } pgpPktKey;
747 
748 /* \ingroup rpmpgp
749  * 5.6. Compressed Data Packet (Tag 8)
750  *
751  * The Compressed Data packet contains compressed data. Typically, this
752  * packet is found as the contents of an encrypted packet, or following
753  * a Signature or One-Pass Signature packet, and contains literal data
754  * packets.
755  *
756  * The body of this packet consists of:
757  * - One octet that gives the algorithm used to compress the packet.
758  * - The remainder of the packet is compressed data.
759  *
760  * A Compressed Data Packet's body contains an block that compresses
761  * some set of packets. See section "Packet Composition" for details on
762  * how messages are formed.
763  *
764  * ZIP-compressed packets are compressed with raw RFC 1951 DEFLATE
765  * blocks. Note that PGP V2.6 uses 13 bits of compression. If an
766  * implementation uses more bits of compression, PGP V2.6 cannot
767  * decompress it.
768  *
769  * ZLIB-compressed packets are compressed with RFC 1950 ZLIB-style
770  * blocks.
771  */
772 typedef struct pgpPktCdata_s {
773  uint8_t compressalgo;
774  uint8_t data[1];
775 } pgpPktCdata;
776 
777 /* \ingroup rpmpgp
778  * 5.7. Symmetrically Encrypted Data Packet (Tag 9)
779  *
780  * The Symmetrically Encrypted Data packet contains data encrypted with
781  * a symmetric-key algorithm. When it has been decrypted, it will
782  * typically contain other packets (often literal data packets or
783  * compressed data packets).
784  *
785  * The body of this packet consists of:
786  * - Encrypted data, the output of the selected symmetric-key cipher
787  * operating in PGP's variant of Cipher Feedback (CFB) mode.
788  *
789  * The symmetric cipher used may be specified in an Public-Key or
790  * Symmetric-Key Encrypted Session Key packet that precedes the
791  * Symmetrically Encrypted Data Packet. In that case, the cipher
792  * algorithm octet is prefixed to the session key before it is
793  * encrypted. If no packets of these types precede the encrypted data,
794  * the IDEA algorithm is used with the session key calculated as the MD5
795  * hash of the passphrase.
796  *
797  * The data is encrypted in CFB mode, with a CFB shift size equal to the
798  * cipher's block size. The Initial Vector (IV) is specified as all
799  * zeros. Instead of using an IV, OpenPGP prefixes a 10-octet string to
800  * the data before it is encrypted. The first eight octets are random,
801  * and the 9th and 10th octets are copies of the 7th and 8th octets,
802  * respectively. After encrypting the first 10 octets, the CFB state is
803  * resynchronized if the cipher block size is 8 octets or less. The
804  * last 8 octets of ciphertext are passed through the cipher and the
805  * block boundary is reset.
806  *
807  * The repetition of 16 bits in the 80 bits of random data prefixed to
808  * the message allows the receiver to immediately check whether the
809  * session key is incorrect.
810  */
811 typedef struct pgpPktEdata_s {
812  uint8_t data[1];
813 } pgpPktEdata;
814 
815 /* \ingroup rpmpgp
816  * 5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)
817  *
818  * An experimental version of PGP used this packet as the Literal
819  * packet, but no released version of PGP generated Literal packets with
820  * this tag. With PGP 5.x, this packet has been re-assigned and is
821  * reserved for use as the Marker packet.
822  *
823  * The body of this packet consists of:
824  * - The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8).
825  *
826  * Such a packet MUST be ignored when received. It may be placed at the
827  * beginning of a message that uses features not available in PGP 2.6.x
828  * in order to cause that version to report that newer software is
829  * necessary to process the message.
830  */
831 /* \ingroup rpmpgp
832  * 5.9. Literal Data Packet (Tag 11)
833  *
834  * A Literal Data packet contains the body of a message; data that is
835  * not to be further interpreted.
836  *
837  * The body of this packet consists of:
838  * - A one-octet field that describes how the data is formatted.
839  *
840  * If it is a 'b' (0x62), then the literal packet contains binary data.
841  * If it is a 't' (0x74), then it contains text data, and thus may need
842  * line ends converted to local form, or other text-mode changes. RFC
843  * 1991 also defined a value of 'l' as a 'local' mode for machine-local
844  * conversions. This use is now deprecated.
845  * - File name as a string (one-octet length, followed by file name),
846  * if the encrypted data should be saved as a file.
847  *
848  * If the special name "_CONSOLE" is used, the message is considered to
849  * be "for your eyes only". This advises that the message data is
850  * unusually sensitive, and the receiving program should process it more
851  * carefully, perhaps avoiding storing the received data to disk, for
852  * example.
853  * - A four-octet number that indicates the modification date of the
854  * file, or the creation time of the packet, or a zero that
855  * indicates the present time.
856  * - The remainder of the packet is literal data.
857  *
858  * Text data is stored with <CR><LF> text endings (i.e. network-normal
859  * line endings). These should be converted to native line endings by
860  * the receiving software.
861  */
862 typedef struct pgpPktLdata_s {
863  uint8_t format;
864  uint8_t filenamelen;
865  uint8_t filename[1];
866 } pgpPktLdata;
867 
868 /* \ingroup rpmpgp
869  * 5.10. Trust Packet (Tag 12)
870  *
871  * The Trust packet is used only within keyrings and is not normally
872  * exported. Trust packets contain data that record the user's
873  * specifications of which key holders are trustworthy introducers,
874  * along with other information that implementing software uses for
875  * trust information.
876  *
877  * Trust packets SHOULD NOT be emitted to output streams that are
878  * transferred to other users, and they SHOULD be ignored on any input
879  * other than local keyring files.
880  */
881 typedef struct pgpPktTrust_s {
882  uint8_t flag;
883 } pgpPktTrust;
884 
885 /* \ingroup rpmpgp
886  * 5.11. User ID Packet (Tag 13)
887  *
888  * A User ID packet consists of data that is intended to represent the
889  * name and email address of the key holder. By convention, it includes
890  * an RFC 822 mail name, but there are no restrictions on its content.
891  * The packet length in the header specifies the length of the user id.
892  * If it is text, it is encoded in UTF-8.
893  *
894  */
895 typedef struct pgpPktUid_s {
896  uint8_t userid[1];
897 } pgpPktUid;
898 
901 union pgpPktPre_u {
913 };
914 
917 typedef enum pgpArmor_e {
925 #define PGPARMOR_ERROR PGPARMOR_ERR_NO_BEGIN_PGP
934 } pgpArmor;
935 
938 typedef enum pgpArmorKey_e {
944 } pgpArmorKey;
945 
946 typedef enum pgpValType_e {
957 } pgpValType;
958 
964 };
965 
967 
974 const char * pgpValString(pgpValType type, uint8_t val);
975 
982 static inline
983 unsigned int pgpGrab(const uint8_t *s, size_t nbytes)
984 {
985  size_t i = 0;
986  size_t nb = (nbytes <= sizeof(i) ? nbytes : sizeof(i));
987  while (nb--)
988  i = (i << 8) | *s++;
989  return i;
990 }
991 
998 char * pgpHexStr(const uint8_t *p, size_t plen);
999 
1008 int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen,
1009  uint8_t **fp, size_t *fplen);
1010 
1018 int pgpPubkeyKeyID(const uint8_t * pkt, size_t pktlen, pgpKeyID_t keyid);
1019 
1028 int pgpPrtParams(const uint8_t *pkts, size_t pktlen, unsigned int pkttype,
1029  pgpDigParams * ret);
1030 
1040 int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen,
1041  pgpDigParams mainkey, pgpDigParams **subkeys,
1042  int *subkeysCount);
1051 int pgpPrtPkts(const uint8_t *pkts, size_t pktlen, pgpDig dig, int printing);
1052 
1060 pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen);
1061 
1069 pgpArmor pgpParsePkts(const char *armor, uint8_t ** pkt, size_t * pktlen);
1070 
1083 int pgpPubKeyCertLen(const uint8_t *pkts, size_t pktslen, size_t *certlen);
1084 
1092 char * pgpArmorWrap(int atype, const unsigned char * s, size_t ns);
1093 
1098 pgpDig pgpNewDig(void);
1099 
1104 void pgpCleanDig(pgpDig dig);
1105 
1111 pgpDig pgpFreeDig(pgpDig dig);
1112 
1119 pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype);
1120 
1128 
1135 unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype);
1136 
1143 
1152 
1161 rpmRC pgpVerifySig(pgpDig dig, DIGEST_CTX hashctx);
1162 
1168 char *pgpIdentItem(pgpDigParams digp);
1169 
1177 int rpmInitCrypto(void);
1178 
1182 int rpmFreeCrypto(void);
1183 
1190 
1196 size_t rpmDigestLength(int hashalgo);
1197 
1205 DIGEST_CTX rpmDigestInit(int hashalgo, rpmDigestFlags flags);
1206 
1214 int rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len);
1215 
1227 int rpmDigestFinal(DIGEST_CTX ctx,
1228  void ** datap,
1229  size_t * lenp, int asAscii);
1230 
1236 
1243 
1252 int rpmDigestBundleAdd(rpmDigestBundle bundle, int algo,
1253  rpmDigestFlags flags);
1254 
1263 int rpmDigestBundleAddID(rpmDigestBundle bundle, int algo, int id,
1264  rpmDigestFlags flags);
1265 
1273 int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len);
1274 
1285 int rpmDigestBundleFinal(rpmDigestBundle bundle, int id,
1286  void ** datap, size_t * lenp, int asAscii);
1287 
1295 
1296 #ifdef __cplusplus
1297 }
1298 #endif
1299 
1300 #endif /* H_RPMPGP */
pgpPktCdata_s
Definition: rpmpgp.h:772
pgpArmor
enum pgpArmor_e pgpArmor
pgpPktOnepass_s::signid
pgpKeyID_t signid
Definition: rpmpgp.h:554
pgpPrtParams
int pgpPrtParams(const uint8_t *pkts, size_t pktlen, unsigned int pkttype, pgpDigParams *ret)
PGPVAL_TAG
@ PGPVAL_TAG
Definition: rpmpgp.h:947
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
pgpPktSig_u
Definition: rpmpgp.h:481
PGPVAL_SIGTYPE
@ PGPVAL_SIGTYPE
Definition: rpmpgp.h:950
pgpPktCdata_s::compressalgo
uint8_t compressalgo
Definition: rpmpgp.h:773
pgpPktLdata_s::filenamelen
uint8_t filenamelen
Definition: rpmpgp.h:864
PGPSYMKEYALGO_SAFER
@ PGPSYMKEYALGO_SAFER
Definition: rpmpgp.h:210
PGPTAG_PRIVATE_62
@ PGPTAG_PRIVATE_62
Definition: rpmpgp.h:72
PGPSYMKEYALGO_BLOWFISH
@ PGPSYMKEYALGO_BLOWFISH
Definition: rpmpgp.h:209
pgpPktSigV4_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:349
pgpVerifySig
rpmRC pgpVerifySig(pgpDig dig, DIGEST_CTX hashctx)
PGPCOMPRESSALGO_ZIP
@ PGPCOMPRESSALGO_ZIP
Definition: rpmpgp.h:236
PGPHASHALGO_SHA256
@ PGPHASHALGO_SHA256
Definition: rpmpgp.h:271
pgpPktPre_u::onepass
pgpPktOnepass onepass
Definition: rpmpgp.h:905
PGPVAL_SYMKEYALGO
@ PGPVAL_SYMKEYALGO
Definition: rpmpgp.h:953
pgpPktKeyV4_s::version
uint8_t version
Definition: rpmpgp.h:674
PGPTAG_SECRET_KEY
@ PGPTAG_SECRET_KEY
Definition: rpmpgp.h:56
PGPTAG_PUBLIC_SUBKEY
@ PGPTAG_PUBLIC_SUBKEY
Definition: rpmpgp.h:65
PGPHASHALGO_SHA1
@ PGPHASHALGO_SHA1
Definition: rpmpgp.h:266
PGPSIGTYPE_POSITIVE_CERT
@ PGPSIGTYPE_POSITIVE_CERT
Definition: rpmpgp.h:133
PGPHASHALGO_SHA512
@ PGPHASHALGO_SHA512
Definition: rpmpgp.h:273
PGPSIGTYPE_SIGNED_KEY
@ PGPSIGTYPE_SIGNED_KEY
Definition: rpmpgp.h:136
PGPARMOR_MESSAGE
@ PGPARMOR_MESSAGE
Definition: rpmpgp.h:927
pgpCompressAlgo
enum pgpCompressAlgo_e pgpCompressAlgo
pgpCurveId
enum pgpCurveId_e pgpCurveId
pgpPktKeyV3_s
Definition: rpmpgp.h:630
pgpPktSymkey_s::symkey_algo
uint8_t symkey_algo
Definition: rpmpgp.h:516
PGPSUBTYPE_SIGNER_USERID
@ PGPSUBTYPE_SIGNER_USERID
Definition: rpmpgp.h:441
rpmDigestLength
size_t rpmDigestLength(int hashalgo)
pgpKeyID_t
uint8_t pgpKeyID_t[8]
Definition: rpmpgp.h:40
pgpPktSigV4_s
Definition: rpmpgp.h:346
rpmFreeCrypto
int rpmFreeCrypto(void)
pgpNewDig
pgpDig pgpNewDig(void)
PGPTAG_ONEPASS_SIGNATURE
@ PGPTAG_ONEPASS_SIGNATURE
Definition: rpmpgp.h:55
rpmDigestFinal
int rpmDigestFinal(DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii)
PGPSUBTYPE_INTERNAL_102
@ PGPSUBTYPE_INTERNAL_102
Definition: rpmpgp.h:448
PGPSYMKEYALGO_IDEA
@ PGPSYMKEYALGO_IDEA
Definition: rpmpgp.h:206
PGPARMORKEY_COMMENT
@ PGPARMORKEY_COMMENT
Definition: rpmpgp.h:940
PGPSUBTYPE_PREFER_SYMKEY
@ PGPSUBTYPE_PREFER_SYMKEY
Definition: rpmpgp.h:430
PGPARMOR_PRIVKEY
@ PGPARMOR_PRIVKEY
Definition: rpmpgp.h:932
pgpSubType
enum pgpSubType_e pgpSubType
pgpHashAlgo_e
pgpHashAlgo_e
Definition: rpmpgp.h:264
pgpPktKey
union pgpPktKey_u pgpPktKey
pgpPktSig_u::v4
struct pgpPktSigV4_s v4
Definition: rpmpgp.h:483
PGPSUBTYPE_CRITICAL
@ PGPSUBTYPE_CRITICAL
Definition: rpmpgp.h:458
pgpArmorKey_e
pgpArmorKey_e
Definition: rpmpgp.h:938
pgpPktSigV4_s::version
uint8_t version
Definition: rpmpgp.h:347
pgpPktOnepass_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:552
pgpPktPre_u::symkey
pgpPktSymkey symkey
Definition: rpmpgp.h:904
PGPPUBKEYALGO_EC
@ PGPPUBKEYALGO_EC
Definition: rpmpgp.h:173
PGPSUBTYPE_PREFER_HASH
@ PGPSUBTYPE_PREFER_HASH
Definition: rpmpgp.h:434
PGPPUBKEYALGO_ELGAMAL_ENCRYPT
@ PGPPUBKEYALGO_ELGAMAL_ENCRYPT
Definition: rpmpgp.h:171
PGPTAG_RESERVED
@ PGPTAG_RESERVED
Definition: rpmpgp.h:51
PGPARMOR_SIGNATURE
@ PGPARMOR_SIGNATURE
Definition: rpmpgp.h:929
PGPTAG_CONTROL
@ PGPTAG_CONTROL
Definition: rpmpgp.h:73
pgpDigParamsAlgo
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype)
pgpPktPre_u::pubkey
pgpPktPubkey pubkey
Definition: rpmpgp.h:902
PGPPUBKEYALGO_ECDSA
@ PGPPUBKEYALGO_ECDSA
Definition: rpmpgp.h:174
rpmDigestBundleAddID
int rpmDigestBundleAddID(rpmDigestBundle bundle, int algo, int id, rpmDigestFlags flags)
pgpPktUid_s
Definition: rpmpgp.h:895
pgpPktSigV3
struct pgpPktSigV3_s * pgpPktSigV3
pgpPktTrust_s::flag
uint8_t flag
Definition: rpmpgp.h:882
PGPCURVE_CURVE25519
@ PGPCURVE_CURVE25519
Definition: rpmpgp.h:290
pgpPubkeyFingerprint
int pgpPubkeyFingerprint(const uint8_t *pkt, size_t pktlen, uint8_t **fp, size_t *fplen)
PGPCURVE_ED25519
@ PGPCURVE_ED25519
Definition: rpmpgp.h:289
pgpPktPre_u::edata
pgpPktEdata edata
Definition: rpmpgp.h:908
PGPARMOR_FILE
@ PGPARMOR_FILE
Definition: rpmpgp.h:931
PGPHASHALGO_MD5
@ PGPHASHALGO_MD5
Definition: rpmpgp.h:265
pgpPktOnepass_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:553
pgpPktOnepass_s::version
uint8_t version
Definition: rpmpgp.h:550
PGPPUBKEYALGO_DH
@ PGPPUBKEYALGO_DH
Definition: rpmpgp.h:176
pgpPktPre_u::tdata
pgpPktTrust tdata
Definition: rpmpgp.h:911
PGPSYMKEYALGO_PLAINTEXT
@ PGPSYMKEYALGO_PLAINTEXT
Definition: rpmpgp.h:205
pgpPubkeyAlgo_e
pgpPubkeyAlgo_e
Definition: rpmpgp.h:167
PGPSUBTYPE_PREFER_KEYSERVER
@ PGPSUBTYPE_PREFER_KEYSERVER
Definition: rpmpgp.h:437
PGPSUBTYPE_INTERNAL_110
@ PGPSUBTYPE_INTERNAL_110
Definition: rpmpgp.h:456
pgpPubKeyCertLen
int pgpPubKeyCertLen(const uint8_t *pkts, size_t pktslen, size_t *certlen)
PGPHASHALGO_HAVAL_5_160
@ PGPHASHALGO_HAVAL_5_160
Definition: rpmpgp.h:270
PGPTAG_PRIVATE_60
@ PGPTAG_PRIVATE_60
Definition: rpmpgp.h:70
pgpSymkeyAlgo_e
pgpSymkeyAlgo_e
Definition: rpmpgp.h:204
pgpArmorKey
enum pgpArmorKey_e pgpArmorKey
PGPSIGTYPE_GENERIC_CERT
@ PGPSIGTYPE_GENERIC_CERT
Definition: rpmpgp.h:127
PGPSYMKEYALGO_AES_128
@ PGPSYMKEYALGO_AES_128
Definition: rpmpgp.h:212
PGPSUBTYPE_INTERNAL_107
@ PGPSUBTYPE_INTERNAL_107
Definition: rpmpgp.h:453
PGPSUBTYPE_SIG_EXPIRE_TIME
@ PGPSUBTYPE_SIG_EXPIRE_TIME
Definition: rpmpgp.h:423
PGPPUBKEYALGO_EDDSA
@ PGPPUBKEYALGO_EDDSA
Definition: rpmpgp.h:177
pgpParsePkts
pgpArmor pgpParsePkts(const char *armor, uint8_t **pkt, size_t *pktlen)
PGPTAG_USER_ID
@ PGPTAG_USER_ID
Definition: rpmpgp.h:64
PGPARMORKEY_VERSION
@ PGPARMORKEY_VERSION
Definition: rpmpgp.h:939
pgpPktSigV3_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:320
PGPARMORKEY_CHARSET
@ PGPARMORKEY_CHARSET
Definition: rpmpgp.h:943
PGPVAL_PUBKEYALGO
@ PGPVAL_PUBKEYALGO
Definition: rpmpgp.h:952
PGPTAG_PUBLIC_KEY
@ PGPTAG_PUBLIC_KEY
Definition: rpmpgp.h:57
PGPTAG_TRUST
@ PGPTAG_TRUST
Definition: rpmpgp.h:63
PGPHASHALGO_SHA384
@ PGPHASHALGO_SHA384
Definition: rpmpgp.h:272
pgpPktSigV3_s
Definition: rpmpgp.h:314
pgpPktPre_u::ldata
pgpPktLdata ldata
Definition: rpmpgp.h:910
pgpDigGetParams
pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype)
pgpPktKeyV3
struct pgpPktKeyV3_s * pgpPktKeyV3
rpmDigestBundleAdd
int rpmDigestBundleAdd(rpmDigestBundle bundle, int algo, rpmDigestFlags flags)
PGPSIGTYPE_TIMESTAMP
@ PGPSIGTYPE_TIMESTAMP
Definition: rpmpgp.h:140
pgpCleanDig
void pgpCleanDig(pgpDig dig)
rpmRC
enum rpmRC_e rpmRC
pgpPrtPkts
int pgpPrtPkts(const uint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
pgpPktPubkey_s::keyid
pgpKeyID_t keyid
Definition: rpmpgp.h:112
pgpHexStr
char * pgpHexStr(const uint8_t *p, size_t plen)
PGPCURVE_BRAINPOOL_P256R1
@ PGPCURVE_BRAINPOOL_P256R1
Definition: rpmpgp.h:287
PGPTAG_SECRET_SUBKEY
@ PGPTAG_SECRET_SUBKEY
Definition: rpmpgp.h:58
PGPSUBTYPE_REVOCABLE
@ PGPSUBTYPE_REVOCABLE
Definition: rpmpgp.h:427
PGPSUBTYPE_NOTATION
@ PGPSUBTYPE_NOTATION
Definition: rpmpgp.h:433
pgpPktCdata_s::data
uint8_t data[1]
Definition: rpmpgp.h:774
PGPTAG_LITERAL_DATA
@ PGPTAG_LITERAL_DATA
Definition: rpmpgp.h:62
PGPSYMKEYALGO_TRIPLE_DES
@ PGPSYMKEYALGO_TRIPLE_DES
Definition: rpmpgp.h:207
pgpPktCdata
struct pgpPktCdata_s pgpPktCdata
PGPSIGTYPE_KEY_REVOKE
@ PGPSIGTYPE_KEY_REVOKE
Definition: rpmpgp.h:137
PGPPUBKEYALGO_RSA_ENCRYPT
@ PGPPUBKEYALGO_RSA_ENCRYPT
Definition: rpmpgp.h:169
pgpPktPre_u::cdata
pgpPktCdata cdata
Definition: rpmpgp.h:907
PGPSUBTYPE_PRIMARY_USERID
@ PGPSUBTYPE_PRIMARY_USERID
Definition: rpmpgp.h:438
pgpPktLdata_s::filename
uint8_t filename[1]
Definition: rpmpgp.h:865
pgpDigParamsCmp
int pgpDigParamsCmp(pgpDigParams p1, pgpDigParams p2)
pgpPktPubkey_s
Definition: rpmpgp.h:110
pgpTag_e
pgpTag_e
Definition: rpmpgp.h:50
pgpPktLdata_s::format
uint8_t format
Definition: rpmpgp.h:863
pgpReadPkts
pgpArmor pgpReadPkts(const char *fn, uint8_t **pkt, size_t *pktlen)
PGPVAL_ARMORKEY
@ PGPVAL_ARMORKEY
Definition: rpmpgp.h:949
pgpPktKey_u::v4
struct pgpPktKeyV4_s v4
Definition: rpmpgp.h:745
rpmDigestBundleFree
rpmDigestBundle rpmDigestBundleFree(rpmDigestBundle bundle)
PGPSUBTYPE_SIG_CREATE_TIME
@ PGPSUBTYPE_SIG_CREATE_TIME
Definition: rpmpgp.h:422
pgpPktSigV3_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:321
PGPARMOR_ERR_BODY_DECODE
@ PGPARMOR_ERR_BODY_DECODE
Definition: rpmpgp.h:919
pgpValString
const char * pgpValString(pgpValType type, uint8_t val)
PGPSIGTYPE_CERT_REVOKE
@ PGPSIGTYPE_CERT_REVOKE
Definition: rpmpgp.h:139
rpmDigestFlags
rpmFlags rpmDigestFlags
Definition: rpmpgp.h:966
pgpPktKeyV3_s::time
pgpTime_t time
Definition: rpmpgp.h:632
PGPSUBTYPE_EMBEDDED_SIG
@ PGPSUBTYPE_EMBEDDED_SIG
Definition: rpmpgp.h:444
PGPPUBKEYALGO_ELGAMAL
@ PGPPUBKEYALGO_ELGAMAL
Definition: rpmpgp.h:175
pgpPktKeyV3_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:634
PGPTAG_SYMMETRIC_DATA
@ PGPTAG_SYMMETRIC_DATA
Definition: rpmpgp.h:60
PGPSUBTYPE_INTERNAL_100
@ PGPSUBTYPE_INTERNAL_100
Definition: rpmpgp.h:446
PGPTAG_COMMENT
@ PGPTAG_COMMENT
Definition: rpmpgp.h:71
PGPVAL_SUBTYPE
@ PGPVAL_SUBTYPE
Definition: rpmpgp.h:951
rpmDigestBundleDupCtx
DIGEST_CTX rpmDigestBundleDupCtx(rpmDigestBundle bundle, int id)
PGPPUBKEYALGO_RSA
@ PGPPUBKEYALGO_RSA
Definition: rpmpgp.h:168
PGPARMORKEY_MESSAGEID
@ PGPARMORKEY_MESSAGEID
Definition: rpmpgp.h:941
pgpPktUid
struct pgpPktUid_s pgpPktUid
PGPSUBTYPE_INTERNAL_108
@ PGPSUBTYPE_INTERNAL_108
Definition: rpmpgp.h:454
RPMDIGEST_NONE
@ RPMDIGEST_NONE
Definition: rpmpgp.h:963
pgpPktPre_u
Definition: rpmpgp.h:901
PGPSUBTYPE_FEATURES
@ PGPSUBTYPE_FEATURES
Definition: rpmpgp.h:443
PGPSUBTYPE_INTERNAL_103
@ PGPSUBTYPE_INTERNAL_103
Definition: rpmpgp.h:449
PGPTAG_PHOTOID
@ PGPTAG_PHOTOID
Definition: rpmpgp.h:67
PGPARMOR_ERR_NO_END_PGP
@ PGPARMOR_ERR_NO_END_PGP
Definition: rpmpgp.h:921
pgpPktKeyV3_s::version
uint8_t version
Definition: rpmpgp.h:631
rpmDigestBundle
struct rpmDigestBundle_s * rpmDigestBundle
Definition: rpmpgp.h:30
pgpPktTrust
struct pgpPktTrust_s pgpPktTrust
pgpIdentItem
char * pgpIdentItem(pgpDigParams digp)
PGPARMOR_SECKEY
@ PGPARMOR_SECKEY
Definition: rpmpgp.h:933
pgpPktKeyV4_s::time
pgpTime_t time
Definition: rpmpgp.h:675
pgpCompressAlgo_e
pgpCompressAlgo_e
Definition: rpmpgp.h:234
PGPSUBTYPE_INTERNAL_106
@ PGPSUBTYPE_INTERNAL_106
Definition: rpmpgp.h:452
PGPSYMKEYALGO_CAST5
@ PGPSYMKEYALGO_CAST5
Definition: rpmpgp.h:208
PGPARMORKEY_HASH
@ PGPARMORKEY_HASH
Definition: rpmpgp.h:942
pgpPktUid_s::userid
uint8_t userid[1]
Definition: rpmpgp.h:896
PGPSUBTYPE_REGEX
@ PGPSUBTYPE_REGEX
Definition: rpmpgp.h:426
pgpPktPubkey_s::version
uint8_t version
Definition: rpmpgp.h:111
pgpPktSigV3_s::signid
pgpKeyID_t signid
Definition: rpmpgp.h:319
pgpPubkeyKeyID
int pgpPubkeyKeyID(const uint8_t *pkt, size_t pktlen, pgpKeyID_t keyid)
PGPTAG_COMMENT_OLD
@ PGPTAG_COMMENT_OLD
Definition: rpmpgp.h:66
PGPSYMKEYALGO_AES_192
@ PGPSYMKEYALGO_AES_192
Definition: rpmpgp.h:213
pgpPktKey_u
Definition: rpmpgp.h:743
rpmInitCrypto
int rpmInitCrypto(void)
PGPPUBKEYALGO_RSA_SIGN
@ PGPPUBKEYALGO_RSA_SIGN
Definition: rpmpgp.h:170
PGPSUBTYPE_ISSUER_KEYID
@ PGPSUBTYPE_ISSUER_KEYID
Definition: rpmpgp.h:432
PGPARMOR_NONE
@ PGPARMOR_NONE
Definition: rpmpgp.h:926
rpmDigestBundleNew
rpmDigestBundle rpmDigestBundleNew(void)
pgpPktKeyV4_s::pubkey_algo
uint8_t pubkey_algo
Definition: rpmpgp.h:676
PGPTAG_COMPRESSED_DATA
@ PGPTAG_COMPRESSED_DATA
Definition: rpmpgp.h:59
pgpPktOnepass_s::nested
uint8_t nested
Definition: rpmpgp.h:555
PGPARMOR_SIGNED_MESSAGE
@ PGPARMOR_SIGNED_MESSAGE
Definition: rpmpgp.h:930
pgpPktOnepass_s
Definition: rpmpgp.h:549
PGPTAG_MDC
@ PGPTAG_MDC
Definition: rpmpgp.h:69
PGPARMOR_ERR_UNKNOWN_PREAMBLE_TAG
@ PGPARMOR_ERR_UNKNOWN_PREAMBLE_TAG
Definition: rpmpgp.h:922
PGPSYMKEYALGO_DES_SK
@ PGPSYMKEYALGO_DES_SK
Definition: rpmpgp.h:211
pgpPktSigV4_s::hashlen
uint8_t hashlen[2]
Definition: rpmpgp.h:351
PGPSUBTYPE_TRUST_SIG
@ PGPSUBTYPE_TRUST_SIG
Definition: rpmpgp.h:425
pgpPktSigV3_s::signhash16
uint8_t signhash16[2]
Definition: rpmpgp.h:322
PGPVAL_HASHALGO
@ PGPVAL_HASHALGO
Definition: rpmpgp.h:955
pgpSubType_e
pgpSubType_e
Definition: rpmpgp.h:420
PGPCOMPRESSALGO_ZLIB
@ PGPCOMPRESSALGO_ZLIB
Definition: rpmpgp.h:237
pgpPktSigV3_s::hashlen
uint8_t hashlen
Definition: rpmpgp.h:316
pgpPktKeyV4
struct pgpPktKeyV4_s * pgpPktKeyV4
pgpPktPre_u::uid
pgpPktUid uid
Definition: rpmpgp.h:912
PGPTAG_ENCRYPTED_MDC
@ PGPTAG_ENCRYPTED_MDC
Definition: rpmpgp.h:68
PGPSIGTYPE_PERSONA_CERT
@ PGPSIGTYPE_PERSONA_CERT
Definition: rpmpgp.h:129
pgpCurveId_e
pgpCurveId_e
Definition: rpmpgp.h:283
pgpPktEdata
struct pgpPktEdata_s pgpPktEdata
pgpValType
enum pgpValType_e pgpValType
pgpArmorWrap
char * pgpArmorWrap(int atype, const unsigned char *s, size_t ns)
PGPSUBTYPE_INTERNAL_104
@ PGPSUBTYPE_INTERNAL_104
Definition: rpmpgp.h:450
PGPSUBTYPE_INTERNAL_105
@ PGPSUBTYPE_INTERNAL_105
Definition: rpmpgp.h:451
PGPVAL_SERVERPREFS
@ PGPVAL_SERVERPREFS
Definition: rpmpgp.h:956
PGPVAL_COMPRESSALGO
@ PGPVAL_COMPRESSALGO
Definition: rpmpgp.h:954
pgpPktSigV3_s::version
uint8_t version
Definition: rpmpgp.h:315
pgpPktSymkey_s
5.3.
Definition: rpmpgp.h:514
rpmDigestInit
DIGEST_CTX rpmDigestInit(int hashalgo, rpmDigestFlags flags)
PGPCURVE_BRAINPOOL_P512R1
@ PGPCURVE_BRAINPOOL_P512R1
Definition: rpmpgp.h:288
PGPPUBKEYALGO_DSA
@ PGPPUBKEYALGO_DSA
Definition: rpmpgp.h:172
PGPSYMKEYALGO_AES_256
@ PGPSYMKEYALGO_AES_256
Definition: rpmpgp.h:214
PGPSIGTYPE_SUBKEY_BINDING
@ PGPSIGTYPE_SUBKEY_BINDING
Definition: rpmpgp.h:135
PGPHASHALGO_TIGER192
@ PGPHASHALGO_TIGER192
Definition: rpmpgp.h:269
pgpValType_e
pgpValType_e
Definition: rpmpgp.h:946
PGPSIGTYPE_SUBKEY_REVOKE
@ PGPSIGTYPE_SUBKEY_REVOKE
Definition: rpmpgp.h:138
PGPTAG_SYMMETRIC_SESSION_KEY
@ PGPTAG_SYMMETRIC_SESSION_KEY
Definition: rpmpgp.h:54
pgpPktSig_u::v3
struct pgpPktSigV3_s v3
Definition: rpmpgp.h:482
pgpPktSymkey_s::version
uint8_t version
Definition: rpmpgp.h:515
pgpPktSigV4_s::hash_algo
uint8_t hash_algo
Definition: rpmpgp.h:350
PGPTAG_MARKER
@ PGPTAG_MARKER
Definition: rpmpgp.h:61
pgpHashAlgo
enum pgpHashAlgo_e pgpHashAlgo
pgpPktSymkey_s::s2k
uint8_t s2k[1]
Definition: rpmpgp.h:517
pgpSymkeyAlgo
enum pgpSymkeyAlgo_e pgpSymkeyAlgo
pgpSigType
enum pgpSigType_e pgpSigType
pgpPktKeyV4_s
Definition: rpmpgp.h:673
pgpPktTrust_s
Definition: rpmpgp.h:881
pgpFreeDig
pgpDig pgpFreeDig(pgpDig dig)
pgpDig
struct pgpDig_s * pgpDig
Definition: rpmpgp.h:34
PGPSIGTYPE_TEXT
@ PGPSIGTYPE_TEXT
Definition: rpmpgp.h:125
pgpVerifySignature
rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
PGPSUBTYPE_REVOKE_KEY
@ PGPSUBTYPE_REVOKE_KEY
Definition: rpmpgp.h:431
pgpPktLdata_s
Definition: rpmpgp.h:862
pgpDigParamsFree
pgpDigParams pgpDigParamsFree(pgpDigParams digp)
PGPSIGTYPE_STANDALONE
@ PGPSIGTYPE_STANDALONE
Definition: rpmpgp.h:126
rpmDigestFlags_e
rpmDigestFlags_e
Definition: rpmpgp.h:962
PGPSIGTYPE_BINARY
@ PGPSIGTYPE_BINARY
Definition: rpmpgp.h:124
PGPSUBTYPE_KEY_EXPIRE_TIME
@ PGPSUBTYPE_KEY_EXPIRE_TIME
Definition: rpmpgp.h:428
PGPCURVE_NIST_P_384
@ PGPCURVE_NIST_P_384
Definition: rpmpgp.h:285
pgpPktKey_u::v3
struct pgpPktKeyV3_s v3
Definition: rpmpgp.h:744
PGPCURVE_NIST_P_521
@ PGPCURVE_NIST_P_521
Definition: rpmpgp.h:286
rpmDigestBundleUpdate
int rpmDigestBundleUpdate(rpmDigestBundle bundle, const void *data, size_t len)
PGPTAG_PUBLIC_SESSION_KEY
@ PGPTAG_PUBLIC_SESSION_KEY
Definition: rpmpgp.h:52
PGPCOMPRESSALGO_BZIP2
@ PGPCOMPRESSALGO_BZIP2
Definition: rpmpgp.h:238
pgpSigType_e
pgpSigType_e
Definition: rpmpgp.h:123
pgpPktSymkey
struct pgpPktSymkey_s pgpPktSymkey
5.3.
rpmDigestBundleFinal
int rpmDigestBundleFinal(rpmDigestBundle bundle, int id, void **datap, size_t *lenp, int asAscii)
pgpTime_t
uint8_t pgpTime_t[4]
Definition: rpmpgp.h:41
pgpGrab
static unsigned int pgpGrab(const uint8_t *s, size_t nbytes)
Definition: rpmpgp.h:983
pgpPktLdata
struct pgpPktLdata_s pgpPktLdata
pgpPktPre_u::sig
pgpPktSig sig
Definition: rpmpgp.h:903
pgpDigParams
struct pgpDigParams_s * pgpDigParams
Definition: rpmpgp.h:38
pgpPktEdata_s::data
uint8_t data[1]
Definition: rpmpgp.h:812
PGPSIGTYPE_CASUAL_CERT
@ PGPSIGTYPE_CASUAL_CERT
Definition: rpmpgp.h:131
pgpPktSig
union pgpPktSig_u * pgpPktSig
PGPARMOR_ERR_CRC_CHECK
@ PGPARMOR_ERR_CRC_CHECK
Definition: rpmpgp.h:918
PGPSUBTYPE_INTERNAL_101
@ PGPSUBTYPE_INTERNAL_101
Definition: rpmpgp.h:447
PGPHASHALGO_MD2
@ PGPHASHALGO_MD2
Definition: rpmpgp.h:268
pgpPktKeyV3_s::valid
uint8_t valid[2]
Definition: rpmpgp.h:633
PGPARMOR_ERR_CRC_DECODE
@ PGPARMOR_ERR_CRC_DECODE
Definition: rpmpgp.h:920
PGPSUBTYPE_NONE
@ PGPSUBTYPE_NONE
Definition: rpmpgp.h:421
pgpArmor_e
pgpArmor_e
Definition: rpmpgp.h:917
PGPTAG_SIGNATURE
@ PGPTAG_SIGNATURE
Definition: rpmpgp.h:53
pgpPktEdata_s
Definition: rpmpgp.h:811
PGPHASHALGO_SHA224
@ PGPHASHALGO_SHA224
Definition: rpmpgp.h:274
PGPSYMKEYALGO_NOENCRYPT
@ PGPSYMKEYALGO_NOENCRYPT
Definition: rpmpgp.h:216
pgpPktSigV3_s::time
pgpTime_t time
Definition: rpmpgp.h:318
PGPCURVE_NIST_P_256
@ PGPCURVE_NIST_P_256
Definition: rpmpgp.h:284
PGPARMOR_ERR_UNKNOWN_ARMOR_TYPE
@ PGPARMOR_ERR_UNKNOWN_ARMOR_TYPE
Definition: rpmpgp.h:923
PGPSYMKEYALGO_TWOFISH
@ PGPSYMKEYALGO_TWOFISH
Definition: rpmpgp.h:215
pgpPktOnepass_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:551
PGPSUBTYPE_PREFER_COMPRESS
@ PGPSUBTYPE_PREFER_COMPRESS
Definition: rpmpgp.h:435
PGPARMOR_PUBKEY
@ PGPARMOR_PUBKEY
Definition: rpmpgp.h:928
pgpPktSigV4
struct pgpPktSigV4_s * pgpPktSigV4
PGPSUBTYPE_KEYSERVER_PREFERS
@ PGPSUBTYPE_KEYSERVER_PREFERS
Definition: rpmpgp.h:436
pgpPktSigV3_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:317
PGPSUBTYPE_REVOKE_REASON
@ PGPSUBTYPE_REVOKE_REASON
Definition: rpmpgp.h:442
DIGEST_CTX
struct DIGEST_CTX_s * DIGEST_CTX
Definition: rpmpgp.h:29
PGPHASHALGO_RIPEMD160
@ PGPHASHALGO_RIPEMD160
Definition: rpmpgp.h:267
pgpPktPubkey_s::algo
uint8_t algo
Definition: rpmpgp.h:113
pgpPrtParamsSubkeys
int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, pgpDigParams mainkey, pgpDigParams **subkeys, int *subkeysCount)
pgpPubkeyAlgo
enum pgpPubkeyAlgo_e pgpPubkeyAlgo
pgpTag
enum pgpTag_e pgpTag
pgpPktPre_u::key
pgpPktKey key
Definition: rpmpgp.h:906
PGPSUBTYPE_ARR
@ PGPSUBTYPE_ARR
Definition: rpmpgp.h:429
rpmDigestUpdate
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
pgpPktOnepass
struct pgpPktOnepass_s * pgpPktOnepass
rpmDigestDup
DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
PGPARMOR_ERR_NO_BEGIN_PGP
@ PGPARMOR_ERR_NO_BEGIN_PGP
Definition: rpmpgp.h:924
pgpPktSigV4_s::sigtype
uint8_t sigtype
Definition: rpmpgp.h:348
PGPCOMPRESSALGO_NONE
@ PGPCOMPRESSALGO_NONE
Definition: rpmpgp.h:235
PGPSUBTYPE_INTERNAL_109
@ PGPSUBTYPE_INTERNAL_109
Definition: rpmpgp.h:455
PGPVAL_ARMORBLOCK
@ PGPVAL_ARMORBLOCK
Definition: rpmpgp.h:948
PGPSUBTYPE_POLICY_URL
@ PGPSUBTYPE_POLICY_URL
Definition: rpmpgp.h:439
PGPSUBTYPE_EXPORTABLE_CERT
@ PGPSUBTYPE_EXPORTABLE_CERT
Definition: rpmpgp.h:424
PGPSUBTYPE_KEY_FLAGS
@ PGPSUBTYPE_KEY_FLAGS
Definition: rpmpgp.h:440
pgpPktPubkey
struct pgpPktPubkey_s pgpPktPubkey