# RPM keyring API.

## Files
file | rpmkeyring.h
## Functions
rpmKeyring | rpmKeyringNew (void)
| Create a new, empty keyring.
rpmKeyring | rpmKeyringFree (rpmKeyring keyring)
| Free keyring and the keys within it.
int | rpmKeyringAddKey (rpmKeyring keyring, rpmPubkey key)
| Add a public key to keyring.
rpmRC | rpmKeyringLookup (rpmKeyring keyring, pgpDig sig)
| Perform keyring lookup for a key matching a signature.
rpmKeyring | rpmKeyringLink (rpmKeyring keyring)
| Reference a keyring.
rpmKeyring | rpmKeyringUnlink (rpmKeyring keyring)
| Unreference a keyring.
rpmPubkey | rpmPubkeyNew (const uint8_t *pkt, size_t pktlen)
| Create a new rpmPubkey from OpenPGP packet.
rpmPubkey | rpmPubkeyRead (const char *filename)
| Create a new rpmPubkey from ASCII-armored pubkey file.
rpmPubkey | rpmPubkeyFree (rpmPubkey key)
| Free a pubkey.
rpmPubkey | rpmPubkeyLink (rpmPubkey key)
| Reference a pubkey.
rpmPubkey | rpmPubkeyUnlink (rpmPubkey key)
| Unreference a pubkey.
pgpDig | rpmPubkeyDig (rpmPubkey key)
| Parse OpenPGP pubkey parameters.
char * | rpmPubkeyBase64 (rpmPubkey key)
| Return base64 encoding of pubkey.

## Function Documentation

int rpmKeyringAddKey | ( | rpmKeyring | keyring,
|  | rpmPubkey | key |
| ) |  |  |

Add a public key to keyring.

Parameters:

  | keyring | keyring handle
  | key | pubkey handle

Returns:
  0 on success, -1 on error, 1 if key already present

rpmKeyring rpmKeyringFree | ( | rpmKeyring | keyring | ) |

Free keyring and the keys within it.

Returns:
  NULL always

rpmKeyring rpmKeyringLink | ( | rpmKeyring | keyring | ) |

Reference a keyring.

Parameters:

  | keyring | keyring handle

Returns:
  new keyring reference

rpmRC rpmKeyringLookup | ( | rpmKeyring | keyring,
|  | pgpDig | sig |
| ) |  |  |

Perform keyring lookup for a key matching a signature.

Parameters:

  | keyring | keyring handle
  | sig | OpenPGP packet container of signature

Returns:
  RPMRC_OK if found, RPMRC_NOKEY otherwise

rpmKeyring rpmKeyringNew | ( | void |  | ) |

Create a new, empty keyring.

Returns:
  new keyring handle

rpmKeyring rpmKeyringUnlink | ( | rpmKeyring | keyring | ) |

Unreference a keyring.

Parameters:

  | keyring | keyring handle

Returns:
  NULL always

char* rpmPubkeyBase64 | ( | rpmPubkey | key | ) |

Return base64 encoding of pubkey.

Parameters:

  | key | Pubkey

Returns:
  base64 encoded pubkey (malloced), NULL on error

pgpDig rpmPubkeyDig | ( | rpmPubkey | key | ) |

Parse OpenPGP pubkey parameters.

Parameters:

  | key | Pubkey

Returns:
  parsed output of pubkey packet parameters

rpmPubkey rpmPubkeyFree | ( | rpmPubkey | key | ) |

Free a pubkey.

Parameters:

  | key | Pubkey to free

Returns:
  NULL always

rpmPubkey rpmPubkeyLink | ( | rpmPubkey | key | ) |

Reference a pubkey.

Parameters:

  | key | Pubkey

Returns:
  new pubkey reference

rpmPubkey rpmPubkeyNew | ( | const uint8_t * | pkt,
|  | size_t | pktlen |
| ) |  |  |

Create a new rpmPubkey from OpenPGP packet.

Parameters:

  | pkt | OpenPGP packet data
  | pktlen | Data length

Returns:
  new pubkey handle

rpmPubkey rpmPubkeyRead | ( | const char * | filename | ) |

Create a new rpmPubkey from ASCII-armored pubkey file.

Parameters:

  | filename | Path to pubkey file

Returns:
  new pubkey handle

rpmPubkey rpmPubkeyUnlink | ( | rpmPubkey | key | ) |

Unreference a pubkey.

Parameters:

  | key | Pubkey

Returns:
  NULL always