Codebase list libcryptx-perl / 6461c78
ECC - export_key_jwk_thumbprint (incomplete) Karel Miko 7 years ago
1 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
99
1010 use Carp;
1111 use CryptX qw(_encode_json _decode_json);
12 use Crypt::Digest 'digest_data';
12 use Crypt::Digest qw(digest_data digest_data_b64u);
1313 use Crypt::Misc qw(read_rawfile encode_b64u decode_b64u encode_b64 decode_b64 pem_to_der der_to_pem);
1414 use Crypt::PK;
1515
473473 };
474474 return $wanthash ? $hash : _encode_json($hash);
475475 }
476 }
477
478 sub export_key_jwk_thumbprint {
479 my $self = shift;
480 my $h = $self->export_key_jwk('public', 1);
481 my $json = _encode_json({crv=>$h->{crv}, kty=>$h->{kty}, x=>$h->{x}, y=>$h->{y}});
482 return digest_data_b64u('SHA256', $json);
476483 }
477484
478485 sub import_key {