rpm 4.19.92
The RPM Package Manager
|
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 |
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) |
OpenPGP constants and structures from RFC-2440.
#define PGP_KEYID_LEN 8 |
The length (in bytes) of a binary (not hex encoded) key ID.
typedef enum pgpCompressAlgo_e pgpCompressAlgo |
9.3. Compression Algorithms
typedef enum pgpCurveId_e pgpCurveId |
ECC Curves
The following curve ids are private to rpm. PGP uses oids to identify a curve.
typedef enum pgpHashAlgo_e pgpHashAlgo |
9.4. Hash Algorithms
typedef enum pgpPubkeyAlgo_e pgpPubkeyAlgo |
9.1. Public Key Algorithms
typedef enum pgpSigType_e pgpSigType |
5.2.1. Signature Types
typedef enum pgpSubType_e pgpSubType |
5.2.3.1. Signature Subpacket Specification
typedef enum pgpSymkeyAlgo_e pgpSymkeyAlgo |
9.2. Symmetric Key Algorithms
enum pgpArmor_e |
enum pgpArmorKey_e |
enum pgpCompressAlgo_e |
enum pgpCurveId_e |
ECC Curves
The following curve ids are private to rpm. PGP uses oids to identify a curve.
enum pgpHashAlgo_e |
enum pgpPubkeyAlgo_e |
9.1. Public Key Algorithms
enum pgpSigType_e |
5.2.1. Signature Types
enum pgpSubType_e |
5.2.3.1. Signature Subpacket Specification
enum pgpSymkeyAlgo_e |
9.2. Symmetric Key Algorithms
enum pgpTag_e |
4.3. Packet Tags
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 |
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
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
uint32_t pgpDigParamsCreationTime | ( | pgpDigParams | digp | ) |
Retrieve the object's creation time.
param digp parameter container return seconds since the UNIX Epoch.
pgpDigParams pgpDigParamsFree | ( | pgpDigParams | digp | ) |
Destroy parsed OpenPGP packet parameter(s).
digp | parameter container |
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.
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.
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
char * pgpIdentItem | ( | pgpDigParams | digp | ) |
Return a string identification of a PGP signature/pubkey.
digp | signature/pubkey container |
pgpArmor pgpParsePkts | ( | const char * | armor, |
uint8_t ** | pkt, | ||
size_t * | pktlen | ||
) |
Parse the OpenPGP packets from one ASCII-armored block in memory.
armor | armored OpenPGP packet string | |
[out] | pkt | dearmored OpenPGP packet(s) (malloced) |
[out] | pktlen | dearmored OpenPGP packet(s) length in bytes |
int pgpPrtParams | ( | const uint8_t * | pkts, |
size_t | pktlen, | ||
unsigned int | pkttype, | ||
pgpDigParams * | ret | ||
) |
Parse a OpenPGP packet(s).
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) |
int pgpPrtParams2 | ( | const uint8_t * | pkts, |
size_t | pktlen, | ||
unsigned int | pkttype, | ||
pgpDigParams * | ret, | ||
char ** | lints | ||
) |
Parse a OpenPGP packet(s).
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 |
int pgpPrtParamsSubkeys | ( | const uint8_t * | pkts, |
size_t | pktlen, | ||
pgpDigParams | mainkey, | ||
pgpDigParams ** | subkeys, | ||
int * | subkeysCount | ||
) |
Parse signing capable subkeys from OpenPGP packet(s).
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 |
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.
pkts | pointer to a buffer with certificates |
pktslen | length of the buffer with certificates |
certlen | length of the first certificate in the buffer |
int pgpPubkeyFingerprint | ( | const uint8_t * | pkt, |
size_t | pktlen, | ||
uint8_t ** | fp, | ||
size_t * | fplen | ||
) |
Calculate OpenPGP public key fingerprint.
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 |
int pgpPubkeyKeyID | ( | const uint8_t * | pkt, |
size_t | pktlen, | ||
pgpKeyID_t | keyid | ||
) |
Calculate OpenPGP public key Key ID
pkt | OpenPGP packet (i.e. PGPTAG_PUBLIC_KEY) | |
pktlen | OpenPGP packet length (no. of bytes) | |
[out] | keyid | public key Key ID |
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.
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. |
pgpArmor pgpReadPkts | ( | const char * | fn, |
uint8_t ** | pkt, | ||
size_t * | pktlen | ||
) |
Parse the OpenPGP packets from one ASCII-armored block in a file.
fn | file name | |
[out] | pkt | dearmored OpenPGP packet(s) (malloced) |
[out] | pktlen | dearmored OpenPGP packet(s) length in bytes |
int pgpSignatureType | ( | pgpDigParams | sig | ) |
Return the type of a PGP signature. If sig
is NULL, or is not a signature, returns -1.
sig | signature |
const char * pgpValString | ( | pgpValType | type, |
uint8_t | val | ||
) |
Return string representation of am OpenPGP value.
type | type of value |
val | byte value to lookup |
rpmRC pgpVerifySignature | ( | pgpDigParams | key, |
pgpDigParams | sig, | ||
DIGEST_CTX | hashctx | ||
) |
Verify a PGP signature.
key | public key |
sig | signature |
hashctx | digest context |
rpmRC pgpVerifySignature2 | ( | pgpDigParams | key, |
pgpDigParams | sig, | ||
DIGEST_CTX | hashctx, | ||
char ** | lints | ||
) |
Verify a PGP signature and return a error message or lint.
key | public key |
sig | signature |
hashctx | digest context |
lints | error messages and lints |