Subject: | $eckey->get0_private_key() returns unblessed reference |
# Script fragment:
#!/usr/bin/perl
#
use 5.18.4;
use Crypt::OpenSSL::Bignum 0.04;
use Crypt::OpenSSL::EC 0.6;
my $nid = 415; # NID_X9_62_prime256v1
my $group = Crypt::OpenSSL::EC::EC_GROUP::new_by_curve_name($nid);
my $eckey = Crypt::OpenSSL::EC::EC_KEY::new() || die;
Crypt::OpenSSL::EC::EC_KEY::set_group( $eckey, $group ) || die;
Crypt::OpenSSL::EC::EC_KEY::generate_key($eckey) || die;
my $bignum = $eckey->get0_private_key(); # <---- unblessed ref
print $bignum, "\n";
my $content = $bignum->to_bin;
print unpack( 'H*', $content ), "\n";
exit;
__END__
# produces:
SCALAR(0x9402450)
Can't call method "to_bin" on unblessed reference at specimen.pl line 20.