diff options
-rw-r--r-- | src/v1.erl | 4 | ||||
-rw-r--r-- | src/x509.erl | 6 |
2 files changed, 9 insertions, 1 deletions
@@ -25,8 +25,12 @@ Roots = catlfish:known_roots(), case x509:normalise_chain(Roots, [LeafCert|CertChain]) of {ok, [Leaf | Chain]} -> + io:format("[info] adding ~p~n", + [x509:cert_string(LeafCert)]), catlfish:add_chain(Leaf, Chain); {Err, Msg} -> + io:format("[info] rejecting ~p: ~p~n", + [x509:cert_string(LeafCert), Err]), html("add-chain: ", [Msg, Err]) end; Invalid -> diff --git a/src/x509.erl b/src/x509.erl index 8b1211d..9b6b386 100644 --- a/src/x509.erl +++ b/src/x509.erl @@ -2,7 +2,7 @@ %%% See LICENSE for licensing information. -module(x509). --export([normalise_chain/2]). +-export([normalise_chain/2, cert_string/1]). -include_lib("public_key/include/public_key.hrl"). @@ -84,6 +84,10 @@ public_key(#'OTPCertificate'{ subjectPublicKey = Key}}}) -> Key. +cert_string(Der) -> + lists:flatten([io_lib:format("~2.16.0B", [X]) || + X <- binary_to_list(crypto:hash(sha, Der))]). + %%%%%%%%%%%%%%%%%%%% %% Precertificates according to draft-ietf-trans-rfc6962-bis-04. |