Skip to content

Commit

Permalink
adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Aug 5, 2024
1 parent e508731 commit d483d5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 7 additions & 4 deletions lib/ca_certs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ let ( let* ) = Result.bind
let windows_trust_anchors () =
let* anchors = get_anchors () in
let cert_list =
List.fold_left (fun acc cert ->
List.fold_left
(fun acc cert ->
match X509.Certificate.decode_der cert with
| Ok cert -> cert :: acc
| Error `Msg msg ->
Log.warn (fun m -> m "ignoring certificate: %s" msg);
acc)
| Error (`Msg msg) ->
Log.warn (fun m -> m "Failed to decode a trust anchor: %s" msg);
Log.debug (fun m ->
m "Full certificate:@.%a" (Ohex.pp_hexdump ()) cert);
acc)
[] anchors
in
Ok (X509.Certificate.encode_pem_multiple cert_list)
Expand Down
10 changes: 5 additions & 5 deletions test/tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,8 @@ let () =
Logs.set_level ~all:true (Some Logs.Debug);
match ta () with
| Ok tas ->
Alcotest.run "verification tests"
[ ("X509 certificate validation", tests tas) ]
| Error `Msg msg ->
Logs.err (fun m -> m "error %s in ta()" msg);
exit 1
Alcotest.run "verification tests"
[ ("X509 certificate validation", tests tas) ]
| Error (`Msg msg) ->
Logs.err (fun m -> m "error %s in ta()" msg);
exit 1

0 comments on commit d483d5c

Please sign in to comment.