[erlang-questions] ECC public key example
Ben Hood
0x6e6562@REDACTED
Fri Jul 26 20:38:29 CEST 2013
Hi,
I'd like to verify signatures signed with ec keys generated by openssl
in Erlang.
Using R16B01 I've been able to convince the public_key module to sign
some data with an openssl generated private key thusly:
{ok, Pem} = file:read_file("ec_private_key.pem"),
[ECParameters,ECPrivateKey] = public_key:pem_decode(Pem),
PrivateKey = public_key:pem_entry_decode(ECPrivateKey),
Curve = public_key:pem_entry_decode({'EcpkParameters', Params, Enc}),
Sig = public_key:sign(Message, sha512, PrivateKey).
But when it comes to processing the public key, it is not entirely
clear how to decode it. This is where I got to:
{ok, Pem} = file:read_file("ec_public_key.pem"),
[{_,Der,_}] = public_key:pem_decode(Pem),
{_, _, {0, KeyDer}} = public_key:der_decode('SubjectPublicKeyInfo', Der),
[179,52,127,201] = public_key:der_decode('ECPoint', KeyDer)
%% This is where the story ends
I've looked through the ASN.1 types available and there doesn't seem
to be anything that resembles an ECPublicKey.
Could anybody point me to working example?
Cheers,
Ben
More information about the erlang-questions
mailing list