diff --git a/include/rpm/rpmkeyring.h b/include/rpm/rpmkeyring.h index cfcbe59342..7da8febe84 100644 --- a/include/rpm/rpmkeyring.h +++ b/include/rpm/rpmkeyring.h @@ -134,6 +134,15 @@ rpmPubkey rpmPubkeyFree(rpmPubkey key); */ rpmPubkey rpmPubkeyLink(rpmPubkey key); + +/** \ingroup rpmkeyring + * Return pubkey as raw bytes + * @param key Pubkey + * @param pkt key data + * @param pktlen Length of key data + */ +void rpmPubkeyRawData(rpmPubkey key, unsigned const char ** pkt, size_t * pktlen); + /** \ingroup rpmkeyring * Return base64 encoding of pubkey * @param key Pubkey diff --git a/rpmio/rpmkeyring.cc b/rpmio/rpmkeyring.cc index 4b872869c7..4e08e97f76 100644 --- a/rpmio/rpmkeyring.cc +++ b/rpmio/rpmkeyring.cc @@ -366,6 +366,17 @@ rpmPubkey rpmPubkeyLink(rpmPubkey key) return key; } +void rpmPubkeyRawData(rpmPubkey key, unsigned const char ** pkt, size_t * pktlen) +{ + if (key) { + *pkt = key->pkt.data(); + *pktlen = key->pkt.size(); + } else { + *pkt = NULL; + *pktlen = 0; + } +} + char * rpmPubkeyBase64(rpmPubkey key) { char *enc = NULL;