NAME

Crypt::Bear::EC::PublicKey - An EC public key in BearSSL

VERSION

version 0.002

SYNOPSIS

if ($public_key->ecdsa_verify('sha256', $hash, $signature)) {
    say "Success!";
}

my $shared = $private_key->ecdh_key_exchange($public_key);

DESCRIPTION

This represents a elliptic curve public key. The curve type can be one of the following:

  • 'sect163k1'

  • 'sect163r1'

  • 'sect163r2'

  • 'sect193r1'

  • 'sect193r2'

  • 'sect233k1'

  • 'sect233r1'

  • 'sect239k1'

  • 'sect283k1'

  • 'sect283r1'

  • 'sect409k1'

  • 'sect409r1'

  • 'sect571k1'

  • 'sect571r1'

  • 'secp160k1'

  • 'secp160r1'

  • 'secp160r2'

  • 'secp192k1'

  • 'secp192r1'

  • 'secp224k1'

  • 'secp224r1'

  • 'secp256k1'

  • 'secp256r1'

  • 'secp384r1'

  • 'secp521r1'

  • 'brainpoolP256r1'

  • 'brainpoolP384r1'

  • 'brainpoolP512r1'

  • 'curve25519'

  • 'curve448'

Common values include 'curve25519', 'curve448', 'secp256r1', 'secp384r1', 'secp521r1'.

METHODS

new($curve, $point)

This returns a new public key representing the given $point on $curve.

ecdsa_verify($hash_type, $hash_value, $signature)

This verifies a $signature as returned by ecdsa_sign. The $hash_value must be the hash you computer yourself over the data.

curve()

This returns the curve of this public key.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.