Skip to content

Commit

Permalink
bump: x509 - turns out the ~sloppy keys werent sloppy
Browse files Browse the repository at this point in the history
From
ocaml/opam-repository@cf51d08 :
* BREAKING Remove `~sloppy` from Private_key.decode_{pem,der}. The seemingly
  bad RSA keys were valid and should have been accepted by mirage-crypto.
  (mirleft/ocaml-x509#142 by @psafont)
  • Loading branch information
actionshrimp committed Sep 17, 2021
1 parent 11c04c2 commit a75b753
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion gcloud.opam
Expand Up @@ -24,6 +24,6 @@ depends: [
"ppx_deriving_yojson"
"ppx_here" {test}
"ssl"
"x509" { >= "0.11.2" } # Required for the ~sloppy arg
"x509" { >= "0.12.0" } # Required for the ~sloppy:true arg becoming the default
"yojson"
]
4 changes: 0 additions & 4 deletions src/auth.ml
Expand Up @@ -315,10 +315,6 @@ let access_token_of_credentials
let now = Unix.time () in
Cstruct.of_string c.private_key
|> X509.Private_key.decode_pem
(* Some Gcloud RSA private keys have an invalid [d]. [sloppy:true]
will re-create the key from the primes [e], [p] and [q] if that is
the case. *)
~sloppy:true
|> CCResult.map_err (function `Msg msg -> `Bad_credentials_priv_key msg)
|> Lwt.return
>>= fun (`RSA priv_key) ->
Expand Down

0 comments on commit a75b753

Please sign in to comment.