···66 | `P521 of Crypto_ec.P521.Dsa.priv ]
7788type t =
99- [ ecdsa
1010- | `RSA of Crypto_pk.Rsa.priv
1111- | `ED25519 of Crypto_ec.Ed25519.priv ]
99+ [ ecdsa | `RSA of Crypto_pk.Rsa.priv | `ED25519 of Crypto_ec.Ed25519.priv ]
12101311let key_type = function
1412 | `RSA _ -> `RSA
···3331let of_octets data =
3432 let open Crypto_ec in
3533 let ec_err e =
3636- Result.map_error
3737- (fun e -> `Msg (Fmt.to_to_string Crypto_ec.pp_error e))
3838- e
3434+ Result.map_error (fun e -> `Msg (Fmt.to_to_string Crypto_ec.pp_error e)) e
3935 in
4036 function
4137 | `RSA -> Error (`Msg "cannot decode an RSA key")
+3-7
lib/public_key.ml
···66 | `P521 of Crypto_ec.P521.Dsa.pub ]
7788type t =
99- [ ecdsa
1010- | `RSA of Crypto_pk.Rsa.pub
1111- | `ED25519 of Crypto_ec.Ed25519.pub ]
99+ [ ecdsa | `RSA of Crypto_pk.Rsa.pub | `ED25519 of Crypto_ec.Ed25519.pub ]
12101311module Asn_oid = Asn.OID
1412···3937 let to_err = function
4038 | Ok r -> r
4139 | Error e ->
4242- parse_error "failed to decode public EC key %a"
4343- Crypto_ec.pp_error e
4040+ parse_error "failed to decode public EC key %a" Crypto_ec.pp_error e
44414542 let reparse_pk =
4643 let open Crypto_ec in
···134131 | `RSA key, `RSA_PKCS1 ->
135132 let hashp x = x = hash in
136133 let* d = hashed hash data in
137137- ok_if_true
138138- (Crypto_pk.Rsa.PKCS1.verify ~hashp ~key ~signature (`Digest d))
134134+ ok_if_true (Crypto_pk.Rsa.PKCS1.verify ~hashp ~key ~signature (`Digest d))
139135 | `ED25519 key, `ED25519 -> begin
140136 match data with
141137 | `Message msg -> ok_if_true (Ed25519.verify ~key signature ~msg)
···182182 in
183183 match Private_key.decode_pem data with
184184 | Ok (`ED25519 k as ke)
185185- when String.equal ed25519_priv (Crypto_ec.Ed25519.priv_to_octets k)
186186- ->
185185+ when String.equal ed25519_priv (Crypto_ec.Ed25519.priv_to_octets k) ->
187186 let encoded = Private_key.encode_pem ke in
188187 if not (String.equal encoded data) then
189188 Alcotest.failf "ED25519 encoding failed"