Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key_id_hex() and key_id_hex_short() #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/Crypt/OpenPGP/Certificate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ sub key_id {

sub key_id_hex { uc unpack 'H*', $_[0]->key_id }

sub key_id_hex_short { uc substr( unpack( 'H*', $_[0]->key_id ), -8, 8) }

sub fingerprint {
my $cert = shift;
unless ($cert->{fingerprint}) {
Expand Down Expand Up @@ -504,8 +506,12 @@ Returns the key ID.

=head2 $cert->key_id_hex

Returns the key ID as a hex string.
Returns the long key ID as a hex string.

=head2 $cert->key_id_hex_short

Returns the short key ID as a hex string.

=head2 $cert->key

Returns the algorithm-specific portion of the certificate, the public
Expand Down
12 changes: 12 additions & 0 deletions lib/Crypt/OpenPGP/Signature.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ sub key_id {
$sig->{key_id};
}

sub key_id_hex { uc unpack 'H*', $_[0]->key_id }

sub key_id_hex_short { uc substr( unpack( 'H*', $_[0]->key_id ), -8, 8) }

sub timestamp {
my $sig = shift;
$sig->{version} < 4 ?
Expand Down Expand Up @@ -405,6 +409,14 @@ This is a standard OpenPGP signature.

Returns the ID of the key that created the signature.

=head2 $sig->key_id_hex

Returns the long hexadecimal ID of the key that created the signature.

=head2 $sig->key_id_hex_short

Returns the short hexadecimal ID of the key that created the signature.

=head2 $sig->timestamp

Returns the time that the signature was created in Unix epoch time (seconds
Expand Down