diff options
Diffstat (limited to 'src/plop.erl')
-rw-r--r-- | src/plop.erl | 9 |
1 files changed, 4 insertions, 5 deletions
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). |