diff options
author | Ingela Anderton Andin <[email protected]> | 2018-08-14 15:55:32 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2018-08-14 15:55:32 +0200 |
commit | 9ccd5b239b885f9ebb16a519d6878932e42782dc (patch) | |
tree | 703a700bdf98676ee6943f1d80b22f0acf4fddde /lib/ssl/src/ssl_pkix_db.erl | |
parent | 054c8fc92724672f0fdff486b80a4356347762d4 (diff) | |
parent | f54e6b513e746344d5252c269b8bb072dd6136a3 (diff) | |
download | otp-9ccd5b239b885f9ebb16a519d6878932e42782dc.tar.gz otp-9ccd5b239b885f9ebb16a519d6878932e42782dc.tar.bz2 otp-9ccd5b239b885f9ebb16a519d6878932e42782dc.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/ssl/src/ssl_pkix_db.erl')
-rw-r--r-- | lib/ssl/src/ssl_pkix_db.erl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/ssl/src/ssl_pkix_db.erl b/lib/ssl/src/ssl_pkix_db.erl index 4132733ae0..e7e4af942a 100644 --- a/lib/ssl/src/ssl_pkix_db.erl +++ b/lib/ssl/src/ssl_pkix_db.erl @@ -158,7 +158,7 @@ extract_trusted_certs(File) -> {error, {badmatch, Error}} end. --spec decode_pem_file(binary()) -> {ok, term()}. +-spec decode_pem_file(binary()) -> {ok, term()} | {error, term()}. decode_pem_file(File) -> case file:read_file(File) of {ok, PemBin} -> @@ -317,11 +317,16 @@ decode_certs(Ref, Cert) -> end. new_trusted_cert_entry(File, [CertsDb, RefsDb, _ | _]) -> - Ref = make_ref(), - init_ref_db(Ref, File, RefsDb), - {ok, Content} = ssl_pem_cache:insert(File), - add_certs_from_pem(Content, Ref, CertsDb), - {ok, Ref}. + case decode_pem_file(File) of + {ok, Content} -> + Ref = make_ref(), + init_ref_db(Ref, File, RefsDb), + ok = ssl_pem_cache:insert(File, Content), + add_certs_from_pem(Content, Ref, CertsDb), + {ok, Ref}; + Error -> + Error + end. add_crls([_,_,_, {_, Mapping} | _], ?NO_DIST_POINT, CRLs) -> [add_crls(CRL, Mapping) || CRL <- CRLs]; |