Bundle Protocol Security (RFC 9172) - authentication and encryption for DTN
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.

+40 -18
+33 -18
README.md
··· 22 22 23 23 ## Installation 24 24 25 + Install with opam: 26 + 27 + ```sh 28 + $ opam install bpsec 25 29 ``` 26 - opam install bpsec 30 + 31 + If opam cannot find the package, it may not yet be released in the public 32 + `opam-repository`. Add the overlay repository, then install it: 33 + 34 + ```sh 35 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 36 + $ opam update 37 + $ opam install bpsec 27 38 ``` 28 39 29 40 ## Usage 30 41 31 42 ```ocaml 43 + let key = String.make 32 '\x42' 44 + 32 45 (* Create a Block Integrity Block *) 33 - let key = String.make 32 '\x42' in 34 - let bib = Bpsec.bib 35 - ~key 36 - ~source:(Bundle.Ipn (1L, 1L)) 37 - ~targets:[1] 38 - ~target_data:["payload data"] 39 - () 46 + let bib = 47 + Bpsec.bib 48 + ~key 49 + ~source:(Bundle.Ipn (1L, 1L)) 50 + ~targets:[1] 51 + ~target_data:["payload data"] 52 + () 40 53 41 54 (* Verify integrity *) 42 - let valid = Bpsec.verify_bib ~key bib ~target_data:["payload data"] 55 + let _valid = Bpsec.verify_bib ~key bib ~target_data:["payload data"] 43 56 44 57 (* Create a Block Confidentiality Block *) 45 - let bcb, encrypted = Bpsec.bcb 46 - ~key 47 - ~source:(Bundle.Ipn (1L, 1L)) 48 - ~targets:[1] 49 - ~target_data:["secret payload"] 50 - () 58 + let bcb, encrypted = 59 + Bpsec.bcb 60 + ~key 61 + ~source:(Bundle.Ipn (1L, 1L)) 62 + ~targets:[1] 63 + ~target_data:["secret payload"] 64 + () 51 65 52 66 (* Decrypt *) 53 - match Bpsec.decrypt_bcb ~key bcb ~ciphertext:[encrypted] with 54 - | Some [plaintext] -> (* ... *) 55 - | _ -> (* decryption failed *) 67 + let () = 68 + match Bpsec.decrypt_bcb ~key bcb ~ciphertext:[encrypted] with 69 + | Some [_plaintext] -> () 70 + | _ -> () 56 71 ``` 57 72 58 73 ## Related Work
+1
bpsec.opam
··· 22 22 "fmt" 23 23 "alcotest" {with-test} 24 24 "alcobar" {with-test} 25 + "mdx" {with-test} 25 26 "loc" 26 27 "odoc" {with-doc} 27 28 ]
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries bpsec bundle))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name bpsec) 4 5 ··· 31 32 fmt 32 33 (alcotest :with-test) 33 34 (alcobar :with-test) 35 + (mdx :with-test) 34 36 loc))