Skip to content

Commit

Permalink
Add rpmPubkeyRawData()
Browse files Browse the repository at this point in the history
Don't make stuffing this into a rpmPubkey object a one-way street.
  • Loading branch information
ffesti committed Nov 27, 2024
1 parent 3938a82 commit b40aa9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/rpm/rpmkeyring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions rpmio/rpmkeyring.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b40aa9f

Please sign in to comment.