SRP-6a Secure Remote Password protocol for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+28 -12
+21 -12
README.md
··· 5 5 6 6 ## Installation 7 7 8 + Install with opam: 9 + 10 + ```sh 11 + $ opam install srp 8 12 ``` 9 - opam install srp 13 + 14 + If opam cannot find the package, it may not yet be released in the public 15 + `opam-repository`. Add the overlay repository, then install it: 16 + 17 + ```sh 18 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 19 + $ opam update 20 + $ opam install srp 10 21 ``` 11 22 12 23 ## Usage ··· 15 26 16 27 ```ocaml 17 28 (* Server stores verifier, not the password *) 18 - let salt = (* random 16+ bytes *) in 29 + let salt = "" 19 30 let verifier = 20 31 Srp.compute_verifier ~salt ~username:"alice" ~password:"secret" 21 32 ``` ··· 23 34 ### Client authentication 24 35 25 36 ```ocaml 26 - (* Client side: generate A and ephemeral key *) 27 - let client = Srp.Client.v ~username:"alice" ~password:"secret" in 28 - let a_pub = Srp.Client.public client in 29 - (* Send (username, A) to server *) 37 + (* Client side: generate A and ephemeral key; send (username, A) to server *) 38 + let client = Srp.Client.v ~username:"alice" ~password:"secret" 39 + let a_pub = Srp.Client.public client 30 40 31 - (* Server receives (username, A), looks up salt+verifier *) 32 - let server = Srp.Server.v ~verifier in 33 - let b_pub = Srp.Server.public server in 34 - (* Send (salt, B) to client *) 41 + (* Server receives (username, A), looks up salt+verifier; sends (salt, B) *) 42 + let server = Srp.Server.v ~verifier 43 + let b_pub = Srp.Server.public server 35 44 36 - (* Both derive shared session key *) 37 - let client_key = Srp.Client.session_key client ~salt ~b_pub in 45 + (* Both derive the shared session key *) 46 + let client_key = Srp.Client.session_key client ~salt ~b_pub 38 47 let server_key = Srp.Server.session_key server ~username:"alice" ~a_pub 39 48 ``` 40 49
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries srp))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name srp) 4 5 ··· 21 22 (digestif (>= 1.2.0)) 22 23 (crypto-rng (>= 1.0.0)) 23 24 (alcotest :with-test) 25 + (mdx :with-test) 24 26 (alcobar :with-test)))
+1
srp.opam
··· 15 15 "digestif" {>= "1.2.0"} 16 16 "crypto-rng" {>= "1.0.0"} 17 17 "alcotest" {with-test} 18 + "mdx" {with-test} 18 19 "alcobar" {with-test} 19 20 "odoc" {with-doc} 20 21 ]