# SIGNATURE.

## Files

file | rpmlib.h
file | signature.c
file | signature.h
| Generate and verify signatures.

file | digest.c
file | rpmpgp.c
| Routines to handle RFC-2440 detached signatures.

## RPMK

enum | rpmtagSignature { RPMSIGTAG_SIZE = 1000, RPMSIGTAG_LEMD5_1 = 1001, RPMSIGTAG_PGP = 1002, RPMSIGTAG_LEMD5_2 = 1003, RPMSIGTAG_MD5 = 1004, RPMSIGTAG_GPG = 1005, RPMSIGTAG_PGP5 = 1006 }
| Tags found in signature header from package. More...
enum | rpmVerifySignatureReturn_e { RPMSIG_OK = 0, RPMSIG_UNKNOWN = 1, RPMSIG_BAD = 2, RPMSIG_NOKEY = 3, RPMSIG_NOTTRUSTED = 4 }
| Return codes from verifySignature(). More...
typedef enum rpmVerifySignatureReturn_e | rpmVerifySignatureReturn
| Return codes from verifySignature().
rpmVerifySignatureReturn | rpmVerifySignature (const char *file, int_32 sigTag, const void *sig, int count, char *result)
| Verify a signature from a package.
Header | rpmFreeSignature (Header h)
| Destroy signature header from package.

## Typedefs

typedef enum sigType_e | sigType
| Signature types stored in rpm lead.
typedef enum pgpVersion_e | pgpVersion
| Identify PGP versions.

## Enumerations

enum | sigType_e { RPMSIGTYPE_NONE = 0, RPMSIGTYPE_PGP262_1024 = 1, RPMSIGTYPE_BAD = 2, RPMSIGTYPE_MD5 = 3, RPMSIGTYPE_MD5_PGP = 4, RPMSIGTYPE_HEADERSIG = 5, RPMSIGTYPE_DISABLE = 6 }
| Signature types stored in rpm lead. More...
enum | pgpVersion_e { PGP_NOTDETECTED = -1, PGP_UNKNOWN = 0, PGP_2 = 2, PGP_5 = 5 }
| Identify PGP versions. More...

## Functions

Header | rpmNewSignature (void)
| Return new, empty (signature) header instance.
rpmRC | rpmReadSignature (FD_t fd, Header *headerp, sigType sig_type)
| Read (and verify header+archive size) signature header.
int | rpmWriteSignature (FD_t fd, Header h)
| Write signature header.
int | rpmAddSignature (Header h, const char *file, int_32 sigTag, const char *passPhrase)
| Generate a signature of data in file, insert in header.
int | rpmLookupSignatureType (int action)
| Return type of signature in effect for building.
char * | rpmGetPassPhrase (const char *prompt, const int sigTag)
| Read a pass phrase from the user.
const char * | rpmDetectPGPVersion (pgpVersion *pgpVer)
| Return path to pgp executable of given type, or NULL when not found.

## Typedef Documentation

typedef enum pgpVersion_e pgpVersion

Identify PGP versions.

Note:
  Greater than 0 is a valid PGP version.

typedef enum rpmVerifySignatureReturn_e rpmVerifySignatureReturn

Return codes from verifySignature().

typedef enum sigType_e sigType

Signature types stored in rpm lead.

## Enumeration Type Documentation

enum pgpVersion_e

Identify PGP versions.

Note:
  Greater than 0 is a valid PGP version.

Enumerator:

  PGP_NOTDETECTED |
  PGP_UNKNOWN |
  PGP_2 |
  PGP_5 |

Definition at line 30 of file signature.h.

enum rpmtagSignature

Tags found in signature header from package.

Enumerator:

  RPMSIGTAG_SIZE | Header+Payload size in bytes.
  RPMSIGTAG_LEMD5_1 | Broken MD5, take 1
  RPMSIGTAG_PGP | PGP 2.6.3 signature.
  RPMSIGTAG_LEMD5_2 | Broken MD5, take 2
  RPMSIGTAG_MD5 | MD5 signature.
  RPMSIGTAG_GPG | GnuPG signature.

  RPMSIGTAG_PGP5

  PGP5 signature
  Deprecated:
    legacy.

Definition at line 1739 of file rpmlib.h.

enum rpmVerifySignatureReturn_e

Return codes from verifySignature().

Enumerator:

  RPMSIG_OK | Signature is OK.
  RPMSIG_UNKNOWN | Signature is unknown.
  RPMSIG_BAD | Signature does not verify.
  RPMSIG_NOKEY | Key is unavailable.
  RPMSIG_NOTTRUSTED | Signature is OK, but key is not trusted.

Definition at line 1753 of file rpmlib.h.

enum sigType_e

Signature types stored in rpm lead.

Enumerator:

  RPMSIGTYPE_NONE | unused, legacy.
  RPMSIGTYPE_PGP262_1024 | unused, legacy.
  RPMSIGTYPE_BAD | Unknown signature type.
  RPMSIGTYPE_MD5 | unused, legacy.
  RPMSIGTYPE_MD5_PGP | unused, legacy.
  RPMSIGTYPE_HEADERSIG | Header style signature
  RPMSIGTYPE_DISABLE | Disable verification (debugging only)

Definition at line 14 of file signature.h.

## Function Documentation

int rpmAddSignature | ( | Header | h,
|  | const char * | file,
|  | int_32 | sigTag,
|  | const char * | passPhrase |
| ) |  |  |

Generate a signature of data in file, insert in header.

Definition at line 446 of file signature.c.

const char* rpmDetectPGPVersion | ( | pgpVersion * | pgpVer | ) |

Return path to pgp executable of given type, or NULL when not found.

Definition at line 72 of file signature.c.

Header rpmFreeSignature | ( | Header | h | ) |

Destroy signature header from package.

Parameters:

  | h | signature header

Returns:
  NULL always

Definition at line 240 of file signature.c.

char* rpmGetPassPhrase | ( | const char * | prompt,
|  | const int | sigTag |
| ) |  |  |

Read a pass phrase from the user.

Definition at line 875 of file signature.c.

int rpmLookupSignatureType | ( | int | action | ) |

Return type of signature in effect for building.

Definition at line 35 of file signature.c.

Header rpmNewSignature | ( | void |  | ) |

Return new, empty (signature) header instance.

Returns:
  signature header

Definition at line 234 of file signature.c.

rpmRC rpmReadSignature | ( | FD_t | fd,
|  | Header * | headerp,
|  | sigType | sig_type |
| ) |  |  |

Read (and verify header+archive size) signature header.

If an old-style signature is found, we emulate a new style one.

Parameters:

  | fd | file handle

Return values:

  | headerp | address of (signature) header (or NULL)

Parameters:

  | sig_type | type of signature header to read (from lead)

Returns:
  rpmRC return code

Definition at line 144 of file signature.c.

rpmVerifySignatureReturn rpmVerifySignature | ( | const char * | file,
|  | int_32 | sigTag,
|  | const void * | sig,
|  | int | count,
|  | char * | result |
| ) |  |  |

Verify a signature from a package.

Parameters:

  | file | file name of header+payload
  | sigTag | type of signature
  | sig | signature itself
  | count | no. of bytes in signature

Return values:

  | result | detailed text result of signature verification

Returns:
  result of signature verification

Definition at line 922 of file signature.c.

int rpmWriteSignature | ( | FD_t | fd,
|  | Header | h |
| ) |  |  |

Write signature header.

Parameters:

  | fd | file handle
  | h | (signature) header

Returns:
  0 on success, 1 on error

Definition at line 214 of file signature.c.