rpm: OpenPGP API.

rpm 4.20.0 The RPM Package Manager

Loading...
Searching...
No Matches
Files | Macros | Typedefs | Enumerations | Functions
OpenPGP API.

OpenPGP constants and structures from RFC-2440. More...

## Files
file | rpmpgp.h

## Macros
#define | PGP_KEYID_LEN 8

## Typedefs
typedef struct pgpDigParams_s * | pgpDigParams
typedef enum pgpTag_e | pgpTag
typedef enum pgpSigType_e | pgpSigType
typedef enum pgpPubkeyAlgo_e | pgpPubkeyAlgo
typedef enum pgpSymkeyAlgo_e | pgpSymkeyAlgo
typedef enum pgpCompressAlgo_e | pgpCompressAlgo
typedef enum pgpHashAlgo_e | pgpHashAlgo
typedef enum pgpCurveId_e | pgpCurveId
typedef enum pgpSubType_e | pgpSubType
typedef enum pgpArmor_e | pgpArmor
typedef enum pgpArmorKey_e | pgpArmorKey

## Enumerations
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 }
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_PRIMARY_BINDING = 0x19 , PGPSIGTYPE_SIGNED_KEY = 0x1F , PGPSIGTYPE_KEY_REVOKE = 0x20 , PGPSIGTYPE_SUBKEY_REVOKE = 0x28 , PGPSIGTYPE_CERT_REVOKE = 0x30 , PGPSIGTYPE_TIMESTAMP = 0x40 }
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_EDDSA = 22 }
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 }
enum | pgpCompressAlgo_e { PGPCOMPRESSALGO_NONE = 0 , PGPCOMPRESSALGO_ZIP = 1 , PGPCOMPRESSALGO_ZLIB = 2 , PGPCOMPRESSALGO_BZIP2 = 3 }
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 }
enum | pgpCurveId_e { PGPCURVE_NIST_P_256 = 1 , PGPCURVE_NIST_P_384 = 2 , PGPCURVE_NIST_P_521 = 3 , PGPCURVE_BRAINPOOL_P256R1 = 4 , PGPCURVE_BRAINPOOL_P512R1 = 5 , PGPCURVE_ED25519 = 6 , PGPCURVE_CURVE25519 = 7 }
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_ISSUER_FINGERPRINT = 33 , 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 }
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 , 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 }
enum | pgpArmorKey_e { PGPARMORKEY_VERSION = 1 , PGPARMORKEY_COMMENT = 2 , PGPARMORKEY_MESSAGEID = 3 , PGPARMORKEY_HASH = 4 , PGPARMORKEY_CHARSET = 5 }

