Skip to content

Commit

Permalink
[backend] BSPGP: support pk2userid to get the user id of a pubkey
Browse files Browse the repository at this point in the history
We'll need this to generate a cert from the project pubkey.
  • Loading branch information
mlschroe committed Nov 14, 2018
1 parent 9a4bd7a commit 9f26f31
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/backend/BSPGP.pm
Expand Up @@ -108,6 +108,18 @@ sub pk2times {
return $d;
}

sub pk2userid {
my ($pk) = @_;
my ($tag, $pack);
($tag, $pack, $pk) = pkdecodepacket($pk);
die("not a public key\n") unless $tag == 6;
while ($pk ne '') {
($tag, $pack, $pk) = pkdecodepacket($pk);
return $pack if $tag == 13;
}
return undef;
}

sub pk2expire {
my ($pk) = @_;
my $d = pk2times($pk) || {};
Expand Down

0 comments on commit 9f26f31

Please sign in to comment.