sequoia-net-0.28.0/.cargo_vcs_info.json0000644000000001410000000000100133510ustar { "git": { "sha1": "9bba76b7f15049aec3b580b5eed337226e05b761" }, "path_in_vcs": "net" }sequoia-net-0.28.0/Cargo.lock0000644000001704740000000000100113450ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", "generic-array", ] [[package]] name = "aes" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", "cpufeatures", ] [[package]] name = "aes-gcm" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", "aes", "cipher", "ctr", "ghash", "subtle", ] [[package]] name = "aho-corasick" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] name = "android-tzdata" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] [[package]] name = "anyhow" version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "ascii-canvas" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" dependencies = [ "term", ] [[package]] name = "async-trait" version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", ] [[package]] name = "base64" version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bindgen" version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", "syn", ] [[package]] name = "bit-set" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "block-padding" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" dependencies = [ "generic-array", ] [[package]] name = "buffered-reader" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b9b0a25eb06e83579bc985d836e1e3b957a7201301b48538764d2b2e78090d4" dependencies = [ "lazy_static", "libc", ] [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] [[package]] name = "cexpr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", "windows-targets", ] [[package]] name = "cipher" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", "zeroize", ] [[package]] name = "clang-sys" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", "libloading", ] [[package]] name = "cmac" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8543454e3c3f5126effff9cd44d562af4e31fb8ce1cc0d3dcd8f084515dbc1aa" dependencies = [ "cipher", "dbl", "digest", ] [[package]] name = "const-oid" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "rand_core", "typenum", ] [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] [[package]] name = "curve25519-dalek" version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", "platforms", "rustc_version", "subtle", "zeroize", ] [[package]] name = "curve25519-dalek-derive" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "data-encoding" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "dbl" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ "generic-array", ] [[package]] name = "der" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "zeroize", ] [[package]] name = "diff" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", "subtle", ] [[package]] name = "dirs-next" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ "cfg-if", "dirs-sys-next", ] [[package]] name = "dirs-sys-next" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", "winapi", ] [[package]] name = "doc-comment" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dyn-clone" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "eax" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9954fabd903b82b9d7a68f65f97dc96dd9ad368e40ccc907a7c19d53e6bfac28" dependencies = [ "aead", "cipher", "cmac", "ctr", "subtle", ] [[package]] name = "ed25519" version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ "curve25519-dalek", "ed25519", "rand_core", "serde", "sha2", "subtle", "zeroize", ] [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "ena" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" dependencies = [ "log", ] [[package]] name = "encoding_rs" version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] [[package]] name = "endian-type" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "enum-as-inner" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", ] [[package]] name = "fastrand" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fiat-crypto" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] name = "fixedbitset" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures-channel" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", ] [[package]] name = "futures-core" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-io" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-sink" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", "futures-macro", "futures-task", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "generic-array" version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", ] [[package]] name = "getrandom" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", "libc", "wasi", "wasm-bindgen", ] [[package]] name = "ghash" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug", "polyval", ] [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", "http", "indexmap", "slab", "tokio", "tokio-util", "tracing", ] [[package]] name = "hashbrown" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hickory-client" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f3e08124cf0ddda93b1186d4af73599de401f3b52f14cd9aaa719049379462e" dependencies = [ "cfg-if", "data-encoding", "futures-channel", "futures-util", "hickory-proto", "once_cell", "radix_trie", "rand", "thiserror", "tokio", "tracing", ] [[package]] name = "hickory-proto" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" dependencies = [ "async-trait", "cfg-if", "data-encoding", "enum-as-inner", "futures-channel", "futures-io", "futures-util", "idna 0.4.0", "ipnet", "once_cell", "openssl", "rand", "thiserror", "tinyvec", "tokio", "tracing", "url", ] [[package]] name = "hickory-resolver" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" dependencies = [ "cfg-if", "futures-util", "hickory-proto", "ipconfig", "lru-cache", "once_cell", "parking_lot", "rand", "resolv-conf", "smallvec", "thiserror", "tokio", "tracing", ] [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", "winapi", ] [[package]] name = "http" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", "itoa", ] [[package]] name = "http-body" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", "pin-project-lite", ] [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", "h2", "http", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", "socket2 0.4.10", "tokio", "tower-service", "tracing", "want", ] [[package]] name = "hyper-tls" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", "hyper", "native-tls", "tokio", "tokio-native-tls", ] [[package]] name = "iana-time-zone" version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "windows-core", ] [[package]] name = "iana-time-zone-haiku" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ "cc", ] [[package]] name = "idna" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", ] [[package]] name = "idna" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", ] [[package]] name = "indexmap" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "inout" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ "block-padding", "generic-array", ] [[package]] name = "ipconfig" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ "socket2 0.5.5", "widestring", "windows-sys", "winreg", ] [[package]] name = "ipnet" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", "rustix", "windows-sys", ] [[package]] name = "itertools" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] [[package]] name = "lalrpop" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" dependencies = [ "ascii-canvas", "bit-set", "diff", "ena", "is-terminal", "itertools", "lalrpop-util", "petgraph", "regex", "regex-syntax 0.7.5", "string_cache", "term", "tiny-keccak", "unicode-xid", ] [[package]] name = "lalrpop-util" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" dependencies = [ "spin", ] [[package]] name = "lazycell" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", ] [[package]] name = "libm" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libredox" version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ "bitflags 2.4.1", "libc", "redox_syscall", ] [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", ] [[package]] name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lru-cache" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ "linked-hash-map", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "memchr" version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memsec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa0916b001582d253822171bd23f4a0229d32b9507fae236f5da8cad515ba7c" [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "mio" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", "windows-sys", ] [[package]] name = "native-tls" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", "security-framework", "security-framework-sys", "tempfile", ] [[package]] name = "nettle" version = "7.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9fdccf3eae7b161910d2daa2f0155ca35041322e8fe5c5f1f2c9d0b12356336" dependencies = [ "getrandom", "libc", "nettle-sys", "thiserror", "typenum", ] [[package]] name = "nettle-sys" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b495053a10a19a80e3a26bf1212e92e29350797b5f5bdc58268c3f3f818e66ec" dependencies = [ "bindgen", "cc", "libc", "pkg-config", "tempfile", "vcpkg", ] [[package]] name = "new_debug_unreachable" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nibble_vec" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" dependencies = [ "smallvec", ] [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "num-bigint-dig" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" dependencies = [ "byteorder", "lazy_static", "libm", "num-integer", "num-iter", "num-traits", "smallvec", ] [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", ] [[package]] name = "num-iter" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-traits" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", ] [[package]] name = "object" version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] [[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", "once_cell", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", "pkg-config", "vcpkg", ] [[package]] name = "parking_lot" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", "windows-targets", ] [[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", "indexmap", ] [[package]] name = "phf_shared" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ "siphasher", ] [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", ] [[package]] name = "pkg-config" version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" [[package]] name = "polyval" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", "universal-hash", ] [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precomputed-hash" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "radix_trie" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" dependencies = [ "endian-type", "nibble_vec", ] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "redox_syscall" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_users" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", "libredox", "thiserror", ] [[package]] name = "regex" version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax 0.8.2", ] [[package]] name = "regex-automata" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", "regex-syntax 0.8.2", ] [[package]] name = "regex-syntax" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "regex-syntax" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", "http", "http-body", "hyper", "hyper-tls", "ipnet", "js-sys", "log", "mime", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", "serde", "serde_json", "serde_urlencoded", "system-configuration", "tokio", "tokio-native-tls", "tokio-socks", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "winreg", ] [[package]] name = "resolv-conf" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", "quick-error", ] [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] [[package]] name = "rustix" version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", "windows-sys", ] [[package]] name = "rustversion" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "schannel" version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ "windows-sys", ] [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "semver" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "sequoia-net" version = "0.28.0" dependencies = [ "anyhow", "base64", "futures-util", "hickory-client", "hickory-resolver", "http", "hyper", "hyper-tls", "libc", "percent-encoding", "rand", "reqwest", "sequoia-openpgp", "tempfile", "thiserror", "tokio", "url", "z-base-32", ] [[package]] name = "sequoia-openpgp" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ea026cf8a70d331c742e3ad7e68fd405d0743ff86630fb4334a1bf8d0e194c7" dependencies = [ "aes-gcm", "anyhow", "base64", "buffered-reader", "chrono", "cipher", "dyn-clone", "eax", "ed25519", "ed25519-dalek", "getrandom", "idna 0.4.0", "lalrpop", "lalrpop-util", "lazy_static", "libc", "memsec", "nettle", "num-bigint-dig", "once_cell", "rand", "rand_core", "regex", "regex-syntax 0.8.2", "sha1collisiondetection", "thiserror", "win-crypto-ng", "winapi", "xxhash-rust", ] [[package]] name = "serde" version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", "serde", ] [[package]] name = "serde_urlencoded" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", "ryu", "serde", ] [[package]] name = "sha1collisiondetection" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31c0b86a052106b16741199985c9ec2bf501f619f70c48fa479b44b093ad9a68" dependencies = [ "digest", "generic-array", ] [[package]] name = "sha2" version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", "digest", ] [[package]] name = "shlex" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "signature" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "rand_core", ] [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", ] [[package]] name = "socket2" version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys", ] [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", ] [[package]] name = "string_cache" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", "parking_lot", "phf_shared", "precomputed-hash", ] [[package]] name = "subtle" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "system-configuration" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "tempfile" version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", "windows-sys", ] [[package]] name = "term" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" dependencies = [ "dirs-next", "rustversion", "winapi", ] [[package]] name = "thiserror" version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tiny-keccak" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ "crunchy", ] [[package]] name = "tinyvec" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] [[package]] name = "tinyvec_macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", "pin-project-lite", "socket2 0.5.5", "tokio-macros", "windows-sys", ] [[package]] name = "tokio-macros" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tokio-native-tls" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", ] [[package]] name = "tokio-socks" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" dependencies = [ "either", "futures-util", "thiserror", "tokio", ] [[package]] name = "tokio-util" version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", "tracing", ] [[package]] name = "tower-service" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tracing-core" version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] [[package]] name = "try-lock" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-xid" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ "crypto-common", "subtle", ] [[package]] name = "url" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna 0.5.0", "percent-encoding", ] [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ "try-lock", ] [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "widestring" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "win-crypto-ng" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99abfb435a71e54ab2971d8d8c32f1a7e006cdbf527f71743b1d45b93517bb92" dependencies = [ "cipher", "doc-comment", "rand_core", "winapi", "zeroize", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets", ] [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", "windows-sys", ] [[package]] name = "xxhash-rust" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" [[package]] name = "z-base-32" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80a0d98613370af88e15bd2047702d7c78c8c6aba44403eb227c8ad706871f92" [[package]] name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" sequoia-net-0.28.0/Cargo.toml0000644000000052400000000000100113540ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.67" name = "sequoia-net" version = "0.28.0" authors = [ "Justus Winter ", "Kai Michaelis ", "Neal H. Walfield ", ] description = "Network services for OpenPGP" homepage = "https://sequoia-pgp.org/" documentation = "https://docs.rs/sequoia-net" readme = "README.md" keywords = [ "cryptography", "openpgp", "pgp", "hkp", "keyserver", ] categories = [ "cryptography", "authentication", "email", ] license = "LGPL-2.0-or-later" repository = "https://gitlab.com/sequoia-pgp/sequoia" [package.metadata.docs.rs] features = ["sequoia-openpgp/default"] [lib] bench = false [dependencies.anyhow] version = "1.0.18" [dependencies.base64] version = "0.21" [dependencies.futures-util] version = "0.3.5" [dependencies.hickory-client] version = "0.24" [dependencies.hickory-resolver] version = "0.24" features = ["dnssec-openssl"] [dependencies.http] version = "0.2" [dependencies.hyper] version = "0.14.10" features = [ "http1", "http2", ] [dependencies.hyper-tls] version = "0.5" [dependencies.libc] version = "0.2.66" [dependencies.percent-encoding] version = "2.1" [dependencies.reqwest] version = "0.11" [dependencies.sequoia-openpgp] version = "1.13" default-features = false [dependencies.tempfile] version = "3.1" [dependencies.thiserror] version = "1.0.2" [dependencies.tokio] version = "1.13.1" features = ["macros"] [dependencies.url] version = "2.1" [dependencies.z-base-32] version = "0.1.2" [dev-dependencies.hyper] version = "0.14" features = ["server"] [dev-dependencies.rand] version = "0.8" features = ["getrandom"] default-features = false [dev-dependencies.reqwest] version = "0.11" features = ["socks"] [target."cfg(not(windows))".dev-dependencies.sequoia-openpgp] version = "1" features = [ "crypto-nettle", "__implicit-crypto-backend-for-tests", ] default-features = false [target."cfg(windows)".dev-dependencies.sequoia-openpgp] version = "1" features = [ "crypto-cng", "__implicit-crypto-backend-for-tests", ] default-features = false [badges.gitlab] repository = "sequoia-pgp/sequoia" [badges.maintenance] status = "actively-developed" sequoia-net-0.28.0/Cargo.toml.orig000064400000000000000000000040141046102023000150330ustar 00000000000000[package] name = "sequoia-net" description = "Network services for OpenPGP" version = "0.28.0" authors = [ "Justus Winter ", "Kai Michaelis ", "Neal H. Walfield ", ] documentation = "https://docs.rs/sequoia-net" homepage = "https://sequoia-pgp.org/" repository = "https://gitlab.com/sequoia-pgp/sequoia" readme = "README.md" keywords = ["cryptography", "openpgp", "pgp", "hkp", "keyserver"] categories = ["cryptography", "authentication", "email"] license = "LGPL-2.0-or-later" edition = "2021" rust-version = "1.67" [badges] gitlab = { repository = "sequoia-pgp/sequoia" } maintenance = { status = "actively-developed" } [dependencies] sequoia-openpgp = { path = "../openpgp", version = "1.13", default-features = false } anyhow = "1.0.18" futures-util = "0.3.5" http = "0.2" hyper = { version = "0.14.10", features = [ "http1", "http2" ] } hyper-tls = "0.5" libc = "0.2.66" percent-encoding = "2.1" reqwest = "0.11" tempfile = "3.1" thiserror = "1.0.2" url = "2.1" z-base-32 = "0.1.2" tokio = { version = "1.13.1", features = [ "macros" ] } base64 = "0.21" hickory-client = "0.24" hickory-resolver = { version = "0.24", features = ["dnssec-openssl"]} [dev-dependencies] rand = { version = "0.8", default-features = false, features = [ "getrandom" ] } hyper = { version = "0.14", features = [ "server" ] } reqwest = { version = "0.11", features = ["socks"] } [lib] bench = false # Enables a crypto backend for the tests: [target.'cfg(not(windows))'.dev-dependencies] sequoia-openpgp = { path = "../openpgp", version = "1", default-features = false, features = ["crypto-nettle", "__implicit-crypto-backend-for-tests"] } # Enables a crypto backend for the tests: [target.'cfg(windows)'.dev-dependencies] sequoia-openpgp = { path = "../openpgp", version = "1", default-features = false, features = ["crypto-cng", "__implicit-crypto-backend-for-tests"] } # Enables a crypto backend for the docs.rs generation: [package.metadata.docs.rs] features = ["sequoia-openpgp/default"] sequoia-net-0.28.0/LICENSE.txt000064400000000000000000000627341046102023000140040ustar 00000000000000Sequoia PGP is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Sequoia PGP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --- GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! sequoia-net-0.28.0/README.md000064400000000000000000000005331046102023000134250ustar 00000000000000Discovering and publishing OpenPGP certificates over the network. This crate provides access to keyservers using the [HKP] protocol, and searching and publishing [Web Key Directories]. [HKP]: https://tools.ietf.org/html/draft-shaw-openpgp-hkp-00 [Web Key Directories]: https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service sequoia-net-0.28.0/examples/dane-generate.rs000064400000000000000000000011761046102023000170350ustar 00000000000000//! Demonstrates how to generate DANE records. use std::env; use sequoia_openpgp::{ Cert, Result, parse::Parse, policy::StandardPolicy, }; use sequoia_net::dane; fn main() -> Result<()> { let domain = env::args() .nth(1).expect("Usage: dane-get "); let cert_file = env::args() .nth(2).expect("Usage: dane-get "); let p = StandardPolicy::new(); let cert = Cert::from_file(cert_file)?; let vcert = cert.with_policy(&p, None)?; for record in dane::generate(&vcert, domain, None, None)? { println!("{}", record); } Ok(()) } sequoia-net-0.28.0/examples/dane-get.rs000064400000000000000000000006501046102023000160160ustar 00000000000000//! Demonstrates how retrieve certs via DANE. use std::{ env, io, }; use sequoia_openpgp::{ Result, serialize::Serialize, }; use sequoia_net::dane; #[tokio::main] async fn main() -> Result<()> { let address = env::args() .nth(1).expect("Usage: dane-get "); for cert in dane::get(address).await? { cert?.armored().serialize(&mut io::stdout())?; } Ok(()) } sequoia-net-0.28.0/examples/hkp-get.rs000064400000000000000000000011001046102023000156600ustar 00000000000000use std::{ env, io, }; use sequoia_openpgp::{ Fingerprint, Result, serialize::Serialize, }; use sequoia_net::KeyServer; #[tokio::main] async fn main() -> Result<()> { let url = env::args() .nth(1).expect("Usage: tor-hkp-get "); let handle: Fingerprint = env::args() .nth(2).expect("Usage: tor-hkp-get ") .parse()?; let keyserver = KeyServer::new(&url)?; for cert in keyserver.get(handle).await? { cert?.armored().serialize(&mut io::stdout())?; } Ok(()) } sequoia-net-0.28.0/examples/tor-hkp-get.rs000064400000000000000000000024371046102023000165000ustar 00000000000000use std::{ env, io, time::Duration, }; use sequoia_openpgp::{ self as openpgp, Fingerprint, Result, serialize::Serialize, }; use sequoia_net::KeyServer; #[tokio::main] async fn main() -> Result<()> { let handle: Fingerprint = env::args() .nth(1).expect("Usage: tor-hkp-get ") .parse()?; // Select a fresh circuit by providing a random username/password // combination to Tor. let mut nonce = [0; 4]; openpgp::crypto::random(&mut nonce[..]); let nonce = openpgp::fmt::hex::encode(&nonce); let proxy_url = format!("socks5h://anonymous:{}@127.0.0.1:9050", nonce); // Create a reqwest::Client with appropriate timeouts for Tor, and // set the local Tor client as SOCKS5 proxy. let client = reqwest::Client::builder() .connect_timeout(Duration::new(10, 0)) .timeout(Duration::new(10, 0)) .proxy(reqwest::Proxy::all(proxy_url)?) .build()?; // Connect to keys.openpgp.org over Tor. let keyserver = KeyServer::with_client( "hkp://zkaan2xfbuxia2wpf7ofnkbz6r5zdbbvxbunvp5g2iebopbfc4iqmbad.onion", client)?; // Finally, get the requested certificate. for cert in keyserver.get(handle).await? { cert?.armored().serialize(&mut io::stdout())?; } Ok(()) } sequoia-net-0.28.0/src/dane.rs000064400000000000000000000421451046102023000142170ustar 00000000000000//! DANE protocol client. //! //! [DANE] is a protocol for retrieving and storing OpenPGP //! certificates in the DNS. //! //! [DANE]: https://datatracker.ietf.org/doc/html/rfc7929 use std::time::Duration; use base64::{Engine as _, engine::general_purpose}; use super::email::EmailAddress; use sequoia_openpgp::{ self as openpgp, fmt, Cert, Packet, parse::Parse, serialize::SerializeInto, types::{HashAlgorithm, RevocationStatus}, cert::prelude::*, }; use super::Result; use hickory_client::rr::{RData, RecordType}; use hickory_resolver::config::ResolverOpts; use hickory_resolver::TokioAsyncResolver; /// Generates a Fully Qualified Domain Name that holds the OPENPGPKEY /// record for given `local` and `domain` parameters. /// /// See: fn generate_fqdn(local: &str, domain: &str) -> Result { let mut ctx = HashAlgorithm::SHA256.context()?; ctx.update(local.as_bytes()); let mut digest = vec![0; ctx.digest_size()]; ctx.digest(&mut digest)?; Ok(format!( "{}._openpgpkey.{}", fmt::hex::encode(&digest[..28]), domain )) } /// Retrieves raw values for `OPENPGPKEY` records for User IDs with a /// given e-mail address using the [DANE] protocol. /// /// This function unconditionally validates DNSSEC records and returns /// the found certificates only on validation success. /// /// [DANE]: https://datatracker.ietf.org/doc/html/rfc7929 async fn get_raw(email_address: impl AsRef) -> Result>> { let email_address = EmailAddress::from(email_address)?; let fqdn = generate_fqdn(&email_address.local_part, &email_address.domain)?; let mut opts = ResolverOpts::default(); opts.validate = true; let resolver = TokioAsyncResolver::tokio(Default::default(), opts); let answers = resolver .lookup(fqdn, RecordType::OPENPGPKEY) .await .map_err(Error::NotFound)?; let mut bytes = vec![]; for record in answers.iter() { if let RData::OPENPGPKEY(key) = record { bytes.push(key.public_key().into()); } } Ok(bytes) } /// Retrieves certificates that contain User IDs with a given e-mail /// address using the [DANE] protocol. /// /// This function unconditionally validates DNSSEC records and returns /// the found certificates only on validation success. /// /// [DANE]: https://datatracker.ietf.org/doc/html/rfc7929 /// /// # Examples /// /// ```no_run /// # use sequoia_net::{Result, dane}; /// # use sequoia_openpgp::Cert; /// # async fn f() -> Result<()> { /// let email_address = "john@example.com"; /// let certs = dane::get(email_address).await?; /// # Ok(()) /// # } /// ``` pub async fn get(email_address: impl AsRef) -> Result>> { let mut certs = vec![]; for bytes in get_raw(email_address).await?.iter() { // Section 2 of RFC7929 says that a record may only contain a // single cert, but there may be more than one record: // // A user that wishes to specify more than one OpenPGP key, // for example, because they are transitioning to a newer // stronger key, can do so by adding multiple OPENPGPKEY // records. A single OPENPGPKEY DNS record MUST only // contain one OpenPGP key. certs.push(Cert::from_bytes(bytes)); } Ok(certs) } /// Generates a [DANE] record for the given cert in the zonefile /// format. /// /// Only user IDs with email addresses in `fqdn` are considered. /// /// If `ttl` is `None`, records are cached for three hours. /// /// We make an effort to shrink the certificate so that it fits within /// `size_target`. However, this is a best-effort mechanism, and we /// may emit larger resource records. If `size_target` is `None`, we /// try to shrink the certificates to 12k. /// /// [DANE]: https://datatracker.ietf.org/doc/html/rfc7929 pub fn generate<'a, F, T, L>(cert: &ValidCert<'a>, fqdn: F, ttl: T, size_target: L) -> Result> where F: AsRef, T: Into>, L: Into>, { generate_(cert, fqdn.as_ref(), ttl.into(), size_target.into(), false) } /// Generates a [DANE] record for the given cert in the zonefile /// format. /// /// This is like [`generate`], but uses the generic syntax for servers /// that do not support the OPENPGPKEY RRtype. /// /// Only user IDs with email addresses in `fqdn` are considered. /// /// If `ttl` is `None`, records are cached for three hours. /// /// We make an effort to shrink the certificate so that it fits within /// `size_target`. However, this is a best-effort mechanism, and we /// may emit larger resource records. If `size_target` is `None`, we /// try to shrink the certificates to 12k. /// /// [DANE]: https://datatracker.ietf.org/doc/html/rfc7929 pub fn generate_generic<'a, F, T, L>(cert: &ValidCert<'a>, fqdn: F, ttl: T, size_target: L) -> Result> where F: AsRef, T: Into>, L: Into>, { generate_(cert, fqdn.as_ref(), ttl.into(), size_target.into(), true) } fn generate_<'a>(cert: &ValidCert<'a>, fqdn: &str, ttl: Option, size_target: Option, generic: bool) -> Result> { let ttl = ttl.unwrap_or(Duration::new(3 * 60 * 60, 0)); // This is somewhat arbitrary, but Gandi doesn't like the // records being larger than 16k under base64 encoding. let size_target = size_target.unwrap_or(16384 / 4 * 3); let policy = cert.policy(); let time = cert.time(); // First, check which UserIDs are in `domain`. let mut addresses: Vec<_> = cert.userids().filter_map(|uidb| { uidb.userid().email2().unwrap_or(None) .and_then(|e| EmailAddress::from(e).ok()) .filter(|e| e.domain == fqdn) }) .collect(); // We want to emit one record per email-address, even if multiple // user IDs map to that address. addresses.sort(); addresses.dedup(); // Any? if addresses.is_empty() { return Err(openpgp::Error::InvalidArgument( format!("Cert {} does not have a User ID in {}", cert, fqdn) ).into()); } let mut records = Vec::new(); for email in addresses.into_iter() { // Create a trimmed down view of cert, following the advice in // RFC7929, Section 2.1.2. Reducing the Transferable Public // Key Size. // 1. & 2. Retain all user IDs matching the current email // address, no user attribute. let mut cert = cert.cert().clone() .retain_userids( |u| u.email2().unwrap_or(None) .and_then(|e| EmailAddress::from(e).ok()) .as_ref() == Some(&email)) .retain_user_attributes(|_| false); // 3a. Keep only alive subkeys. if cert.serialized_len() > size_target { cert = cert.retain_subkeys( |s| s.with_policy(policy, time) .map(|s| s.alive().is_ok()).unwrap_or(false)); } // 3b. For expired components, only keep the component and // revocation signatures. if cert.serialized_len() > size_target { let mut acc: Vec = Vec::new(); let vcert = cert.with_policy(policy, time)?; acc.push(vcert.primary_key().key().clone().into()); vcert.primary_key().signatures() .for_each(|s| acc.push(s.clone().into())); for uidb in vcert.userids() { acc.push(uidb.userid().clone().into()); match uidb.revocation_status() { | RevocationStatus::Revoked(revs) | RevocationStatus::CouldBe(revs) => { revs.iter() .for_each(|&s| acc.push(s.clone().into())); }, RevocationStatus::NotAsFarAsWeKnow => { uidb.signatures() .for_each(|s| acc.push(s.clone().into())); }, } } for skb in vcert.keys().subkeys() { acc.push(skb.key().clone().into()); match skb.revocation_status() { | RevocationStatus::Revoked(revs) | RevocationStatus::CouldBe(revs) => { revs.iter() .for_each(|&s| acc.push(s.clone().into())); }, RevocationStatus::NotAsFarAsWeKnow => { skb.signatures() .for_each(|s| acc.push(s.clone().into())); }, } } cert = Cert::from_packets(acc.into_iter())?; } // 4. Only keep the current binding signatures. if cert.serialized_len() > size_target { let mut acc: Vec = Vec::new(); let vcert = cert.with_policy(policy, time)?; acc.push(vcert.primary_key().key().clone().into()); acc.push(vcert.primary_key().binding_signature().clone().into()); vcert.primary_key().self_revocations() .chain(vcert.primary_key().other_revocations()) .chain(vcert.primary_key().certifications()) .for_each(|s| acc.push(s.clone().into())); for uidb in vcert.userids() { acc.push(uidb.userid().clone().into()); acc.push(uidb.binding_signature().clone().into()); uidb.self_revocations() .chain(uidb.other_revocations()) .chain(uidb.certifications()) .for_each(|s| acc.push(s.clone().into())); } for skb in vcert.keys().subkeys() { acc.push(skb.key().clone().into()); acc.push(skb.binding_signature().clone().into()); skb.self_revocations() .chain(skb.other_revocations()) .chain(skb.certifications()) .for_each(|s| acc.push(s.clone().into())); } cert = Cert::from_packets(acc.into_iter())?; } // 5. Strip third-party certifications. if cert.serialized_len() > size_target { let mut acc: Vec = Vec::new(); let vcert = cert.with_policy(policy, time)?; acc.push(vcert.primary_key().key().clone().into()); acc.push(vcert.primary_key().binding_signature().clone().into()); vcert.primary_key().self_revocations() .chain(vcert.primary_key().other_revocations()) .for_each(|s| acc.push(s.clone().into())); for uidb in vcert.userids() { acc.push(uidb.userid().clone().into()); acc.push(uidb.binding_signature().clone().into()); uidb.self_revocations() .chain(uidb.other_revocations()) .for_each(|s| acc.push(s.clone().into())); } for skb in vcert.keys().subkeys() { acc.push(skb.key().clone().into()); acc.push(skb.binding_signature().clone().into()); skb.self_revocations() .chain(skb.other_revocations()) .for_each(|s| acc.push(s.clone().into())); } cert = Cert::from_packets(acc.into_iter())?; } let bin = cert.to_vec()?; if generic { records.push(format!( "; {} => {}\n{}. {} IN TYPE61 \\# {} {}", email, cert.fingerprint(), generate_fqdn(&email.local_part, fqdn)?, ttl.as_secs(), bin.len(), openpgp::fmt::hex::encode(&bin))); } else { records.push(format!( "; {} => {}\n{}. {} IN OPENPGPKEY {}", email, cert.fingerprint(), generate_fqdn(&email.local_part, fqdn)?, ttl.as_secs(), general_purpose::STANDARD.encode(&bin))); } } Ok(records) } /// Errors for this module. #[derive(thiserror::Error, Debug)] #[non_exhaustive] pub enum Error { /// A requested cert was not found. #[error("Cert not found")] NotFound(#[from] hickory_resolver::error::ResolveError), } #[cfg(test)] mod tests { use super::*; #[test] fn test_generating_fqdn() { assert_eq!( generate_fqdn("dkg", "debian.org").unwrap(), "A47CB586A51ACB93ACB9EF806F35F29131548E59E2FACD58CF6232E3._openpgpkey.debian.org" ); } #[test] fn test_generating_fqdn_lower_case() { // Must NOT lowercase "DKG" into "dkg". // See: https://datatracker.ietf.org/doc/html/rfc7929#section-4 assert_eq!( generate_fqdn("DKG", "DEBIAN.ORG").unwrap(), "46DE800073B375157AD8F4371E2713E118E3128FB1B4321ACE452F95._openpgpkey.DEBIAN.ORG" ); } #[test] fn test_generate() -> Result<()> { let p = openpgp::policy::StandardPolicy::new(); let (cert, _) = openpgp::cert::CertBuilder::new() .add_userid("dkg ") .add_userid("dkg ") .add_transport_encryption_subkey() .generate()?; let vcert = cert.with_policy(&p, None)?; let records = generate(&vcert, "debian.org", None, None)?; assert_eq!(records.len(), 1); let record = &records[0]; eprintln!("{}", record); assert!(record.starts_with(&format!( "; dkg@debian.org => {}\n\ A47CB586A51ACB93ACB9EF806F35F29131548E59E2FACD58CF6232E3\ ._openpgpkey.debian.org. 10800 IN OPENPGPKEY ", cert.fingerprint()))); let asc = record.split(' ').last().unwrap(); let bin = general_purpose::STANDARD.decode(&asc)?; let c = Cert::from_bytes(&bin)?; assert_eq!(c.userids().count(), 1); Ok(()) } #[test] fn test_generate_aliasing() -> Result<()> { let p = openpgp::policy::StandardPolicy::new(); let (cert, _) = openpgp::cert::CertBuilder::new() .add_userid("dkg") .add_userid("dkg ") .add_userid("") .add_userid("dkg@debian.org") .add_userid("dkg ") .add_transport_encryption_subkey() .generate()?; let vcert = cert.with_policy(&p, None)?; let records = generate(&vcert, "debian.org", None, None)?; assert_eq!(records.len(), 1); let record = &records[0]; eprintln!("{}", record); assert!(record.starts_with(&format!( "; dkg@debian.org => {}\n\ A47CB586A51ACB93ACB9EF806F35F29131548E59E2FACD58CF6232E3\ ._openpgpkey.debian.org. 10800 IN OPENPGPKEY ", cert.fingerprint()))); let asc = record.split(' ').last().unwrap(); let bin = general_purpose::STANDARD.decode(&asc)?; let c = Cert::from_bytes(&bin)?; assert_eq!(c.userids().count(), 3); Ok(()) } #[test] fn test_generate_disjoint() -> Result<()> { let p = openpgp::policy::StandardPolicy::new(); let (cert, _) = openpgp::cert::CertBuilder::new() .add_userid("dkg") .add_userid("dkg ") .add_userid("dkg ") .add_userid("dkg ") .add_transport_encryption_subkey() .generate()?; let vcert = cert.with_policy(&p, None)?; let records = generate(&vcert, "debian.org", None, None)?; assert_eq!(records.len(), 2); for record in records { eprintln!("{}", record); let asc = record.split(' ').last().unwrap(); let bin = general_purpose::STANDARD.decode(&asc)?; let c = Cert::from_bytes(&bin)?; assert_eq!(c.userids().count(), 1); } Ok(()) } #[test] fn test_generate_generic() -> Result<()> { let p = openpgp::policy::StandardPolicy::new(); let (cert, _) = openpgp::cert::CertBuilder::new() .add_userid("dkg ") .add_transport_encryption_subkey() .generate()?; let vcert = cert.with_policy(&p, None)?; let records = generate_generic(&vcert, "debian.org", Duration::new(300, 0), None)?; assert_eq!(records.len(), 1); let record = &records[0]; eprintln!("{}", record); assert!(record.starts_with(&format!( "; dkg@debian.org => {}\n\ A47CB586A51ACB93ACB9EF806F35F29131548E59E2FACD58CF6232E3\ ._openpgpkey.debian.org. 300 IN TYPE61 \\# {} ", cert.fingerprint(), cert.serialized_len()))); let asc = record.split(' ').last().unwrap(); let bin = openpgp::fmt::hex::decode(&asc)?; let c = Cert::from_bytes(&bin)?; assert_eq!(c.userids().count(), 1); Ok(()) } } sequoia-net-0.28.0/src/email.rs000064400000000000000000000036101046102023000143710ustar 00000000000000//! Provides e-mail parsing functions. use std::fmt; use super::{Result, Error}; /// Stores the local_part and domain of an email address. #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] pub(crate) struct EmailAddress { pub(crate) local_part: String, pub(crate) domain: String, } impl fmt::Display for EmailAddress { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}@{}", self.local_part, self.domain) } } impl EmailAddress { /// Returns an EmailAddress from an email address string. /// /// From [draft-koch]: /// ///```text /// To help with the common pattern of using capitalized names /// (e.g. "Joe.Doe@example.org") for mail addresses, and under the /// premise that almost all MTAs treat the local-part case-insensitive /// and that the domain-part is required to be compared /// case-insensitive anyway, all upper-case ASCII characters in a User /// ID are mapped to lowercase. Non-ASCII characters are not changed. ///``` pub(crate) fn from>(email_address: S) -> Result { // Ensure that is a valid email address by parsing it and return the // errors that it returns. // This is also done in hagrid. let email_address = email_address.as_ref(); let v: Vec<&str> = email_address.split('@').collect(); if v.len() != 2 { return Err(Error::MalformedEmail(email_address.into()).into()) }; // Convert domain to lowercase without tailoring, i.e. without taking any // locale into account. See: // https://doc.rust-lang.org/std/primitive.str.html#method.to_lowercase // // Keep the local part as-is as we'll need that to generate WKD URLs. let email = EmailAddress { local_part: v[0].to_string(), domain: v[1].to_lowercase() }; Ok(email) } } sequoia-net-0.28.0/src/lib.rs000064400000000000000000000206341046102023000140550ustar 00000000000000//! Discovering and publishing OpenPGP certificates over the network. //! //! This crate provides access to keyservers using the [HKP] protocol, //! and searching and publishing [Web Key Directories]. //! //! Additionally the `pks` module exposes private key operations using //! the [PKS][PKS] protocol. //! //! [HKP]: https://tools.ietf.org/html/draft-shaw-openpgp-hkp-00 //! [Web Key Directories]: https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service //! [PKS]: https://gitlab.com/wiktor/pks //! //! # Examples //! //! This example demonstrates how to fetch a certificate from the //! default key server: //! //! ```no_run //! # use sequoia_openpgp::KeyID; //! # use sequoia_net::{KeyServer, Result}; //! # async fn f() -> Result<()> { //! let mut ks = KeyServer::default(); //! let keyid: KeyID = "31855247603831FD".parse()?; //! println!("{:?}", ks.get(keyid).await?); //! # Ok(()) //! # } //! ``` //! //! This example demonstrates how to fetch a certificate using WKD: //! //! ```no_run //! # async fn f() -> sequoia_net::Result<()> { //! let certs = sequoia_net::wkd::get(&reqwest::Client::new(), "juliett@example.org").await?; //! # Ok(()) } //! ``` #![doc(html_favicon_url = "https://docs.sequoia-pgp.org/favicon.png")] #![doc(html_logo_url = "https://docs.sequoia-pgp.org/logo.svg")] #![warn(missing_docs)] // Re-exports of crates that we use in our API. pub use reqwest; use percent_encoding::{percent_encode, AsciiSet, CONTROLS}; use reqwest::{ StatusCode, Url, }; use sequoia_openpgp::{ self as openpgp, cert::{Cert, CertParser}, KeyHandle, packet::UserID, parse::Parse, serialize::Serialize, }; #[macro_use] mod macros; pub mod dane; mod email; pub mod pks; pub mod updates; pub mod wkd; /// const KEYSERVER_ENCODE_SET: &AsciiSet = // Formerly DEFAULT_ENCODE_SET &CONTROLS.add(b' ').add(b'"').add(b'#').add(b'<').add(b'>').add(b'`') .add(b'?').add(b'{').add(b'}') // The SKS keyserver as of version 1.1.6 is a bit picky with // respect to the encoding. .add(b'-').add(b'+').add(b'/'); /// For accessing keyservers using HKP. pub struct KeyServer { client: reqwest::Client, /// The original URL given to the constructor. url: Url, /// The URL we use for the requests. request_url: Url, } assert_send_and_sync!(KeyServer); impl Default for KeyServer { fn default() -> Self { Self::new("hkps://keys.openpgp.org/").unwrap() } } impl KeyServer { /// Returns a handle for the given URL. pub fn new(url: &str) -> Result { Self::with_client(url, reqwest::Client::new()) } /// Returns a handle for the given URL with a custom `Client`. pub fn with_client(url: &str, client: reqwest::Client) -> Result { let url = reqwest::Url::parse(url)?; let s = url.scheme(); match s { "hkp" => (), "hkps" => (), _ => return Err(Error::MalformedUrl.into()), } let request_url = format!("{}://{}:{}", match s {"hkp" => "http", "hkps" => "https", _ => unreachable!()}, url.host().ok_or(Error::MalformedUrl)?, match s { "hkp" => url.port().or(Some(11371)), "hkps" => url.port().or(Some(443)), _ => unreachable!(), }.unwrap()).parse()?; Ok(KeyServer { client, url, request_url }) } /// Returns the keyserver's base URL. pub fn url(&self) -> &reqwest::Url { &self.url } /// Retrieves the certificate with the given handle. /// /// # Warning /// /// Returned certificates must be mistrusted, and be carefully /// interpreted under a policy and trust model. pub async fn get>(&self, handle: H) -> Result>> { let handle = handle.into(); let url = self.request_url.join( &format!("pks/lookup?op=get&options=mr&search=0x{:X}", handle))?; let res = self.client.get(url).send().await?; match res.status() { StatusCode::OK => { let body = res.bytes().await?; let certs = CertParser::from_bytes(&body)?.collect(); Ok(certs) } StatusCode::NOT_FOUND => Err(Error::NotFound.into()), n => Err(Error::HttpStatus(n).into()), } } /// Retrieves certificates containing the given `UserID`. /// /// If the given [`UserID`] does not follow the de facto /// conventions for userids, or it does not contain a email /// address, an error is returned. /// /// [`UserID`]: sequoia_openpgp::packet::UserID /// /// # Warning /// /// Returned certificates must be mistrusted, and be carefully /// interpreted under a policy and trust model. #[allow(clippy::blocks_in_if_conditions)] pub async fn search>(&self, userid: U) -> Result>> { let userid = userid.into(); let email = userid.email2().and_then(|addr| addr.ok_or_else(|| openpgp::Error::InvalidArgument( "UserID does not contain an email address".into()).into()))?; let url = self.request_url.join( &format!("pks/lookup?op=get&options=mr&search={}", email))?; let res = self.client.get(url).send().await?; match res.status() { StatusCode::OK => { Ok(CertParser::from_bytes(&res.bytes().await?)?.collect()) }, StatusCode::NOT_FOUND => Err(Error::NotFound.into()), n => Err(Error::HttpStatus(n).into()), } } /// Sends the given key to the server. pub async fn send(&self, key: &Cert) -> Result<()> { use sequoia_openpgp::armor::{Writer, Kind}; let url = self.request_url.join("pks/add")?; let mut w = Writer::new(Vec::new(), Kind::PublicKey)?; key.serialize(&mut w)?; let armored_blob = w.finalize()?; // Prepare to send url-encoded data. let mut post_data = b"keytext=".to_vec(); post_data.extend_from_slice(percent_encode(&armored_blob, KEYSERVER_ENCODE_SET) .collect::().as_bytes()); let length = post_data.len(); let res = self.client.post(url) .header("content-type", "application/x-www-form-urlencoded") .header("content-length", length.to_string()) .body(post_data).send().await?; match res.status() { StatusCode::OK => Ok(()), StatusCode::NOT_FOUND => Err(Error::ProtocolViolation.into()), n => Err(Error::HttpStatus(n).into()), } } } /// Results for sequoia-net. pub type Result = ::std::result::Result; #[derive(thiserror::Error, Debug)] /// Errors returned from the network routines. #[non_exhaustive] pub enum Error { /// A requested cert was not found. #[error("Cert not found")] NotFound, /// A given keyserver URL was malformed. #[error("Malformed URL; expected hkp: or hkps:")] MalformedUrl, /// The server provided malformed data. #[error("Malformed response from server")] MalformedResponse, /// A communication partner violated the protocol. #[error("Protocol violation")] ProtocolViolation, /// Encountered an unexpected low-level http status. #[error("Error communicating with server")] HttpStatus(hyper::StatusCode), /// A `hyper::error::UrlError` occurred. #[error("URL Error")] UrlError(#[from] url::ParseError), /// A `http::Error` occurred. #[error("http Error")] HttpError(#[from] http::Error), /// A `hyper::Error` occurred. #[error("Hyper Error")] HyperError(#[from] hyper::Error), /// wkd errors: /// An email address is malformed #[error("Malformed email address {0}")] MalformedEmail(String), /// An email address was not found in Cert userids. #[error("Email address {0} not found in Cert's userids")] EmailNotInUserids(String), } #[cfg(test)] mod tests { use super::*; #[test] fn urls() { assert!(KeyServer::new("keys.openpgp.org").is_err()); assert!(KeyServer::new("hkp://keys.openpgp.org").is_ok()); assert!(KeyServer::new("hkps://keys.openpgp.org").is_ok()); } } sequoia-net-0.28.0/src/macros.rs000064400000000000000000000076061046102023000145770ustar 00000000000000//! Various macros used in this crate. /// A simple shortcut for ensuring a type is send and sync. /// /// For most types just call it after defining the type: /// /// ```ignore /// pub struct MyStruct {} /// assert_send_and_sync!(MyStruct); /// ``` /// /// For types with lifetimes, use the anonymous lifetime: /// /// ```ignore /// pub struct WithLifetime<'a> { _p: std::marker::PhantomData<&'a ()> } /// assert_send_and_sync!(WithLifetime<'_>); /// ``` /// /// For a type generic over another type `W`, /// pass the type `W` as a where clause /// including a trait bound when needed: /// /// ```ignore /// pub struct MyWriter { _p: std::marker::PhantomData } /// assert_send_and_sync!(MyWriter where W: std::io::Write); /// ``` /// /// This will assert that `MyWriterStruct` is `Send` and `Sync` /// if `W` is `Send` and `Sync`. /// /// You can also combine the two and be generic over multiple types. /// Just make sure to list all the types - even those without additional /// trait bounds: /// /// ```ignore /// pub struct MyWriterWithLifetime<'a, C, W: std::io::Write> { /// _p: std::marker::PhantomData<&'a (C, W)>, /// } /// assert_send_and_sync!(MyWriterWithLifetime<'_, C, W> where C, W: std::io::Write); /// ``` /// /// If you need multiple additional trait bounds on a single type /// you can add them separated by `+` like in normal where clauses. /// However you have to make sure they are `Identifiers` like `Write`. /// In macro patterns `Paths` (like `std::io::Write`) may not be followed /// by `+` characters. // Note: We cannot test the macro in doctests, because the macro is // not public. We test the cases in the test module below, instead. // If you change the examples here, propagate the changes to the // module below. macro_rules! assert_send_and_sync { ( $x:ty where $( $g:ident$( : $a:path )? $(,)?)*) => { impl<$( $g ),*> crate::macros::Sendable for $x where $( $g: Send + Sync $( + $a )? ),* {} impl<$( $g ),*> crate::macros::Syncable for $x where $( $g: Send + Sync $( + $a )? ),* {} }; ( $x:ty where $( $g:ident$( : $a:ident $( + $b:ident )* )? $(,)?)*) => { impl<$( $g ),*> crate::macros::Sendable for $x where $( $g: Send + Sync $( + $a $( + $b )* )? ),* {} impl<$( $g ),*> crate::macros::Syncable for $x where $( $g: Send + Sync $( + $a $( + $b )* )? ),* {} }; ( $x:ty ) => { impl crate::macros::Sendable for $x {} impl crate::macros::Syncable for $x {} }; } pub(crate) trait Sendable : Send {} pub(crate) trait Syncable : Sync {} /// We cannot test the macro in doctests, because the macro is not /// public. We test the cases here, instead. If you change the /// examples here, propagate the changes to the docstring above. #[cfg(test)] mod test { /// For most types just call it after defining the type: pub struct MyStruct {} assert_send_and_sync!(MyStruct); /// For types with lifetimes, use the anonymous lifetime: pub struct WithLifetime<'a> { _p: std::marker::PhantomData<&'a ()> } assert_send_and_sync!(WithLifetime<'_>); /// For a type generic over another type `W`, pass the type `W` as /// a where clause including a trait bound when needed: pub struct MyWriter { _p: std::marker::PhantomData } assert_send_and_sync!(MyWriter where W: std::io::Write); /// This will assert that `MyWriterStruct` is `Send` and `Sync` /// if `W` is `Send` and `Sync`. /// /// You can also combine the two and be generic over multiple /// types. Just make sure to list all the types - even those /// without additional trait bounds: pub struct MyWriterWithLifetime<'a, C, W: std::io::Write> { _p: std::marker::PhantomData<&'a (C, W)>, } assert_send_and_sync!(MyWriterWithLifetime<'_, C, W> where C, W: std::io::Write); } sequoia-net-0.28.0/src/pks.rs000064400000000000000000000346731046102023000141140ustar 00000000000000//! Private Key Store communication. //! //! Functions in this module can be used to sign and decrypt using //! remote keys using the [Private Key Store][PKS] protocol. //! //! [PKS]: https://gitlab.com/wiktor/pks //! # Examples //! ``` //! use sequoia_net::pks; //! # let p: sequoia_openpgp::crypto::Password = vec![1, 2, 3].into(); //! # let key = sequoia_openpgp::cert::CertBuilder::general_purpose(None, Some("alice@example.org")) //! # .generate().unwrap().0.keys().next().unwrap().key().clone(); //! //! match pks::unlock_signer("http://localhost:3000/", key, &p) { //! Ok(signer) => { /* use signer for signing */ }, //! Err(e) => { eprintln!("Could not unlock signer: {:?}", e); } //! } //! ``` use std::convert::{TryFrom, TryInto}; use sequoia_openpgp as openpgp; use openpgp::packet::Key; use openpgp::packet::key::{PublicParts, UnspecifiedRole}; use openpgp::crypto::{Password, Decryptor, Signer, mpi, SessionKey, ecdh}; use openpgp::types::HashAlgorithm; use openpgp::Fingerprint; use hyper::{Body, Client, Uri, client::HttpConnector, Request, HeaderMap, header::HeaderValue}; use hyper_tls::HttpsConnector; use base64::Engine; use base64::engine::general_purpose::STANDARD as base64std; use super::Result; use url::Url; #[derive(thiserror::Error, Debug)] /// Errors returned from Private Key Store functions. pub enum Error { /// Unlocking the key did not return a Location header. #[error("Key unlock did not return a Location header")] NoKeyLocation, /// Unlocking the key failed with given error code. /// /// The error code is the [HTTP response code] returned by /// the Private Key Store implementation. /// /// [HTTP response code]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status #[error("Key unlock failed with error: {0}")] KeyUnlockFailed(u16), /// Private Key Store operation failed with given error code. /// /// The error code is the [HTTP response code] returned by /// the Private Key Store implementation. /// /// [HTTP response code]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status #[error("Private Key Store operation failed: {0}")] OperationFailed(u16), } /// Contains a description of the unlocked key. struct KeyDescriptor { /// URL of the endpoint that can be used to interact with the key. url: Uri, /// List of content types that this key accepts. This value is `None` if the key /// did not indicate accepted content types. accepted_types: Option>, } impl TryFrom<&HeaderMap> for KeyDescriptor { type Error = anyhow::Error; fn try_from(headers: &HeaderMap) -> Result { if let Some(location) = headers.get("Location") { let accepted_types = if let Some(accepted_types) = headers.get("Accept-Post") { Some( accepted_types .to_str()? .split(',') .map(|typ| typ.trim().to_string()) .collect::>(), ) } else { None }; Ok(Self { url: location.to_str()?.parse()?, accepted_types, }) } else { Err(Error::NoKeyLocation.into()) } } } /// Returns request parameters for given arguments. /// /// Computes target URL and optional authentication data for given input /// arguments. fn create_request_params(store_uri: &str, fingerprint: &Fingerprint, capability: &str) -> Result<(Url, Option)> { let url = Url::parse(store_uri)?; let auth = if !url.username().is_empty() { let password = url.password().unwrap_or_default(); let credentials = format!("{}:{}", url.username(), password); Some(format!("Basic {}", base64std.encode(credentials))) } else { None }; let mut url = url.join(&fingerprint.to_hex())?; url.query_pairs_mut().append_pair("capability", capability); Ok((url, auth)) } /// Returns an unlocked key descriptor. /// /// Unlocks a key using the given password and on success returns a key descriptor /// that can be used for signing or decryption. fn create_descriptor(store_uri: &str, key: &Key, p: &Password, capability: &str) -> Result { let fpr = &key.fingerprint(); let (url, auth) = create_request_params(store_uri, fpr, capability)?; let uri: hyper::Uri = url.as_str().parse()?; let mut request = Request::builder() .method("POST") .uri(uri); if let Some(auth) = auth { request = request.header(hyper::header::AUTHORIZATION, auth); } let rt = tokio::runtime::Builder::new_current_thread() .enable_io() .enable_time() .build()?; let request = request.body(Body::from(p.map(|p|p.as_ref().to_vec())))?; let client = Client::builder().build(HttpsConnector::new()); let response = rt.block_on(client.request(request))?; if !response.status().is_success() { return Err(Error::KeyUnlockFailed(response.status().into()).into()); } response.headers().try_into() } /// Unlock a remote key for signing. /// /// Look up a private key corresponding to the public key passed as a /// parameter and return a [`Signer`] trait object that will utilize /// that private key for signing. /// /// # Errors /// /// This function fails if the key cannot be found on the remote store /// or if the password is not correct. /// /// # Examples /// ``` /// use sequoia_net::pks; /// # let p: sequoia_openpgp::crypto::Password = vec![1, 2, 3].into(); /// # let key = sequoia_openpgp::cert::CertBuilder::general_purpose(None, Some("alice@example.org")) /// # .generate().unwrap().0.keys().next().unwrap().key().clone(); /// /// match pks::unlock_signer("http://localhost:3000/", key, &p) { /// Ok(signer) => { /* use signer for signing */ }, /// Err(e) => { eprintln!("Could not unlock signer: {:?}", e); } /// } /// ``` pub fn unlock_signer(store_uri: impl AsRef, key: Key, p: &Password) -> Result> { let description = create_descriptor(store_uri.as_ref(), &key, p, "sign")?; Ok(Box::new(PksClient::new(key, description)?)) } /// Unlock a remote key for decryption. /// /// Look up a private key corresponding to the public key passed as a /// parameter and return a [`Decryptor`] trait object that will utilize /// that private key for decryption. /// /// # Errors /// /// This function fails if the key cannot be found on the remote store /// or if the password is not correct. /// /// # Examples /// ``` /// use sequoia_net::pks; /// # let p: sequoia_openpgp::crypto::Password = vec![1, 2, 3].into(); /// # let key = sequoia_openpgp::cert::CertBuilder::general_purpose(None, Some("alice@example.org")) /// # .generate().unwrap().0.keys().next().unwrap().key().clone(); /// /// match pks::unlock_decryptor("http://localhost:3000/", key, &p) { /// Ok(decryptor) => { /* use decryptor for decryption */ }, /// Err(e) => { eprintln!("Could not unlock decryptor: {:?}", e); } /// } /// ``` pub fn unlock_decryptor(store_uri: impl AsRef, key: Key, p: &Password) -> Result> { let description = create_descriptor(store_uri.as_ref(), &key, p, "decrypt")?; Ok(Box::new(PksClient::new(key, description)?)) } struct PksClient { location: Uri, public: Key, client: hyper::client::Client>, acceptable_hashes: Vec, rt: tokio::runtime::Runtime, } impl PksClient { fn new( public: Key, description: KeyDescriptor, ) -> Result { let client = Client::builder().build(HttpsConnector::new()); let rt = tokio::runtime::Builder::new_current_thread() .enable_io() .enable_time() .build()?; let acceptable_types = description.accepted_types.unwrap_or_default(); let mut acceptable_hashes = acceptable_types.iter().flat_map(|typ| match typ.as_ref() { "application/vnd.pks.digest.sha1" => Some(HashAlgorithm::SHA1), "application/vnd.pks.digest.sha256" => Some(HashAlgorithm::SHA256), "application/vnd.pks.digest.sha384" => Some(HashAlgorithm::SHA384), "application/vnd.pks.digest.sha512" => Some(HashAlgorithm::SHA512), _ => None, }).collect::>(); acceptable_hashes.sort(); Ok(Self { location: description.url, public, client, rt, acceptable_hashes }) } fn make_request(&mut self, body: Vec, content_type: &str) -> Result> { let request = Request::builder() .method("POST") .uri(&self.location) .header("Content-Type", content_type) .body(Body::from(body))?; let response = self.rt.block_on(self.client.request(request))?; if !response.status().is_success() { return Err(Error::OperationFailed(response.status().into()).into()); } Ok(self.rt.block_on(hyper::body::to_bytes(response))?.to_vec()) } } impl Decryptor for PksClient { fn public(&self) -> &Key { &self.public } fn decrypt( &mut self, ciphertext: &mpi::Ciphertext, plaintext_len: Option, ) -> openpgp::Result { match (ciphertext, self.public.mpis()) { (mpi::Ciphertext::RSA { c }, mpi::PublicKey::RSA { .. }) => Ok(self.make_request(c.value().to_vec(), "application/vnd.pks.rsa.ciphertext")?.into()) , (mpi::Ciphertext::ECDH { e, .. }, mpi::PublicKey::ECDH { .. }) => { #[allow(non_snake_case)] let S = self.make_request(e.value().to_vec(), "application/vnd.pks.ecdh.point")?.into(); Ok(ecdh::decrypt_unwrap2(&self.public, &S, ciphertext, plaintext_len)?) }, (ciphertext, public) => Err(openpgp::Error::InvalidOperation(format!( "unsupported combination of key pair {:?} \ and ciphertext {:?}", public, ciphertext)).into() ), } } } impl Signer for PksClient { fn public(&self) -> &Key { &self.public } fn acceptable_hashes(&self) -> &[HashAlgorithm] { &self.acceptable_hashes } fn sign( &mut self, hash_algo: openpgp::types::HashAlgorithm, digest: &[u8], ) -> openpgp::Result { use openpgp::types::PublicKeyAlgorithm; let content_type = match hash_algo { HashAlgorithm::SHA1 => "application/vnd.pks.digest.sha1", HashAlgorithm::SHA256 => "application/vnd.pks.digest.sha256", HashAlgorithm::SHA384 => "application/vnd.pks.digest.sha384", HashAlgorithm::SHA512 => "application/vnd.pks.digest.sha512", _ => "application/octet-stream", }; let sig = self.make_request(digest.into(), content_type)?; match (self.public.pk_algo(), self.public.mpis()) { #[allow(deprecated)] (PublicKeyAlgorithm::RSASign, mpi::PublicKey::RSA { .. }) | ( PublicKeyAlgorithm::RSAEncryptSign, mpi::PublicKey::RSA { .. }, ) => Ok(mpi::Signature::RSA { s: mpi::MPI::new(&sig) }), (PublicKeyAlgorithm::EdDSA, mpi::PublicKey::EdDSA { .. }) => { let r = mpi::MPI::new(&sig[..32]); let s = mpi::MPI::new(&sig[32..]); Ok(mpi::Signature::EdDSA { r, s }) } ( PublicKeyAlgorithm::ECDSA, mpi::PublicKey::ECDSA { .. }, ) => { let len_2 = sig.len() / 2; let r = mpi::MPI::new(&sig[..len_2]); let s = mpi::MPI::new(&sig[len_2..]); Ok(mpi::Signature::ECDSA { r, s }) } (pk_algo, _) => Err(openpgp::Error::InvalidOperation(format!( "unsupported combination of algorithm {:?} and key {:?}", pk_algo, self.public)).into()), } } } #[cfg(test)] mod tests { use super::*; use std::str::FromStr; #[test] fn test_decrypt_url() { let fingerprint = &Fingerprint::from_str("43B24E4557BBCD10225EDDB97123242412A19C9B").unwrap(); let (url, auth) = create_request_params("http://localhost:3000", fingerprint, "decrypt").unwrap(); assert_eq!(url.as_str(), "http://localhost:3000/43B24E4557BBCD10225EDDB97123242412A19C9B?capability=decrypt"); assert!(auth.is_none()); } #[test] fn test_sign_url() { let fingerprint = &Fingerprint::from_str("43B24E4557BBCD10225EDDB97123242412A19C9B").unwrap(); let (url, auth) = create_request_params("http://localhost:3000", fingerprint, "sign").unwrap(); assert_eq!(url.as_str(), "http://localhost:3000/43B24E4557BBCD10225EDDB97123242412A19C9B?capability=sign"); assert!(auth.is_none()); } #[test] fn test_sign_url_with_slash() { let fingerprint = &Fingerprint::from_str("43B24E4557BBCD10225EDDB97123242412A19C9B").unwrap(); let (url, auth) = create_request_params("http://localhost:3000/", fingerprint, "sign").unwrap(); assert_eq!(url.as_str(), "http://localhost:3000/43B24E4557BBCD10225EDDB97123242412A19C9B?capability=sign"); assert!(auth.is_none()); } #[test] fn test_sign_url_with_subdirectory() { let fingerprint = &Fingerprint::from_str("43B24E4557BBCD10225EDDB97123242412A19C9B").unwrap(); let (url, auth) = create_request_params("http://localhost:3000/keys/", fingerprint, "sign").unwrap(); assert_eq!(url.as_str(), "http://localhost:3000/keys/43B24E4557BBCD10225EDDB97123242412A19C9B?capability=sign"); assert!(auth.is_none()); } #[test] fn test_sign_url_with_credentials() { let fingerprint = &Fingerprint::from_str("43B24E4557BBCD10225EDDB97123242412A19C9B").unwrap(); let (url, auth) = create_request_params("http://a:b@localhost:3000", fingerprint, "sign").unwrap(); assert_eq!(url.as_str(), "http://a:b@localhost:3000/43B24E4557BBCD10225EDDB97123242412A19C9B?capability=sign"); assert_eq!("Basic YTpi", auth.unwrap()); } } sequoia-net-0.28.0/src/updates.rs000064400000000000000000000275561046102023000147660ustar 00000000000000//! OpenPGP Keystore Update Manifests. //! //! This implements an efficient and privacy preserving mechanism that //! OpenPGP clients can use to update their certificates. For //! details, please see [the draft]. //! //! [the draft]: https://gitlab.com/hagrid-keyserver/keystore-updates use std::{ collections::BTreeSet, convert::{TryFrom, TryInto}, fmt, io, ops, }; use sequoia_openpgp as openpgp; use openpgp::{ Fingerprint, }; /// The number of seconds in one epoch. pub const SECONDS_PER_EPOCH: u64 = 1 << 15; /// Set of certificate updates. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Manifest { start: Epoch, end: Epoch, prefixes: BTreeSet, } impl Manifest { /// Magic string for Update Manifests. pub const MAGIC: &'static [u8] = b"\xE4\x2B\xAF\xBD\xD5\x75\x77\x0A"; /// Creates a new Update Manifest pub fn new(start: S, end: E) -> anyhow::Result where S: Into, E: Into, { let start = start.into(); let end = end.into(); if start <= end { Ok(Manifest { start, end, prefixes: Default::default(), }) } else { Err(anyhow::anyhow!("End epoch predates start epoch")) } } /// Computes the prefix of the given Fingerprint. fn prefix(fingerprint: &Fingerprint) -> u32 { let mut prefix = [0u8; 4]; prefix.copy_from_slice(&fingerprint.as_bytes()[..4]); u32::from_be_bytes(prefix) } /// Tests whether a cert is included in the Update Manifest. /// /// Note: Due to the privacy-preserving nature of Update Manifests /// that store only fingerprint prefixes, this may return false /// positives. pub fn contains(&self, fingerprint: &Fingerprint) -> bool { self.prefixes.contains(&Self::prefix(fingerprint)) } /// Tests whether an epoch is included in the Update Manifest. pub fn contains_epoch(&self, epoch: Epoch) -> bool { // Both start and end are inclusive, therefore: self.start <= epoch && epoch <= self.end } /// Iterates over all epochs contained in this Update Manifest. pub fn epochs(&self) -> impl Iterator { (self.start.0..self.end.0 + 1).into_iter() .map(Epoch) } /// Returns the start epoch. pub fn start(&self) -> Epoch { self.start } /// Returns the end epoch. pub fn end(&self) -> Epoch { self.end } /// Is the Manifest empty? pub fn is_empty(&self) -> bool { self.prefixes.is_empty() } /// Returns the number of fingerprint prefixes in this Update /// Manifest. pub fn len(&self) -> usize { self.prefixes.len() } /// Inserts a fingerprint into the Update Manifest. pub fn insert(&mut self, fingerprint: &Fingerprint) { self.prefixes.insert(Self::prefix(fingerprint)); } /// Merges two Update Manifests into one. pub fn merge(&self, other: &Self) -> Manifest { Manifest { start: self.start.min(other.start), end: self.end.max(other.end), prefixes: self.prefixes.iter().cloned() .chain(other.prefixes.iter().cloned()) .collect(), } } /// Writes the Update Manifest to the given `io::Write`r. pub fn serialize(&self, sink: &mut dyn io::Write) -> io::Result<()> { sink.write_all(Self::MAGIC)?; self.start.serialize(sink)?; self.end.serialize(sink)?; for prefix in &self.prefixes { sink.write_all(&prefix.to_be_bytes())?; } Ok(()) } /// Reads the Update Manifest from the given `io::Read`er. pub fn parse(source: &mut dyn io::Read) -> io::Result { let mut magic = [0; 8]; source.read_exact(&mut magic)?; if &magic[..] != Self::MAGIC { return Err(io::Error::new(io::ErrorKind::Other, anyhow::anyhow!("Bad magic string"))); } let start = Epoch::parse(source)?; let end = Epoch::parse(source)?; if start > end { return Err(io::Error::new( io::ErrorKind::Other, anyhow::anyhow!("End epoch predates start epoch"))); } let mut prefixes = BTreeSet::default(); let mut prefix = [0; 4]; 'parse: loop { let mut read = 0; loop { let n = source.read(&mut prefix[read..])?; if n == 0 { match read { 0 => break 'parse, _ => return Err(io::Error::new( io::ErrorKind::UnexpectedEof, "Truncated fingerprint prefix")), } } read += n; if read == 4 { prefixes.insert(u32::from_be_bytes(prefix)); continue 'parse; } } } Ok(Manifest { start, end, prefixes, }) } } /// Granularity of updates. /// /// For the purposes of this update mechanism, the updates cycle in /// blocks of 2^15 seconds, or about 9 hours. #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Epoch(u32); impl fmt::Display for Epoch { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } impl From for Epoch { fn from(e: u32) -> Self { Epoch(e) } } impl TryFrom for Epoch { type Error = anyhow::Error; fn try_from(t: std::time::SystemTime) -> anyhow::Result { use std::time::*; let unix_epoch = t.duration_since(UNIX_EPOCH)?; Self::try_from_unix(unix_epoch.as_secs()) } } impl Epoch { /// Returns the currently active Epoch. pub fn current() -> anyhow::Result { std::time::SystemTime::now().try_into() } /// Returns the epoch for the given UNIX epoch. pub fn try_from_unix(t: u64) -> anyhow::Result { Ok(Epoch((t / SECONDS_PER_EPOCH).try_into()?)) } /// Returns the previous Epoch, if any. pub fn pred(&self) -> Option { self.0.checked_sub(1).map(Epoch) } /// Returns the next Epoch, if any. pub fn succ(&self) -> Option { self.0.checked_add(1).map(Epoch) } /// Returns an iterator over all epochs starting from this one to /// `other`, in descending order, excluding `other`. pub fn since(&self, other: Epoch) -> anyhow::Result> { if other <= *self { Ok((other.0 + 1..self.0).into_iter().rev().map(Epoch)) } else { Err(anyhow::anyhow!("other is later than self")) } } /// Writes the Epoch to the given `io::Write`r. pub fn serialize(&self, sink: &mut dyn io::Write) -> io::Result<()> { sink.write_all(&self.0.to_be_bytes()) } /// Reads the Epoch from the given `io::Read`er. pub fn parse(source: &mut dyn io::Read) -> io::Result { let mut be_bytes = [0; 4]; source.read_exact(&mut be_bytes)?; Ok(Self(u32::from_be_bytes(be_bytes))) } } impl std::str::FromStr for Epoch { type Err = anyhow::Error; fn from_str(s: &str) -> std::result::Result { if s == "current" { Ok(Epoch::current()?) } else { Ok(Epoch(s.parse()?)) } } } impl ops::Add for Epoch { type Output = Self; fn add(self, other: Epoch) -> Self { Self(self.0 + other.0) } } impl ops::Sub for Epoch { type Output = Self; fn sub(self, other: Epoch) -> Self { Self(self.0 - other.0) } } impl ops::Add for Epoch { type Output = Self; fn add(self, other: u32) -> Self { Self(self.0 + other) } } impl ops::Sub for Epoch { type Output = Self; fn sub(self, other: u32) -> Self { Self(self.0 - other) } } #[cfg(test)] mod tests { use super::*; #[test] fn current_epoch() -> crate::Result<()> { let _ = Epoch::current()?; Ok(()) } #[test] fn merge() -> crate::Result<()> { let c = Epoch::current()?; // End predates start. assert!(Manifest::new(c - 1, c - 2).is_err()); let mut u_0 = Manifest::new(c - 1, c)?; let mut u_1 = Manifest::new(c - 2, c - 1)?; let neal: Fingerprint = "8F17777118A33DDA9BA48E62AACB3243630052D9".parse()?; let justus: Fingerprint = "CBCD8F030588653EEDD7E2659B7DD433F254904A".parse()?; let vincent: Fingerprint = "D4AB192964F76A7F8F8A9B357BD18320DEADFA11".parse()?; u_0.insert(&neal); u_1.insert(&neal); u_0.insert(&justus); u_1.insert(&vincent); let u_01 = u_0.merge(&u_1); assert_eq!(u_01.start, c - 2); assert_eq!(u_01.end, c); assert_eq!(u_01.len(), 3); assert!(u_01.contains(&neal)); assert!(u_01.contains(&justus)); assert!(u_01.contains(&vincent)); Ok(()) } /// Checks serialization using the sample Update Manifest. /// /// ```text /// Below is a hexdump of an update manifest that covers epochs from 15296 /// to 15322 (inclusive). This corresponds to the time range from /// 1985-11-18T22:35:28 through 1985-11-29T04:21:03 (inclusive). The /// observed updated certificates had five primary key fingerprint /// prefixes: /// /// 32144D9D, 65FB1218, 7E91F402, 9ED85A5E, EA71546A /// /// 00000000 e4 2b af bd d5 75 77 0a 00 00 3b c0 00 00 3b da /// 00000010 32 14 4d 9d 65 fb 12 18 7e 91 f4 02 9e d8 5a 5e /// 00000020 ea 71 54 6a /// ``` fn sample_manifest() -> crate::Result<(Epoch, Epoch, Vec, &'static[u8])> { let start = Epoch(15296); let end = Epoch(15322); let fp0: Fingerprint = "32144D9DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".parse()?; let fp1: Fingerprint = "65FB1218AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".parse()?; let fp2: Fingerprint = "7E91F402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".parse()?; let fp3: Fingerprint = "9ED85A5EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".parse()?; let fp4: Fingerprint = "EA71546AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".parse()?; let bytes = b"\ \xe4\x2b\xaf\xbd\xd5\x75\x77\x0a\x00\x00\x3b\xc0\x00\x00\x3b\xda\ \x32\x14\x4d\x9d\x65\xfb\x12\x18\x7e\x91\xf4\x02\x9e\xd8\x5a\x5e\ \xea\x71\x54\x6a"; Ok((start, end, vec![fp0, fp1, fp2, fp3, fp4], bytes)) } #[test] fn serialize() -> crate::Result<()> { let (start, end, fingerprints, bytes) = sample_manifest()?; let mut manifest = Manifest::new(start, end)?; manifest.insert(&fingerprints[3]); manifest.insert(&fingerprints[1]); manifest.insert(&fingerprints[0]); manifest.insert(&fingerprints[4]); manifest.insert(&fingerprints[2]); let mut buf = Vec::new(); manifest.serialize(&mut buf)?; assert_eq!(&buf[..], bytes); Ok(()) } #[test] fn parse() -> crate::Result<()> { let (start, end, fingerprints, bytes) = sample_manifest()?; let manifest = Manifest::parse(&mut io::Cursor::new(bytes))?; assert_eq!(manifest.start, start); assert_eq!(manifest.end, end); assert!(manifest.contains(&fingerprints[3])); assert!(manifest.contains(&fingerprints[1])); assert!(manifest.contains(&fingerprints[0])); assert!(manifest.contains(&fingerprints[4])); assert!(manifest.contains(&fingerprints[2])); assert_eq!(manifest.len(), 5); Ok(()) } } sequoia-net-0.28.0/src/wkd.rs000064400000000000000000000431761046102023000141020ustar 00000000000000//! OpenPGP Web Key Directory client. //! //! A Web Key Directory is a Web service that can be queried with email //! addresses to obtain the associated OpenPGP keys. //! //! It is specified in [draft-koch]. //! //! See the [get example]. //! //! [draft-koch]: https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service //! [get example]: get#examples //! // XXX: We might want to merge the 2 structs in the future and move the // functions to methods. use std::collections::HashMap; use std::fmt; use std::fs; use std::path::{Path, PathBuf}; use anyhow::Context; use openpgp::policy::StandardPolicy; use sequoia_openpgp::{ self as openpgp, Fingerprint, Cert, parse::Parse, serialize::Serialize, types::HashAlgorithm, cert::prelude::*, }; use crate::email::EmailAddress; use crate::Result; /// WKD variants. /// /// There are two variants of the URL scheme. `Advanced` should be /// preferred. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Variant { /// Advanced variant. /// /// This method uses a separate subdomain and is more flexible. /// This method should be preferred. Advanced, /// Direct variant. /// /// This method is deprecated. Direct, } impl Default for Variant { fn default() -> Self { Variant::Advanced } } /// Stores the parts needed to create a Web Key Directory URL. /// /// NOTE: This is a different `Url` than [`url::Url`] (`url` crate) that is /// actually returned with the method [to_url](Url::to_url()) #[derive(Debug, Clone)] pub struct Url { domain: String, local_encoded: String, local_part: String, } impl fmt::Display for Url { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.build(None)) } } impl Url { /// Returns a [`Url`] from an email address string. pub fn from>(email_address: S) -> Result { let email = EmailAddress::from(email_address)?; let local_encoded = encode_local_part(&email.local_part.to_lowercase()); let url = Url { domain : email.domain, local_encoded, local_part : email.local_part, }; Ok(url) } /// Returns an URL string from a [`Url`]. pub fn build(&self, variant: V) -> String where V: Into> { let variant = variant.into().unwrap_or_default(); if variant == Variant::Direct { format!("https://{}/.well-known/openpgpkey/hu/{}?l={}", self.domain, self.local_encoded, self.local_part) } else { format!("https://openpgpkey.{}/.well-known/openpgpkey/{}/hu/{}\ ?l={}", self.domain, self.domain, self.local_encoded, self.local_part) } } /// Returns an [`url::Url`]. pub fn to_url(&self, variant: V) -> Result where V: Into> { Ok(reqwest::Url::parse(self.build(variant).as_str())?) } /// Returns a [`PathBuf`]. pub fn to_file_path(&self, variant: V) -> Result where V: Into> { // Create the directories string. let variant = variant.into().unwrap_or_default(); let url = self.to_url(variant)?; Ok(PathBuf::from(url.path()).strip_prefix("/")?.into()) } } /// Returns a 32 characters string from the local part of an email address /// /// From [draft-koch]: /// The so mapped local-part is hashed using the SHA-1 algorithm. The /// resulting 160 bit digest is encoded using the Z-Base-32 method as /// described in RFC6189, section 5.1.6. The resulting string has a /// fixed length of 32 octets. fn encode_local_part>(local_part: S) -> String { let local_part = local_part.as_ref(); let mut digest = vec![0; 20]; let mut ctx = HashAlgorithm::SHA1.context().expect("must be implemented"); ctx.update(local_part.as_bytes()); let _ = ctx.digest(&mut digest); // After z-base-32 encoding 20 bytes, it will be 32 bytes long. zbase32::encode(&digest[..]) } /// Parse an HTTP response body that may contain Certs and filter them based on /// whether they contain a userid with the given email address. /// /// From [draft-koch]: /// /// ```text /// The key needs to carry a User ID packet ([RFC4880]) with that mail /// address. /// ``` fn parse_body>(body: &[u8], email_address: S) -> Result>> { let email_address = email_address.as_ref(); // This will fail on the first packet that can not be parsed. let packets = CertParser::from_bytes(&body)?; // Collect only the correct packets. let certs: Vec> = packets.collect(); if certs.is_empty() { return Err(crate::Error::NotFound.into()); } // Collect only the Certs that contain the email in any of their userids let valid_certs: Vec> = certs.into_iter() // XXX: This filter could become a Cert method, but it adds other API // method to maintain .filter(|cert| match cert { Ok(cert) => cert.userids() .any(|uidb| if let Ok(Some(a)) = uidb.userid().email2() { a == email_address } else { false }), Err(_) => true, }).collect(); if valid_certs.is_empty() { Err(crate::Error::EmailNotInUserids(email_address.into()).into()) } else { Ok(valid_certs) } } /// Retrieves the Certs that contain userids with a given email address /// from a Web Key Directory URL. /// /// From [draft-koch]: /// /// ```text /// There are two variants on how to form the request URI: The advanced /// and the direct method. Implementations MUST first try the advanced /// method. Only if the required sub-domain does not exist, they SHOULD /// fall back to the direct method. /// /// [...] /// /// The HTTP GET method MUST return the binary representation of the /// OpenPGP key for the given mail address. /// /// [...] /// /// Note that the key may be revoked or expired - it is up to the /// client to handle such conditions. To ease distribution of revoked /// keys, a server may return revoked keys in addition to a new key. /// The keys are returned by a single request as concatenated key /// blocks. /// ``` /// /// [draft-koch]: https://datatracker.ietf.org/doc/html/draft-koch-openpgp-webkey-service/#section-3.1 /// /// # Examples /// /// ```no_run /// # use sequoia_net::{Result, wkd}; /// # use sequoia_openpgp::Cert; /// # async fn f() -> Result<()> { /// let email_address = "foo@bar.baz"; /// let certs: Vec> = /// wkd::get(&reqwest::Client::new(), &email_address).await?; /// # Ok(()) /// # } /// ``` // XXX: Maybe the direct method should be tried on other errors too. // https://mailarchive.ietf.org/arch/msg/openpgp/6TxZc2dQFLKXtS0Hzmrk963EteE pub async fn get>(c: &reqwest::Client, email_address: S) -> Result>> { let email = email_address.as_ref().to_string(); // First, prepare URIs and client. let wkd_url = Url::from(&email)?; let advanced_uri = wkd_url.to_url(Variant::Advanced)?; let direct_uri = wkd_url.to_url(Variant::Direct)?; // First, try the Advanced Method. let res = if let Ok(res) = c.get(advanced_uri).send().await { Ok(res) } else { // Fall back to the Direct Method. c.get(direct_uri).send().await }.map_err(Error::NotFound)?; if res.status() == reqwest::StatusCode::OK { let body = res.bytes().await?; parse_body(&body, &email) } else { Err(crate::Error::NotFound.into()) } } /// Returns all e-mail addresses from certificate's User IDs matching `domain`. fn get_cert_domains<'a>(domain: &'a str, cert: &ValidCert<'a>) -> impl Iterator + 'a { cert.userids().filter_map(move |uidb| { uidb.userid().email2().unwrap_or(None).and_then(|addr| { if EmailAddress::from(&addr).ok().map(|e| e.domain == domain) .unwrap_or(false) { Url::from(&addr).ok() } else { None } }) }) } /// Checks if the certificate contains a User ID for given domain. /// /// Returns `true` if at least one of `cert`'s UserIDs contains an /// e-mail address in the domain passed as an argument. pub fn cert_contains_domain_userid(domain: S, cert: &ValidCert) -> bool where S: AsRef { get_cert_domains(domain.as_ref(), cert).next().is_some() } /// Inserts a key into a Web Key Directory. /// /// Creates a WKD hierarchy at `base_path` for `domain`, and inserts /// the given `cert`. If `cert` already exists in the WKD, it is /// updated. Any existing Certs are left in place. /// /// # Errors /// /// If the Cert does not have a well-formed UserID with `domain`, /// `Error::InvalidArgument` is returned. pub fn insert(base_path: P, domain: S, variant: V, cert: &Cert) -> Result<()> where P: AsRef, S: AsRef, V: Into> { let base_path = base_path.as_ref(); let domain = domain.as_ref(); let variant = variant.into().unwrap_or_default(); let policy = &StandardPolicy::new(); let cert = cert.with_policy(policy, None)?; // First, check which UserIDs are in `domain`. let addresses = get_cert_domains(domain, &cert).collect::>(); // Any? if addresses.is_empty() { return Err(openpgp::Error::InvalidArgument( format!("Key {} does not have a User ID in {}", cert, domain) ).into()); } // Finally, create the files. let mut well_known = None; for address in addresses.into_iter() { let path = base_path.join(address.to_file_path(variant)?); fs::create_dir_all(path.parent().expect("by construction"))?; let mut keyring = KeyRing::default(); if path.is_file() { for t in CertParser::from_file(&path).context( format!("Error parsing existing file {:?}", path))? { keyring.insert(t.context( format!("Malformed Cert in existing {:?}", path))?)?; } } keyring.insert(cert.cert().clone())?; let mut file = fs::File::create(&path)?; keyring.export(&mut file)?; // Keep track of the WELL_KNOWN base path. well_known = Some(path .parent().expect("by construction") .parent().expect("by construction") .to_path_buf()); } // Create policy file if it does not exist. match std::fs::OpenOptions::new().write(true).create_new(true) .open(well_known.expect("at least one address").join("policy")) { Err(ref e) if e.kind() == std::io::ErrorKind::AlreadyExists => (), r => drop(r?), } Ok(()) } #[derive(Default)] struct KeyRing(HashMap); impl KeyRing { fn insert(&mut self, cert: Cert) -> Result<()> { let fp = cert.fingerprint(); if let Some(existing) = self.0.get_mut(&fp) { *existing = existing.clone().merge_public(cert)?; } else { self.0.insert(fp, cert); } Ok(()) } fn export(&self, o: &mut dyn std::io::Write) -> openpgp::Result<()> { for cert in self.0.values() { cert.export(o)?; } Ok(()) } } /// Errors for this module. #[derive(thiserror::Error, Debug)] #[non_exhaustive] pub enum Error { /// A requested cert was not found. #[error("Cert not found")] NotFound(#[from] reqwest::Error), } #[cfg(test)] mod tests { use super::*; use self::Variant::*; #[test] fn encode_local_part_succed() { let encoded_part = encode_local_part("test1"); assert_eq!("stnkabub89rpcphiz4ppbxixkwyt1pic", encoded_part); assert_eq!(32, encoded_part.len()); } #[test] fn email_address_from() { let email_address = EmailAddress::from("test1@example.com").unwrap(); assert_eq!(email_address.domain, "example.com"); assert_eq!(email_address.local_part, "test1"); assert!(EmailAddress::from("thisisnotanemailaddress").is_err()); } #[test] fn url_roundtrip() { // Advanced method let expected_url = "https://openpgpkey.example.com/\ .well-known/openpgpkey/example.com/hu/\ stnkabub89rpcphiz4ppbxixkwyt1pic?l=test1"; let wkd_url = Url::from("test1@example.com").unwrap(); assert_eq!(expected_url, wkd_url.to_string()); assert_eq!(reqwest::Url::parse(expected_url).unwrap(), wkd_url.to_url(None).unwrap()); assert_eq!(expected_url.parse::().unwrap(), wkd_url.to_url(None).unwrap()); // Direct method let expected_url = "https://example.com/\ .well-known/openpgpkey/hu/\ stnkabub89rpcphiz4ppbxixkwyt1pic?l=test1"; assert_eq!(expected_url, wkd_url.build(Direct)); assert_eq!(reqwest::Url::parse(expected_url).unwrap(), wkd_url.to_url(Direct).unwrap()); assert_eq!(expected_url.parse::().unwrap(), wkd_url.to_url(Direct).unwrap()); } #[test] fn url_to_file_path() { // Advanced method let expected_path = ".well-known/openpgpkey/example.com/hu/\ stnkabub89rpcphiz4ppbxixkwyt1pic"; let wkd_url = Url::from("test1@example.com").unwrap(); assert_eq!(expected_path, wkd_url.to_file_path(None).unwrap().to_str().unwrap()); // Direct method let expected_path = ".well-known/openpgpkey/hu/\ stnkabub89rpcphiz4ppbxixkwyt1pic"; assert_eq!(expected_path, wkd_url.to_file_path(Direct).unwrap().to_str().unwrap()); } #[test] fn test_parse_body() { let (cert, _) = CertBuilder::new() .add_userid("test@example.example") .generate() .unwrap(); let mut buffer: Vec = Vec::new(); cert.serialize(&mut buffer).unwrap(); let valid_certs = parse_body(&buffer, "juga@sequoia-pgp.org"); // The userid is not in the Cert assert!(valid_certs.is_err()); // XXX: add userid to the cert, instead of creating a new one // cert.add_userid("juga@sequoia.org"); let (cert, _) = CertBuilder::new() .add_userid("test@example.example") .add_userid("juga@sequoia-pgp.org") .generate() .unwrap(); cert.serialize(&mut buffer).unwrap(); let valid_certs = parse_body(&buffer, "juga@sequoia-pgp.org"); assert!(valid_certs.is_ok()); assert!(valid_certs.unwrap().len() == 1); // XXX: Test with more Certs } #[test] fn wkd_generate() { let (cert, _) = CertBuilder::new() .add_userid("test1@example.example") .add_userid("juga@sequoia-pgp.org") .generate() .unwrap(); let (cert2, _) = CertBuilder::new() .add_userid("justus@sequoia-pgp.org") .generate() .unwrap(); let dir = tempfile::tempdir().unwrap(); let dir_path = dir.path(); insert(&dir_path, "sequoia-pgp.org", None, &cert).unwrap(); insert(&dir_path, "sequoia-pgp.org", None, &cert2).unwrap(); // justus and juga files will be generated, but not test one. let path = dir_path.join( ".well-known/openpgpkey/sequoia-pgp.org/hu\ /jwp7xjqkdujgz5op6bpsoypg34pnrgmq"); // Check that justus file was created assert!(path.is_file()); let path = dir_path.join( ".well-known/openpgpkey/sequoia-pgp.org/hu\ /7t1uqk9cwh1955776rc4z1gqf388566j"); // Check that juga file was created. assert!(path.is_file()); // Check that the file for test uid is not created. let path = dir_path.join( ".well-known/openpgpkey/example.com/hu/\ stnkabub89rpcphiz4ppbxixkwyt1pic"); assert!(!path.is_file()); } #[test] fn test_get_cert_domains() -> Result<()> { let (cert, _) = CertBuilder::new() .add_userid("test1@example.example") .add_userid("juga@sequoia-pgp.org") .generate() .unwrap(); let policy = &StandardPolicy::new(); let user_ids: Vec<_> = get_cert_domains("sequoia-pgp.org", &cert.with_policy(policy, None)?) .map(|addr| addr.to_string()) .collect(); assert_eq!(user_ids, vec!["https://openpgpkey.sequoia-pgp.org/.well-known/openpgpkey/sequoia-pgp.org/hu/7t1uqk9cwh1955776rc4z1gqf388566j?l=juga"]); let user_ids: Vec<_> = get_cert_domains("example.example", &cert.with_policy(policy, None)?) .map(|addr| addr.to_string()) .collect(); assert_eq!(user_ids, vec!["https://openpgpkey.example.example/.well-known/openpgpkey/example.example/hu/stnkabub89rpcphiz4ppbxixkwyt1pic?l=test1"]); Ok(()) } #[test] fn test_cert_contains_domain_userid() -> Result<()> { let (cert, _) = CertBuilder::new() .add_userid("test1@example.example") .add_userid("juga@sequoia-pgp.org") .generate() .unwrap(); let policy = &StandardPolicy::new(); assert!(cert_contains_domain_userid("sequoia-pgp.org", &cert.with_policy(policy, None)?)); assert!(cert_contains_domain_userid("example.example", &cert.with_policy(policy, None)?)); assert!(!cert_contains_domain_userid("example.org", &cert.with_policy(policy, None)?)); Ok(()) } } sequoia-net-0.28.0/tests/hkp.rs000064400000000000000000000125751046102023000144510ustar 00000000000000use http::{Request, Response}; use hyper::{Server, Body}; use hyper::service::{make_service_fn, service_fn}; use hyper::{Method, StatusCode}; use rand::RngCore; use rand::rngs::OsRng; use std::io::Cursor; use std::net::{SocketAddr, IpAddr, Ipv4Addr}; use sequoia_openpgp::KeyID; use sequoia_openpgp::armor::Reader; use sequoia_openpgp::Cert; use sequoia_openpgp::parse::Parse; use sequoia_net::KeyServer; const RESPONSE: &str = "-----BEGIN PGP PUBLIC KEY BLOCK----- xsBNBFoVcvoBCACykTKOJddF8SSUAfCDHk86cNTaYnjCoy72rMgWJsrMLnz/V16B J9M7l6nrQ0JMnH2Du02A3w+kNb5q97IZ/M6NkqOOl7uqjyRGPV+XKwt0G5mN/ovg 8630BZAYS3QzavYf3tni9aikiGH+zTFX5pynTNfYRXNBof3Xfzl92yad2bIt4ITD NfKPvHRko/tqWbclzzEn72gGVggt1/k/0dKhfsGzNogHxg4GIQ/jR/XcqbDFR3RC /JJjnTOUPGsC1y82Xlu8udWBVn5mlDyxkad5laUpWWg17anvczEAyx4TTOVItLSu 43iPdKHSs9vMXWYID0bg913VusZ2Ofv690nDABEBAAG0JFRlc3R5IE1jVGVzdGZh Y2UgPHRlc3R5QGV4YW1wbGUub3JnPsLAlAQTAQgAPhYhBD6Id8h3J0aSl1GJ9dA/ b4ZSJv6LBQJaFXL6AhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMBAh4BAheAAAoJ ENA/b4ZSJv6Lxo8H/1XMt+Nqa6e0SG/up3ypKe5nplA0p/9j/s2EIsP8S8uPUd+c WS17XOmPwkNDmHeL3J6hzwL74NlYSLEtyf7WoOV74xAKQA9WkqaKPHCtpll8aFWA ktQDLWTPeKuUuSlobAoRtO17ZmheSQzmm7JYt4Ahkxt3agqGT05OsaAey6nIKqpq ArokvdHTZ7AFZeSJIWmuCoT9M1lo3LAtLnRGOhBMJ5dDIeOwflJwNBXlJVi4mDPK +fumV0MbSPvZd1/ivFjSpQyudWWtv1R1nAK7+a4CPTGxPvAQkLtRsL/V+Q7F3BJG jAn4QVx8p4t3NOPuNgcoZpLBE3sc4Nfs5/CphMLOwE0EWhVy+gEIALSpjYD+tuWC rj6FGP6crQjQzVlH+7axoM1ooTwiPs4fzzt2iLw3CJyDUviM5F9ZBQTei635RsAR a/CJTSQYAEU5yXXxhoe0OtwnuvsBSvVT7Fox3pkfNTQmwMvkEbodhfKpqBbDKCL8 f5A8Bb7aISsLf0XRHWDkHVqlz8LnOR3f44wEWiTeIxLc8S1QtwX/ExyW47oPsjs9 ShCmwfSpcngH/vGBRTO7WeI54xcAtKSm/20B/MgrUl5qFo17kUWot2C6KjuZKkHk 3WZmJwQz+6rTB11w4AXt8vKkptYQCkfat2FydGpgRO5dVg6aWNJefOJNkC7MmlzC ZrrAK8FJ6jcAEQEAAcLAdgQYAQgAIBYhBD6Id8h3J0aSl1GJ9dA/b4ZSJv6LBQJa FXL6AhsMAAoJENA/b4ZSJv6Lt7kH/jPr5wg8lcamuLj4lydYiLttvvTtDTlD1TL+ IfwVARB/ruoerlEDr0zX1t3DCEcvJDiZfOqJbXtHt70+7NzFXrYxfaNFmikMgSQT XqHrMQho4qpseVOeJPWGzGOcrxCdw/ZgrWbkDlAU5KaIvk+M4wFPivjbtW2Ro2/F J4I/ZHhJlIPmM+hUErHC103b08pBENXDQlXDma7LijH5kWhyfF2Ji7Ft0EjghBaW AeGalQHjc5kAZu5R76Mwt06MEQ/HL1pIvufTFxkr/SzIv8Ih7Kexb0IrybmfD351 Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= =z5uK -----END PGP PUBLIC KEY BLOCK----- "; const FP: &str = "3E8877C877274692975189F5D03F6F865226FE8B"; const ID: &str = "D03F6F865226FE8B"; async fn service(req: Request) -> Result, Box> { let (parts, body) = req.into_parts(); match (parts.method, parts.uri.path()) { (Method::GET, "/pks/lookup") => { if let Some(args) = parts.uri.query() { for (key, value) in url::form_urlencoded::parse(args.as_bytes()) { match key.clone().into_owned().as_ref() { "op" => assert_eq!(value, "get"), "options" => assert_eq!(value, "mr"), "search" => assert_eq!(value, "0xD03F6F865226FE8B"), _ => panic!("Bad query: {}:{}", key, value), } } } else { panic!("Expected query string"); } Ok(Response::new(Body::from(RESPONSE))) }, (Method::POST, "/pks/add") => { let b = hyper::body::to_bytes(body).await?; for (key, value) in url::form_urlencoded::parse(b.as_ref()) { match key.clone().into_owned().as_ref() { "keytext" => { let key = Cert::from_reader( Reader::from_reader(Cursor::new(value.into_owned()), None)).unwrap(); assert_eq!( key.fingerprint(), FP.parse() .unwrap()); }, _ => panic!("Bad post: {}:{}", key, value), } } Ok(Response::new(Body::from("Ok"))) }, _ => { Ok(Response::builder() .status(StatusCode::NOT_FOUND) .body(Body::from("Not found")).unwrap()) }, } } /// Starts a server on a random port. /// /// Returns the address, a channel to drop() to kill the server, and /// the thread handle to join the server thread. fn start_server() -> SocketAddr { let (addr, server) = loop { let port = OsRng.next_u32() as u16; let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port); if let Ok(s) = Server::try_bind(&addr) { break (addr, s); } }; let start_server = server.serve(make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(service)) })); tokio::spawn(start_server); addr } #[tokio::test] async fn get() -> anyhow::Result<()> { // Start server. let addr = start_server(); let keyserver = KeyServer::new(&format!("hkp://{}", addr))?; let keyid: KeyID = ID.parse()?; let keys = keyserver.get(keyid).await?; assert_eq!(keys.len(), 1); assert_eq!(keys[0].as_ref().unwrap().fingerprint(), FP.parse().unwrap()); Ok(()) } #[tokio::test] async fn send() -> anyhow::Result<()> { // Start server. let addr = start_server(); eprintln!("{}", format!("hkp://{}", addr)); let keyserver = KeyServer::new(&format!("hkp://{}", addr))?; let key = Cert::from_reader(Reader::from_reader(Cursor::new(RESPONSE), None))?; keyserver.send(&key).await?; Ok(()) }