From 8ca2b519859e9ed2284f596a907b63ba615bb7c5 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Thu, 25 Sep 2014 17:02:03 +0200 Subject: Use correct LogID. --- src/plop.erl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plop.erl b/src/plop.erl index b549616..d9daf8d 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -81,10 +81,7 @@ init([PrivKeyfile, PubKeyfile]) -> %% LogID = crypto:hash(sha256, %% public_key:der_encode('RSAPublicKey', Public_key)), %% Read EC keypair. - {Private_key, Public_key} = read_keyfiles_ec(PrivKeyfile, PubKeyfile), - LogID = crypto:hash(sha256, public_key:der_encode( - 'ECPoint', - element(2, element(1, Public_key)))), % FIXME! + {Private_key, Public_key, LogID} = read_keyfiles_ec(PrivKeyfile, PubKeyfile), _Tree = ht:reset_tree([db:size() - 1]), {ok, #state{pubkey = Public_key, privkey = Private_key, @@ -297,7 +294,9 @@ read_keyfiles_ec(PrivkeyFile, Pubkeyfile) -> Point = #'ECPoint'{point = Octets}, Publickey = {Point, Params}, - {Privatekey, Publickey}. + KeyID = crypto:hash(sha256, AlgoDer), + + {Privatekey, Publickey, KeyID}. decode_key(Entry) -> public_key:pem_entry_decode(Entry). -- cgit v1.1