NAME
Crypt::OpenSSL::Base::Func - Base Functions, using the OpenSSL libraries
SYNOPSIS
use Crypt::OpenSSL::Base::Func;
Methods
ecdh
z_bin = ecdh(local_priv_pem_file, peer_pub_pem_file)
aes_cmac
RFC4493: aes_cmac
mac = aes_cmac(key, plaintext, cipher_name)
my $key = pack("H*", '2b7e151628aed2a6abf7158809cf4f3c');
my $msg_1 = pack("H*", '6bc1bee22e409f96e93d7e117393172a');
my $mac_1 = aes_cmac($key, $msg_1, 'aes-128-cbc');
print unpack("H*", $mac_1), "\n";
#$ echo -n '6bc1bee22e409f96e93d7e117393172a' | xxd -r -p | openssl dgst -mac cmac -macopt cipher:aes-128-cbc -macopt hexkey:2b7e151628aed2a6abf7158809cf4f3c
#(stdin)= 070a16b46b4d4144f79bdd9dd04a287c
PKCS12_key_gen
RFC7292 : PKCS12_key_gen
see also openssl/crypto/pkcs12/p12_key.c
PKCS12_key_gen(password, salt_hexstr, id, iteration, outlen, digest_name)
my $macdata_key = PKCS12_key_gen('123456', pack("H*", 'e241f01650dbeae4'), 3, 2048, 32, 'sha256');
print unpack("H*", $macdata_key), "\n";
PKCS5_PBKDF2_HMAC
RFC2898 : PBKDF2
see also openssl/crypto/evp/p5_crpt2.c
PKCS5_PBKDF2_HMAC(password, salt, iteration, digest_name, outlen)
my $pbkdf2_key = PKCS5_PBKDF2_HMAC('123456', pack("H*", 'b698314b0d68bcbd'), 2048, 'sha256', 32);
print unpack("H*", $pbkdf2_key), "\n";
bn_mod_sqrt
see also openssl/crypto/bn/bn_sqrt.c
s = bn_mod_sqrt(a, p)
my $a = '04'; #hexstring
my $p = '05'; #hexstring
my $s = bn_mod_sqrt($a, $p); #hexstring
print $s, "\n";
#03
evp_pkey_from_point_hex
my $ec_pkey_pub = evp_pkey_from_point_hex($ec_group, $ec_point_hex, $bn_ctx);
evp_pkey_from_priv_hex
my $ec_pkey_priv = evp_pkey_from_priv_hex($ec_group, $ec_priv_hex);
pem_write_evp_pkey
my $ret = pem_write_evp_pkey($dst_fname, $evp_pkey, $is_priv);
pem_read_pkey
my $evp_pkey = pem_read_pkey($key_file, $is_priv);
ecdh_pkey
my $z = ecdh_pkey($pkey_priv, $pkey_peer_pub);
generate_ec_key
my $ec_key_hash_ref = generate_ec_key( $group, $priv_bn, $point_compress_t, $ctx );
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 92:
=over is the last thing in the document?!