summaryrefslogtreecommitdiff
path: root/src/catlfish.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/catlfish.erl')
-rw-r--r--src/catlfish.erl14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl
index 5d96278..3ca190a 100644
--- a/src/catlfish.erl
+++ b/src/catlfish.erl
@@ -216,7 +216,9 @@ ders_from_pemfiles(Dir, Filenames) ->
ders_from_pemfile(Filename) ->
Pems = case (catch public_key:pem_decode(pems_from_file(Filename))) of
- {'EXIT', _} -> [];
+ {'EXIT', Reason} ->
+ lager:info("badly encoded cert in ~p: ~p", [Filename, Reason]),
+ [];
P -> P
end,
[der_from_pem(X) || X <- Pems].
@@ -225,13 +227,9 @@ ders_from_pemfile(Filename) ->
der_from_pem(Pem) ->
case Pem of
{_Type, Der, not_encrypted} ->
- case (catch public_key:pkix_decode_cert(Der, otp)) of
- {'EXIT', _} ->
- [];
- #'OTPCertificate'{} ->
- Der;
- _Unknown ->
- []
+ case x509:valid_cert_p(Der) of
+ true -> Der;
+ false -> []
end;
_ -> []
end.