## Functions
const char * | pgpValString (pgpValType type, uint8_t val)
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 | pgpPrtParams2 (const uint8_t *pkts, size_t pktlen, unsigned int pkttype, pgpDigParams *ret, char **lints)
int | pgpPrtParamsSubkeys (const uint8_t *pkts, size_t pktlen, pgpDigParams mainkey, pgpDigParams **subkeys, int *subkeysCount)
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)
rpmRC | pgpPubKeyLint (const uint8_t *pkts, size_t pktslen, char **explanation)
char * | pgpArmorWrap (int atype, const unsigned char *s, size_t ns)
int | pgpDigParamsCmp (pgpDigParams p1, pgpDigParams p2)
unsigned int | pgpDigParamsAlgo (pgpDigParams digp, unsigned int algotype)
const uint8_t * | pgpDigParamsSignID (pgpDigParams digp)
const char * | pgpDigParamsUserID (pgpDigParams digp)
int | pgpDigParamsVersion (pgpDigParams digp)
uint32_t | pgpDigParamsCreationTime (pgpDigParams digp)
pgpDigParams | pgpDigParamsFree (pgpDigParams digp)
rpmRC | pgpVerifySignature (pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
rpmRC | pgpVerifySignature2 (pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx, char **lints)
int | pgpSignatureType (pgpDigParams sig)
char * | pgpIdentItem (pgpDigParams digp)

## Detailed Description

OpenPGP constants and structures from RFC-2440.

## Macro Definition Documentation

## ◆ PGP_KEYID_LEN

#define PGP_KEYID_LEN 8

The length (in bytes) of a binary (not hex encoded) key ID.

## Typedef Documentation

## ◆ pgpCompressAlgo

typedef enum pgpCompressAlgo_e pgpCompressAlgo

9.3. Compression Algorithms

## ◆ pgpCurveId

typedef enum pgpCurveId_e pgpCurveId

ECC Curves

The following curve ids are private to rpm. PGP uses oids to identify a curve.

## ◆ pgpHashAlgo

typedef enum pgpHashAlgo_e pgpHashAlgo

9.4. Hash Algorithms

## ◆ pgpPubkeyAlgo

typedef enum pgpPubkeyAlgo_e pgpPubkeyAlgo

9.1. Public Key Algorithms

## ◆ pgpSigType

typedef enum pgpSigType_e pgpSigType

5.2.1. Signature Types

## ◆ pgpSubType

typedef enum pgpSubType_e pgpSubType

5.2.3.1. Signature Subpacket Specification

## ◆ pgpSymkeyAlgo

typedef enum pgpSymkeyAlgo_e pgpSymkeyAlgo

9.2. Symmetric Key Algorithms

## ◆ pgpTag

typedef enum pgpTag_e pgpTag

4.3. Packet Tags

## Enumeration Type Documentation

## ◆ pgpArmor_e

enum pgpArmor_e

Enumerator
PGPARMOR_MESSAGE | MESSAGE
PGPARMOR_PUBKEY | PUBLIC KEY BLOCK
PGPARMOR_SIGNATURE | SIGNATURE
PGPARMOR_SIGNED_MESSAGE | SIGNED MESSAGE
PGPARMOR_FILE | ARMORED FILE
PGPARMOR_PRIVKEY | PRIVATE KEY BLOCK
PGPARMOR_SECKEY | SECRET KEY BLOCK

## ◆ pgpArmorKey_e

enum pgpArmorKey_e

Enumerator
PGPARMORKEY_VERSION | Version:
PGPARMORKEY_COMMENT | Comment:
PGPARMORKEY_MESSAGEID | MessageID:
PGPARMORKEY_HASH | Hash:
PGPARMORKEY_CHARSET | Charset:

## ◆ pgpCompressAlgo_e

enum pgpCompressAlgo_e

9.3. Compression Algorithms

Enumerator
PGPCOMPRESSALGO_NONE | Uncompressed
PGPCOMPRESSALGO_ZIP | ZIP
PGPCOMPRESSALGO_ZLIB | ZLIB
PGPCOMPRESSALGO_BZIP2 | BZIP2

## ◆ pgpCurveId_e

enum pgpCurveId_e

ECC Curves

The following curve ids are private to rpm. PGP uses oids to identify a curve.

Enumerator
PGPCURVE_NIST_P_256 | NIST P-256
PGPCURVE_NIST_P_384 | NIST P-384
PGPCURVE_NIST_P_521 | NIST P-521
PGPCURVE_BRAINPOOL_P256R1 | brainpoolP256r1
PGPCURVE_BRAINPOOL_P512R1 | brainpoolP512r1
PGPCURVE_ED25519 | Ed25519
PGPCURVE_CURVE25519 | Curve25519

## ◆ pgpHashAlgo_e

enum pgpHashAlgo_e

9.4. Hash Algorithms

Enumerator
PGPHASHALGO_MD5 | MD5
PGPHASHALGO_SHA1 | SHA1
PGPHASHALGO_RIPEMD160 | RIPEMD160
PGPHASHALGO_MD2 | MD2
PGPHASHALGO_TIGER192 | TIGER192
PGPHASHALGO_HAVAL_5_160 | HAVAL-5-160
PGPHASHALGO_SHA256 | SHA256
PGPHASHALGO_SHA384 | SHA384
PGPHASHALGO_SHA512 | SHA512
PGPHASHALGO_SHA224 | SHA224

## ◆ pgpPubkeyAlgo_e

enum pgpPubkeyAlgo_e

9.1. Public Key Algorithms

Enumerator
PGPPUBKEYALGO_RSA | RSA
PGPPUBKEYALGO_RSA_ENCRYPT | RSA(Encrypt-Only)
PGPPUBKEYALGO_RSA_SIGN | RSA(Sign-Only)
PGPPUBKEYALGO_ELGAMAL_ENCRYPT | Elgamal(Encrypt-Only)
PGPPUBKEYALGO_DSA | DSA
PGPPUBKEYALGO_EC | Elliptic Curve
PGPPUBKEYALGO_ECDSA | ECDSA
PGPPUBKEYALGO_ELGAMAL | Elgamal
PGPPUBKEYALGO_DH | Diffie-Hellman (X9.42)
PGPPUBKEYALGO_EDDSA | EdDSA

## ◆ pgpSigType_e

enum pgpSigType_e

5.2.1. Signature Types

Enumerator
PGPSIGTYPE_BINARY | Binary document
PGPSIGTYPE_TEXT | Canonical text document
PGPSIGTYPE_STANDALONE | Standalone
PGPSIGTYPE_GENERIC_CERT | Generic certification of a User ID & Public Key
PGPSIGTYPE_PERSONA_CERT | Persona certification of a User ID & Public Key
PGPSIGTYPE_CASUAL_CERT | Casual certification of a User ID & Public Key
PGPSIGTYPE_POSITIVE_CERT | Positive certification of a User ID & Public Key
PGPSIGTYPE_SUBKEY_BINDING | Subkey Binding
PGPSIGTYPE_PRIMARY_BINDING | Primary Binding
PGPSIGTYPE_SIGNED_KEY | Signature directly on a key
PGPSIGTYPE_KEY_REVOKE | Key revocation
PGPSIGTYPE_SUBKEY_REVOKE | Subkey revocation
PGPSIGTYPE_CERT_REVOKE | Certification revocation
PGPSIGTYPE_TIMESTAMP | Timestamp

## ◆ pgpSubType_e

enum pgpSubType_e

5.2.3.1. Signature Subpacket Specification

Enumerator
PGPSUBTYPE_NONE | none
PGPSUBTYPE_SIG_CREATE_TIME | signature creation time
PGPSUBTYPE_SIG_EXPIRE_TIME | signature expiration time
PGPSUBTYPE_EXPORTABLE_CERT | exportable certification
PGPSUBTYPE_TRUST_SIG | trust signature
PGPSUBTYPE_REGEX | regular expression
PGPSUBTYPE_REVOCABLE | revocable
PGPSUBTYPE_KEY_EXPIRE_TIME | key expiration time
PGPSUBTYPE_ARR | additional recipient request
PGPSUBTYPE_PREFER_SYMKEY | preferred symmetric algorithms
PGPSUBTYPE_REVOKE_KEY | revocation key
PGPSUBTYPE_ISSUER_KEYID | issuer key ID
PGPSUBTYPE_NOTATION | notation data
PGPSUBTYPE_PREFER_HASH | preferred hash algorithms
PGPSUBTYPE_PREFER_COMPRESS | preferred compression algorithms
PGPSUBTYPE_KEYSERVER_PREFERS | key server preferences
PGPSUBTYPE_PREFER_KEYSERVER | preferred key server
PGPSUBTYPE_PRIMARY_USERID | primary user id
PGPSUBTYPE_POLICY_URL | policy URL
PGPSUBTYPE_KEY_FLAGS | key flags
PGPSUBTYPE_SIGNER_USERID | signer's user id
PGPSUBTYPE_REVOKE_REASON | reason for revocation
PGPSUBTYPE_FEATURES | feature flags (gpg)
PGPSUBTYPE_EMBEDDED_SIG | embedded signature (gpg)
PGPSUBTYPE_ISSUER_FINGERPRINT | issuer fingerprint
PGPSUBTYPE_INTERNAL_100 | internal or user-defined
PGPSUBTYPE_INTERNAL_101 | internal or user-defined
PGPSUBTYPE_INTERNAL_102 | internal or user-defined
PGPSUBTYPE_INTERNAL_103 | internal or user-defined
PGPSUBTYPE_INTERNAL_104 | internal or user-defined
PGPSUBTYPE_INTERNAL_105 | internal or user-defined
PGPSUBTYPE_INTERNAL_106 | internal or user-defined
PGPSUBTYPE_INTERNAL_107 | internal or user-defined
PGPSUBTYPE_INTERNAL_108 | internal or user-defined
PGPSUBTYPE_INTERNAL_109 | internal or user-defined
PGPSUBTYPE_INTERNAL_110 | internal or user-defined
PGPSUBTYPE_CRITICAL | critical subpacket marker

## ◆ pgpSymkeyAlgo_e

enum pgpSymkeyAlgo_e

9.2. Symmetric Key Algorithms

Enumerator
PGPSYMKEYALGO_PLAINTEXT | Plaintext
PGPSYMKEYALGO_IDEA | IDEA
PGPSYMKEYALGO_TRIPLE_DES | 3DES
PGPSYMKEYALGO_CAST5 | CAST5
PGPSYMKEYALGO_BLOWFISH | BLOWFISH
PGPSYMKEYALGO_SAFER | SAFER
PGPSYMKEYALGO_DES_SK | DES/SK
PGPSYMKEYALGO_AES_128 | AES(128-bit key)
PGPSYMKEYALGO_AES_192 | AES(192-bit key)
PGPSYMKEYALGO_AES_256 | AES(256-bit key)
PGPSYMKEYALGO_TWOFISH | TWOFISH(256-bit key)
PGPSYMKEYALGO_NOENCRYPT | no encryption

## ◆ pgpTag_e

enum pgpTag_e

4.3. Packet Tags

Enumerator
PGPTAG_RESERVED | Reserved/Invalid
PGPTAG_PUBLIC_SESSION_KEY | Public-Key Encrypted Session Key
PGPTAG_SIGNATURE | Signature
PGPTAG_SYMMETRIC_SESSION_KEY | Symmetric-Key Encrypted Session Key
PGPTAG_ONEPASS_SIGNATURE | One-Pass Signature
PGPTAG_SECRET_KEY | Secret Key
PGPTAG_PUBLIC_KEY | Public Key
PGPTAG_SECRET_SUBKEY | Secret Subkey
PGPTAG_COMPRESSED_DATA | Compressed Data
PGPTAG_SYMMETRIC_DATA | Symmetrically Encrypted Data
PGPTAG_MARKER | Marker
PGPTAG_LITERAL_DATA | Literal Data
PGPTAG_TRUST | Trust
PGPTAG_USER_ID | User ID
PGPTAG_PUBLIC_SUBKEY | Public Subkey
PGPTAG_COMMENT_OLD | Comment (from OpenPGP draft)
PGPTAG_PHOTOID | PGP's photo ID
PGPTAG_ENCRYPTED_MDC | Integrity protected encrypted data
PGPTAG_MDC | Manipulaion detection code packet
PGPTAG_PRIVATE_60 | Private or Experimental Values
PGPTAG_COMMENT | Comment
PGPTAG_PRIVATE_62 | Private or Experimental Values
PGPTAG_CONTROL | Control (GPG)

## Function Documentation

## ◆ pgpArmorWrap()

char * pgpArmorWrap | ( | int | atype,
|  | const unsigned char * | s,
|  | size_t | ns )

Wrap a OpenPGP packets in ascii armor for transport.

Parameters

  atype | type of armor
  s | binary pkt data
  ns | binary pkt data length

Returns
  formatted string

## ◆ pgpDigParamsAlgo()

unsigned int pgpDigParamsAlgo | ( | pgpDigParams | digp,
|  | unsigned int | algotype )

Retrieve OpenPGP algorithm parameters param digp parameter container param algotype PGPVAL_HASHALGO / PGPVAL_PUBKEYALGO return algorithm value, 0 on error

## ◆ pgpDigParamsCmp()

int pgpDigParamsCmp | ( | pgpDigParams | p1,
|  | pgpDigParams | p2 )

Compare OpenPGP packet parameters param p1 1st parameter container param p2 2nd parameter container return 1 if the parameters differ, 0 otherwise

## ◆ pgpDigParamsCreationTime()

uint32_t pgpDigParamsCreationTime | ( | pgpDigParams | digp | ) |

Retrieve the object's creation time.

param digp parameter container return seconds since the UNIX Epoch.

## ◆ pgpDigParamsFree()

pgpDigParams pgpDigParamsFree | ( | pgpDigParams | digp | ) |

Destroy parsed OpenPGP packet parameter(s).

Parameters

  digp | parameter container

Returns
  NULL always

## ◆ pgpDigParamsSignID()

const uint8_t * pgpDigParamsSignID | ( | pgpDigParams | digp | ) |

Returns the issuer or the object's Key ID.

If the object is a signature, then this returns the Key ID stored in the first Issuer subpacket as a hex string. (This is not authenticated.)

If the object is a certificate or a subkey, then this returns the key's Key ID.

The caller must not free the returned buffer.

param digp parameter container return an array of PGP_KEYID_LEN bytes. If the issuer is unknown, this returns an array with all zeros.

## ◆ pgpDigParamsUserID()

const char * pgpDigParamsUserID | ( | pgpDigParams | digp | ) |

Retrieve the primary User ID, if any.

Returns the primary User ID, if any.

If the object is a signature, then this returns NULL.

If the object is a certificate or a subkey, then this returns the certificate's primary User ID, if any.

This interface does not provide a way for the caller to recognize any embedded NUL characters.

The caller must not free the returned buffer.

param digp parameter container return a string or NULL, if there is no primary User ID.

## ◆ pgpDigParamsVersion()

int pgpDigParamsVersion | ( | pgpDigParams | digp | ) |

Retrieve the object's version.

Returns the object's version.

If the object is a signature, then this returns the version of the signature packet.

If the object is a certificate, then this returns the version of the primary key packet.

If the object is a subkey, then this returns the version of the subkey's key packet.

param digp parameter container return the object's version

## ◆ pgpIdentItem()

char * pgpIdentItem | ( | pgpDigParams | digp | ) |

Return a string identification of a PGP signature/pubkey.

Parameters

  digp | signature/pubkey container

Returns
  string describing the item and parameters

## ◆ pgpParsePkts()

pgpArmor pgpParsePkts | ( | const char * | armor,
|  | uint8_t ** | pkt,
|  | size_t * | pktlen )

Parse the OpenPGP packets from one ASCII-armored block in memory.

Parameters

  | armor | armored OpenPGP packet string
  [out] | pkt | dearmored OpenPGP packet(s) (malloced)
  [out] | pktlen | dearmored OpenPGP packet(s) length in bytes

Returns
  type of armor found

## ◆ pgpPrtParams()

int pgpPrtParams | ( | const uint8_t * | pkts,
|  | size_t | pktlen,
|  | unsigned int | pkttype,
|  | pgpDigParams * | ret )

Parse a OpenPGP packet(s).

Parameters

  | pkts | OpenPGP packet(s)
  | pktlen | OpenPGP packet(s) length (no. of bytes)
  | pkttype | Expected packet type (signature/key) or 0 for any
  [out] | ret | signature/pubkey packet parameters on success (alloced)

Returns
  -1 on error, 0 on success

## ◆ pgpPrtParams2()

int pgpPrtParams2 | ( | const uint8_t * | pkts,
|  | size_t | pktlen,
|  | unsigned int | pkttype,
|  | pgpDigParams * | ret,
|  | char ** | lints )

Parse a OpenPGP packet(s).

Parameters

  | pkts | OpenPGP packet(s)
  | pktlen | OpenPGP packet(s) length (no. of bytes)
  | pkttype | Expected packet type (signature/key) or 0 for any
  [out] | ret | signature/pubkey packet parameters on success (alloced)
  [out] | lints | error messages and lints

Returns
  -1 on error, 0 on success

## ◆ pgpPrtParamsSubkeys()

int pgpPrtParamsSubkeys | ( | const uint8_t * | pkts,
|  | size_t | pktlen,
|  | pgpDigParams | mainkey,
|  | pgpDigParams ** | subkeys,
|  | int * | subkeysCount )

Parse signing capable subkeys from OpenPGP packet(s).

Parameters

  pkts | OpenPGP packet(s)
  pktlen | OpenPGP packet(s) length (no. of bytes)
  mainkey | parameters of main key
  subkeys | array of signing capable subkey parameters (alloced)
  subkeysCount | count of subkeys

Returns
  -1 on error, 0 on success

## ◆ 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 more certificates. A public key certificate consits of packets like Public key packet, User ID packet and so on. In a buffer every certificate starts with Public key packet and it ends with the start of the next certificate or with the end of the buffer.

Parameters

  pkts | pointer to a buffer with certificates
  pktslen | length of the buffer with certificates
  certlen | length of the first certificate in the buffer

Returns
  0 on success

## ◆ pgpPubkeyFingerprint()

int pgpPubkeyFingerprint | ( | const uint8_t * | pkt,
|  | size_t | pktlen,
|  | uint8_t ** | fp,
|  | size_t * | fplen )

Calculate OpenPGP public key fingerprint.

Parameters

  | pkt | OpenPGP packet (i.e. PGPTAG_PUBLIC_KEY)
  | pktlen | OpenPGP packet length (no. of bytes)
  [out] | fp | public key fingerprint
  [out] | fplen | public key fingerprint length

Returns
  0 on success, else -1

## ◆ pgpPubkeyKeyID()

int pgpPubkeyKeyID | ( | const uint8_t * | pkt,
|  | size_t | pktlen,
|  | pgpKeyID_t | keyid )

Calculate OpenPGP public key Key ID

Parameters

  | pkt | OpenPGP packet (i.e. PGPTAG_PUBLIC_KEY)
  | pktlen | OpenPGP packet length (no. of bytes)
  [out] | keyid | public key Key ID

Returns
  0 on success, else -1

## ◆ pgpPubKeyLint()

rpmRC pgpPubKeyLint | ( | const uint8_t * | pkts,
|  | size_t | pktslen,
|  | char ** | explanation )

Lints the certificate.

There are four cases:

The packets do not describe a certificate: returns an error and sets *explanation to NULL.

The packets describe a certificate and the certificate is completely unusable: returns an error and sets *explanation to a human readable explanation.

The packets describe a certificate and some components are not usable: returns success, and sets *explanation to a human readable explanation.

The packets describe a certificate and there are no lints: returns success, and sets *explanation to NULL.

Parameters

  | pkts | OpenPGP pointer to a buffer with certificates
  | pktslen | length of the buffer with certificates
  [out] | explanation | An optional lint to display to the user.

Returns
  RPMRC_OK on success

## ◆ pgpReadPkts()

pgpArmor pgpReadPkts | ( | const char * | fn,
|  | uint8_t ** | pkt,
|  | size_t * | pktlen )

Parse the OpenPGP packets from one ASCII-armored block in a file.

Parameters

  | fn | file name
  [out] | pkt | dearmored OpenPGP packet(s) (malloced)
  [out] | pktlen | dearmored OpenPGP packet(s) length in bytes

Returns
  type of armor found

## ◆ pgpSignatureType()

int pgpSignatureType | ( | pgpDigParams | sig | ) |

Return the type of a PGP signature. If `sig` is NULL, or is not a signature, returns -1.

Parameters

  sig | signature

Returns
  type of the signature

## ◆ pgpValString()

const char * pgpValString | ( | pgpValType | type,
|  | uint8_t | val )

Return string representation of am OpenPGP value.

Parameters

  type | type of value
  val | byte value to lookup

Returns
  string value of byte

## ◆ pgpVerifySignature()

rpmRC pgpVerifySignature | ( | pgpDigParams | key,
|  | pgpDigParams | sig,
|  | DIGEST_CTX | hashctx )

Verify a PGP signature.

Parameters

  key | public key
  sig | signature
  hashctx | digest context

Returns
  RPMRC_OK on success

## ◆ pgpVerifySignature2()

rpmRC pgpVerifySignature2 | ( | pgpDigParams | key,
|  | pgpDigParams | sig,
|  | DIGEST_CTX | hashctx,
|  | char ** | lints )

Verify a PGP signature and return a error message or lint.

Parameters

  key | public key
  sig | signature
  hashctx | digest context
  lints | error messages and lints

Returns
  RPMRC_OK on success