sequoia-policy-config-0.6.0/.cargo/config.toml000064400000000000000000000002511046102023000173460ustar 00000000000000[target.'cfg(all())'] # Note: if the RUSTFLAGS environment variable is set, this will be # ignored. rustflags = [ "-Dwarnings", "-Aunused-parens", ] sequoia-policy-config-0.6.0/.cargo_vcs_info.json0000644000000001360000000000100152450ustar { "git": { "sha1": "b5aaa1ac7e1d70f6097c892efbd88b6f91e018a1" }, "path_in_vcs": "" }sequoia-policy-config-0.6.0/.ci/all_commits.sh000075500000000000000000000022711046102023000173520ustar 00000000000000#!/usr/bin/env bash # Test all commits on this branch but the last one. # # Used in the all_commits ci job to ensure all commits build # and tests pass at least for the sequoia-openpgp crate. # NOTE: under gitlab's Settings, "CI/CD", General Pipelines ensure # that the "git shallow clone" setting is set to 0. Otherwise other # branch are not fetched. set -e set -x # Use dummy identity to make git rebase happy. git config user.name "C.I. McTestface" git config user.email "ci.mctestface@example.com" # Make sure the gitlab project is configured. if ! git describe --all origin/main then echo "origin/main is not present. Configure the gitlab project (see .ci/all_commits.sh)." exit 1 fi # If the previous commit already is on main we're done. git merge-base --is-ancestor HEAD~ origin/main && echo "All commits tested already" && exit 0 # Leave out the last commit - it has already been checked. git checkout HEAD~ git status git rebase origin/main \ --exec 'echo ===; echo ===; echo ===; git log -n 1;' \ --exec 'cargo test --all' && echo "All commits passed tests" && exit 0 # The rebase failed - probably because a test failed. git rebase --abort; exit 1 sequoia-policy-config-0.6.0/.codespellrc000064400000000000000000000004031046102023000163320ustar 00000000000000[codespell] skip = *.bin,*.gpg,*.pgp,./.git,data,highlight.js,*/target,Makefile,*.html,*/cargo,*.xml,*.xmlv2, ignore-words-list = crate,ede,iff,mut,nd,te,uint,KeyServer,keyserver,Keyserver,keyservers,Keyservers,keypair,keypairs,KeyPair,fpr,dedup,ba,captable, sequoia-policy-config-0.6.0/.gitignore000064400000000000000000000000101046102023000160140ustar 00000000000000/target sequoia-policy-config-0.6.0/.gitlab-ci.yml000064400000000000000000000067501046102023000165010ustar 00000000000000# Only ever create pipelines for tags or branches. # Avoid creation of detached pipelines for merge requests. workflow: rules: - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH stages: - lint - test - deploy # These stanzas do some common management tasks before and after the # job-specific before_script and after_script stanzas are run. # before_script_start configures any default global state. The # job-specific before_script can override this state, if required. # before_script_end prints out information about the environment to # improve debugging; it does not modify the environment. # after_script_end does some common management tasks after the # job-specific after_script is run. It prints information about the # environment, and does some clean up. # # Add this to your stanza as follows: # # before_script: # - *before_script_start # - *** YOUR CODE HERE *** # - *before_script_end # after_script: # - *** YOUR CODE HERE *** # - *after_script_end .before_script_start: &before_script_start - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "\$RUSTFLAGS is set ($RUSTFLAGS)"; exit 1; fi' .before_script_end: &before_script_end - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "WARNING: before_script set \$RUSTFLAGS ($RUSTFLAGS)"; fi' - rustc --version --verbose - cargo --version - clang -v - if [ -d $CARGO_TARGET_DIR ]; then find $CARGO_TARGET_DIR | wc --lines; du -sh $CARGO_TARGET_DIR; fi - if [ -d $CARGO_HOME ]; then find $CARGO_HOME | wc --lines; du -sh $CARGO_HOME; fi .after_script_end: &after_script_end - if [ -d $CARGO_TARGET_DIR ]; then du -sh $CARGO_TARGET_DIR; fi - if [ -d $CARGO_HOME ]; then du -sh $CARGO_HOME; fi before_script: - *before_script_start - *before_script_end after_script: - *after_script_end cache: &general_cache_config # default key is default # default policy is pull-push paths: - $CARGO_TARGET_DIR - $CARGO_HOME .rust-stable: image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable:latest before_script: - *before_script_start - *before_script_end after_script: - *after_script_end cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "rust-stable" .bookworm: image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm:latest before_script: - *before_script_start - *before_script_end after_script: - *after_script_end cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "bookworm" codespell: stage: lint extends: .bookworm before_script: - *before_script_start - codespell --version - *before_script_end script: - codespell --config .codespellrc --summary after_script: [] test-bookworm: stage: test extends: .bookworm script: - cargo test --all test-rust-stable: stage: test extends: .rust-stable script: - cargo test --all deny: stage: lint extends: .rust-stable script: - cargo deny check rules: - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' when: manual allow_failure: true - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' allow_failure: false cache: [] all_commits: # Test each commit up to main, to facilitate bisecting. stage: test extends: .bookworm script: - .ci/all_commits.sh variables: GIT_STRATEGY: clone variables: CARGO_HOME: cargo/ CARGO_FLAGS: --color always CARGO_INCREMENTAL: 0 CARGO_TARGET_DIR: target/ sequoia-policy-config-0.6.0/Cargo.lock0000644000001160010000000000100132170ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "aead" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ "generic-array", ] [[package]] name = "aho-corasick" version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[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.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "ascii-canvas" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" dependencies = [ "term", ] [[package]] name = "assert_cmd" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5c2ca00549910ec251e3bd15f87aeeb206c9456b9a77b43ff6c97c54042a472" dependencies = [ "bstr", "doc-comment", "predicates", "predicates-core", "predicates-tree", "wait-timeout", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", "winapi", ] [[package]] name = "autocfg" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ "autocfg 1.1.0", ] [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bindgen" version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd4865004a46a0aafb2a0a5eb19d3c9fc46ee5f063a6cfc605c69ac9ecf5263d" dependencies = [ "bitflags", "cexpr", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", ] [[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 = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "generic-array", ] [[package]] name = "bstr" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", "regex-automata", ] [[package]] name = "buffered-reader" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f82920285502602088677aeb65df0909b39c347b38565e553ba0363c242f65" dependencies = [ "libc", ] [[package]] name = "bumpalo" version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cexpr" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" 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.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", "num-integer", "num-traits", "time", "wasm-bindgen", "winapi", ] [[package]] name = "cipher" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ "generic-array", ] [[package]] name = "clang-sys" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob", "libc", "libloading", ] [[package]] name = "cmac" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73d4de4f7724e5fe70addfb2bd37c2abd2f95084a429d7773b0b9645499b4272" dependencies = [ "crypto-mac", "dbl", ] [[package]] name = "codespan-reporting" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ "termcolor", "unicode-width", ] [[package]] name = "core-foundation-sys" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-mac" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ "cipher", "generic-array", "subtle", ] [[package]] name = "ctr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ "cipher", ] [[package]] name = "curve25519-dalek" version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ "byteorder", "digest", "rand_core", "subtle", "zeroize", ] [[package]] name = "cxx" version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" dependencies = [ "cc", "cxxbridge-flags", "cxxbridge-macro", "link-cplusplus", ] [[package]] name = "cxx-build" version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" dependencies = [ "cc", "codespan-reporting", "once_cell", "proc-macro2", "quote", "scratch", "syn", ] [[package]] name = "cxxbridge-flags" version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" [[package]] name = "cxxbridge-macro" version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "dbl" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ "generic-array", ] [[package]] name = "diff" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "difflib" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] [[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.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[package]] name = "eax" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1f76e7a5e594b299a0fa9a99de627530725e341df41376aa342aecb2c5eb76e" dependencies = [ "aead", "cipher", "cmac", "ctr", "subtle", ] [[package]] name = "ed25519" version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" dependencies = [ "signature", ] [[package]] name = "ed25519-dalek" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", "rand", "sha2", "zeroize", ] [[package]] name = "either" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "ena" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" dependencies = [ "log", ] [[package]] name = "fastrand" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] [[package]] name = "fixedbitset" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "generic-array" version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "getrandom" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "iana-time-zone" version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi", ] [[package]] name = "iana-time-zone-haiku" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" dependencies = [ "cxx", "cxx-build", ] [[package]] name = "idna" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ "unicode-bidi", "unicode-normalization", ] [[package]] name = "indexmap" version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg 1.1.0", "hashbrown", ] [[package]] name = "instant" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] [[package]] name = "itertools" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "js-sys" version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] [[package]] name = "lalrpop" version = "0.19.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823" dependencies = [ "ascii-canvas", "atty", "bit-set", "diff", "ena", "itertools", "lalrpop-util", "petgraph", "regex", "regex-syntax", "string_cache", "term", "tiny-keccak", "unicode-xid", ] [[package]] name = "lalrpop-util" version = "0.19.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4" [[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.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "link-cplusplus" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" dependencies = [ "cc", ] [[package]] name = "lock_api" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg 1.1.0", "scopeguard", ] [[package]] name = "log" version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memsec" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ac78937f19a0c7807e45a931eac41f766f210173ec664ec046d58e6d388a5cb" [[package]] name = "nettle" version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d193a809310369c5d16e45bc0a88cb27935edd5d3375bcfc2371b167694035" dependencies = [ "getrandom 0.2.8", "libc", "nettle-sys", "thiserror", ] [[package]] name = "nettle-sys" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b13b685c7883e3a32196ccf3ce594947ec37ace43d74e157de7ca03d3fe62d17" 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 = "nom" version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ "memchr", "version_check", ] [[package]] name = "num-bigint-dig" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d51546d704f52ef14b3c962b5776e53d5b862e5790e40a350d366c209bd7f7a" dependencies = [ "autocfg 0.1.8", "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 1.1.0", "num-traits", ] [[package]] name = "num-iter" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg 1.1.0", "num-integer", "num-traits", ] [[package]] name = "num-traits" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg 1.1.0", ] [[package]] name = "once_cell" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[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.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", "windows-sys", ] [[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "petgraph" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" 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 = "pkg-config" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[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 = "predicates" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" dependencies = [ "difflib", "itertools", "predicates-core", ] [[package]] name = "predicates-core" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" [[package]] name = "predicates-tree" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" dependencies = [ "predicates-core", "termtree", ] [[package]] name = "proc-macro2" version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", "rand_chacha", "rand_core", "rand_hc", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ "getrandom 0.1.16", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ "rand_core", ] [[package]] name = "redox_syscall" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "redox_users" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.8", "redox_syscall", "thiserror", ] [[package]] name = "regex" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ "winapi", ] [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustversion" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "sequoia-openpgp" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d9033c24b1d41fdfab2bbde66005d324625b4abee2af2aea6135bdd9543ff7" dependencies = [ "anyhow", "base64", "buffered-reader", "chrono", "dyn-clone", "eax", "ed25519-dalek", "getrandom 0.2.8", "idna", "lalrpop", "lalrpop-util", "lazy_static", "libc", "memsec", "nettle", "num-bigint-dig", "rand", "regex", "regex-syntax", "sha1collisiondetection", "thiserror", "win-crypto-ng", "winapi", "xxhash-rust", ] [[package]] name = "sequoia-policy-config" version = "0.6.0" dependencies = [ "anyhow", "assert_cmd", "chrono", "lazy_static", "sequoia-openpgp", "serde", "thiserror", "toml", ] [[package]] name = "serde" version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" [[package]] name = "sha1collisiondetection" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66558a774ef5044cb4a834db5f5c7f95e139d2341d7f502fe6034afa7082461" dependencies = [ "digest", "generic-array", ] [[package]] name = "sha2" version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer", "cfg-if", "cpufeatures", "digest", "opaque-debug", ] [[package]] name = "shlex" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "siphasher" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "string_cache" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" dependencies = [ "new_debug_unreachable", "once_cell", "parking_lot", "phf_shared", "precomputed-hash", ] [[package]] name = "subtle" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "synstructure" version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", "syn", "unicode-xid", ] [[package]] name = "tempfile" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", "winapi", ] [[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 = "termcolor" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] [[package]] name = "termtree" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" [[package]] name = "thiserror" version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "time" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] [[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.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "toml" version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[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-width" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode-xid" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[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 = "wait-timeout" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" dependencies = [ "libc", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[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.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "win-crypto-ng" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24cf92e98e8f4ade45b5140795415a0f256fd9b69a1919248dcda11ba5d6466c" 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-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ "winapi", ] [[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-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 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.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" [[package]] name = "windows_aarch64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" [[package]] name = "windows_i686_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" [[package]] name = "windows_i686_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" [[package]] name = "windows_x86_64_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" [[package]] name = "windows_x86_64_gnullvm" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" [[package]] name = "windows_x86_64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "xxhash-rust" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" [[package]] name = "zeroize" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] sequoia-policy-config-0.6.0/Cargo.toml0000644000000033640000000000100132510ustar # 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.60" name = "sequoia-policy-config" version = "0.6.0" authors = ["Neal H. Walfield "] build = "build.rs" description = "Configure Sequoia using a configuration file." homepage = "https://sequoia-pgp.org/" readme = "README.md" keywords = [ "cryptography", "openpgp", ] license = "LGPL-2.0-or-later" repository = "https://gitlab.com/sequoia-pgp/sequoia-policy-config" [package.metadata.docs.rs] features = ["sequoia-openpgp/default"] [lib] name = "sequoia_policy_config" path = "src/lib.rs" [[bin]] name = "sequoia-policy-config-check" path = "src/check.rs" [dependencies.anyhow] version = "1.0.18" [dependencies.chrono] version = "0.4" [dependencies.sequoia-openpgp] version = "1.11" default-features = false [dependencies.serde] version = "1.0" [dependencies.thiserror] version = "1.0.2" [dependencies.toml] version = "0.5" [dev-dependencies.assert_cmd] version = "2" [dev-dependencies.lazy_static] version = "1.4.0" [target."cfg(not(windows))".dev-dependencies.sequoia-openpgp] version = "1.11" features = ["crypto-nettle"] default-features = false [target."cfg(windows)".dev-dependencies.sequoia-openpgp] version = "1.11" features = ["crypto-cng"] default-features = false [badges.maintenance] status = "actively-developed" sequoia-policy-config-0.6.0/Cargo.toml.orig000064400000000000000000000024441046102023000167300ustar 00000000000000[package] name = "sequoia-policy-config" authors = ["Neal H. Walfield "] homepage = "https://sequoia-pgp.org/" repository = "https://gitlab.com/sequoia-pgp/sequoia-policy-config" readme = "README.md" keywords = ["cryptography", "openpgp" ] description = "Configure Sequoia using a configuration file." license = "LGPL-2.0-or-later" version = "0.6.0" edition = "2021" rust-version = "1.60" build = "build.rs" [badges] maintenance = { status = "actively-developed" } [lib] name = "sequoia_policy_config" path = "src/lib.rs" [[bin]] name = "sequoia-policy-config-check" path = "src/check.rs" [dependencies] anyhow = "1.0.18" chrono = "0.4" sequoia-openpgp = { version = "1.11", default-features = false } serde = "1.0" thiserror = "1.0.2" toml = "0.5" [dev-dependencies] lazy_static = "1.4.0" assert_cmd = "2" [target.'cfg(not(windows))'.dev-dependencies] # Enables a crypto backend for the tests: sequoia-openpgp = { version = "1.11", default-features = false, features = ["crypto-nettle"] } [target.'cfg(windows)'.dev-dependencies] # Enables a crypto backend for the tests: sequoia-openpgp = { version = "1.11", default-features = false, features = ["crypto-cng"] } [package.metadata.docs.rs] # Enables a crypto backend for the docs.rs generation: features = ["sequoia-openpgp/default"] sequoia-policy-config-0.6.0/LICENSE.txt000064400000000000000000000627341046102023000156740ustar 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-policy-config-0.6.0/README.md000064400000000000000000000044521046102023000153210ustar 00000000000000A library for reading the configuration of [Sequoia]'s `StandardPolicy` from a configuration file. [Sequoia]: https://sequoia-pgp.org [`StandardPolicy`]: https://docs.rs/sequoia-openpgp/1.11.0/sequoia_openpgp/policy/struct.StandardPolicy.html Sequoia's [`StandardPolicy`] can be configured using Rust. As with most things, Sequoia's low-level library avoids imposing a policy on users of the library, like where a configuration file should be or even what format it should have. When necessary, it is up to the application to provide an interface, and to configure the policy appropriately. This library provides a high-level interface that parses a configuration file, and returns a configured `StandardPolicy`. See the crate's documentation for a description of the file format. ## Quick Start To add `sequoia-policy-config` to your crate add the following your crate: ```toml [dependencies] sequoia-openpgp = { version = "1" } sequoia-policy-config = { version = "0.6" } ``` This will use `sequoia-openpgp`'s default cryptographic backend, which is currently Nettle. To select a different cryptographic backend, such as OpenSSL, you can then do: ```shell cargo build --release --no-default-features --features sequoia-openpgp/crypto-openssl ``` To use `sequoia-policy-config` in your crate, it is usually enough to replace the use of `StandardPolicy::new` with the following:: ```rust use sequoia_policy_config::ConfiguredStandardPolicy; fn main() -> openpgp::Result<()> { let mut p = ConfiguredStandardPolicy::new(); p.from_bytes(b"[hash_algorithms] sha1.collision_resistance = \"never\"")?; let p = &p.build(); // ... Ok(()) } ``` ## Building This crate is purely a library, so it is not usually built directly. If you do build it (e.g., because you are modifying it), you'll need to select a cryptographic backend. See [`sequoia-openpgp`'s README] for details. [`sequoia-openpgp`'s README]: https://gitlab.com/sequoia-pgp/sequoia#features The short version is: ``` # Use the Nettle backend: $ cargo build --release --features sequoia-openpgp/crypto-nettle $ cargo test --release --features sequoia-openpgp/crypto-nettle # Use the OpenSSL backend: $ cargo build --release --features sequoia-openpgp/crypto-openssl $ cargo test --release --features sequoia-openpgp/crypto-openssl ``` sequoia-policy-config-0.6.0/build.rs000064400000000000000000000023171046102023000155050ustar 00000000000000use std::env; use std::fs; use std::io; use std::io::Write; use std::path::PathBuf; /// Builds the index of the test data for use with the `::testdata` /// module. fn include_test_data() -> io::Result<()> { let cwd = env::current_dir()?; let mut sink = fs::File::create( PathBuf::from(env::var_os("OUT_DIR").unwrap()) .join("tests.index.rs.inc")).unwrap(); writeln!(&mut sink, "{{")?; let mut dirs = vec![PathBuf::from("tests/data")]; while let Some(dir) = dirs.pop() { println!("rerun-if-changed={}", dir.to_str().unwrap()); for entry in fs::read_dir(dir).unwrap() { let entry = entry?; let path = entry.path(); if path.is_file() { writeln!( &mut sink, " add!({:?}, {:?});", path.components().skip(2) .map(|c| c.as_os_str().to_str().expect("valid UTF-8")) .collect::>().join("/"), cwd.join(path))?; } else if path.is_dir() { dirs.push(path.clone()); } } } writeln!(&mut sink, "}}")?; Ok(()) } fn main() { include_test_data().unwrap(); } sequoia-policy-config-0.6.0/deny.toml000064400000000000000000000221011046102023000156650ustar 00000000000000# This template contains all of the possible sections and their default values # Note that all fields that take a lint level have these possible values: # * deny - An error will be produced and the check will fail # * warn - A warning will be produced, but the check will not fail # * allow - No warning or error will be produced, though in some cases a note # will be # The values provided in this template are the default values that will be used # when any section or field is not specified in your own configuration # If 1 or more target triples (and optionally, target_features) are specified, # only the specified targets will be checked when running `cargo deny check`. # This means, if a particular package is only ever used as a target specific # dependency, such as, for example, the `nix` crate only being used via the # `target_family = "unix"` configuration, that only having windows targets in # this list would mean the nix crate, as well as any of its exclusive # dependencies not shared by any other crates, would be ignored, as the target # list here is effectively saying which targets you are building for. targets = [ # The triple can be any string, but only the target triples built in to # rustc (as of 1.40) can be checked against actual config expressions #{ triple = "x86_64-unknown-linux-musl" }, # You can also specify which target_features you promise are enabled for a # particular target. target_features are currently not validated against # the actual valid features supported by the target architecture. #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, ] # This section is considered when running `cargo deny check advisories` # More documentation for the advisories section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html [advisories] # The path where the advisory database is cloned/fetched into db-path = "~/.cargo/advisory-db" # The url(s) of the advisory databases to use db-urls = ["https://github.com/rustsec/advisory-db"] # The lint level for security vulnerabilities vulnerability = "deny" # The lint level for unmaintained crates unmaintained = "warn" # The lint level for crates that have been yanked from their source registry yanked = "warn" # The lint level for crates with security notices. Note that as of # 2019-12-17 there are no security notice advisories in # https://github.com/rustsec/advisory-db notice = "warn" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ "RUSTSEC-2020-0159", # We do not use local timezones (only UTC). So we are not # impacted by this. "RUSTSEC-2020-0071", ] # Threshold for security vulnerabilities, any vulnerability with a CVSS score # lower than the range specified will be ignored. Note that ignored advisories # will still output a note when they are encountered. # * None - CVSS Score 0.0 # * Low - CVSS Score 0.1 - 3.9 # * Medium - CVSS Score 4.0 - 6.9 # * High - CVSS Score 7.0 - 8.9 # * Critical - CVSS Score 9.0 - 10.0 #severity-threshold = # This section is considered when running `cargo deny check licenses` # More documentation for the licenses section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html [licenses] # The lint level for crates which do not have a detectable license unlicensed = "deny" # List of explicitly allowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.7 short identifier (+ optional exception)]. allow = [ #"MIT", #"Apache-2.0", #"Apache-2.0 WITH LLVM-exception", ] # List of explicitly disallowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.7 short identifier (+ optional exception)]. deny = [ #"Nokia", ] # Lint level for licenses considered copyleft copyleft = "warn" # Blanket approval or denial for OSI-approved or FSF Free/Libre licenses # * both - The license will be approved if it is both OSI-approved *AND* FSF # * either - The license will be approved if it is either OSI-approved *OR* FSF # * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF # * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved # * neither - This predicate is ignored and the default lint level is used allow-osi-fsf-free = "either" # Lint level used when no other predicates are matched # 1. License isn't in the allow or deny lists # 2. License isn't copyleft # 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither" default = "deny" # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the # canonical license text of a valid SPDX license file. # [possible values: any between 0.0 and 1.0]. confidence-threshold = 0.95 # Allow 1 or more licenses on a per-crate basis, so that particular licenses # aren't accepted for every possible crate as with the normal allow list exceptions = [ # Each entry is the crate and version constraint, and its specific allow # list #{ allow = ["Zlib"], name = "adler32", version = "*" }, ] # Some crates don't have (easily) machine readable licensing information, # adding a clarification entry for it allows you to manually specify the # licensing information #[[licenses.clarify]] # The name of the crate the clarification applies to #name = "ring" # The optional version constraint for the crate #version = "*" # The SPDX expression for the license requirements of the crate #expression = "MIT AND ISC AND OpenSSL" # One or more files in the crate's source used as the "source of truth" for # the license expression. If the contents match, the clarification will be used # when running the license check, otherwise the clarification will be ignored # and the crate will be checked normally, which may produce warnings or errors # depending on the rest of your configuration #license-files = [ # Each entry is a crate relative path, and the (opaque) hash of its contents #{ path = "LICENSE", hash = 0xbd0eed23 } #] [licenses.private] # If true, ignores workspace crates that aren't published, or are only # published to private registries ignore = true # One or more private registries that you might publish crates to, if a crate # is only published to private registries, and ignore is true, the crate will # not have its license(s) checked registries = [ #"https://sekretz.com/registry ] # This section is considered when running `cargo deny check bans`. # More documentation about the 'bans' section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html [bans] # Lint level for when multiple versions of the same crate are detected multiple-versions = "warn" # Lint level for when a crate version requirement is `*` wildcards = "deny" # The graph highlighting used when creating dotgraphs for crates # with multiple versions # * lowest-version - The path to the lowest versioned duplicate is highlighted # * simplest-path - The path to the version with the fewest edges is highlighted # * all - Both lowest-version and simplest-path are used highlight = "all" # List of crates that are allowed. Use with care! allow = [ #{ name = "ansi_term", version = "=0.11.0" }, ] # List of crates to deny deny = [ # Each entry the name of a crate and a version range. If version is # not specified, all versions will be matched. #{ name = "ansi_term", version = "=0.11.0" }, # # Wrapper crates can optionally be specified to allow the crate when it # is a direct dependency of the otherwise banned crate #{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, ] # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ #{ name = "ansi_term", version = "=0.11.0" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is # by default infinite skip-tree = [ #{ name = "ansi_term", version = "=0.11.0", depth = 20 }, ] # This section is considered when running `cargo deny check sources`. # More documentation about the 'sources' section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html [sources] # Lint level for what to happen when a crate from a crate registry that is not # in the allow list is encountered unknown-registry = "warn" # Lint level for what to happen when a crate from a git repository that is not # in the allow list is encountered unknown-git = "warn" # List of URLs for allowed crate registries. Defaults to the crates.io index # if not specified. If it is specified but empty, no registries are allowed. allow-registry = ["https://github.com/rust-lang/crates.io-index"] # List of URLs for allowed Git repositories allow-git = [] [sources.allow-org] # 1 or more github.com organizations to allow git sources for #github = [""] # 1 or more gitlab.com organizations to allow git sources for #gitlab = [""] # 1 or more bitbucket.org organizations to allow git sources for #bitbucket = [""] sequoia-policy-config-0.6.0/doc/release-checklist.md000064400000000000000000000031571046102023000205210ustar 00000000000000This is a checklist for doing releases. 1. Start from `origin/main`, create a branch `staging`. 1. Switch to the branch. 1. Bump the version in `Cargo.toml` to `XXX`. 1. Bump the version in `README.md` to `XXX`. 1. Run `cargo check` (this implicitly updates `Cargo.lock`). 1. Update dependencies and run tests. - Use the exact Rust toolchain version of the current Sequoia MSRV (refer to `Cargo.toml`): `rustup default 1.xx` - Run `cargo update` to update the dependencies. If some dependency is updated and breaks due to our MSRV, find a good version of that dependency and select it using e.g. `cargo update -p backtrace --precise -3.46`. - Run `cargo build && cargo check` 1. Commit changes to `Cargo.toml` and `Cargo.lock`. 1. Make a commit with the message `Release XXX.`. - Push to gitlab, and create a merge request. Don't auto merge!!! 1. Make sure `cargo publish` works: - `mkdir -p /tmp/sequoia-staging` - `cd /tmp/sequoia-staging` - `git clone git@gitlab.com:sequoia-pgp/sequoia-policy-config.git` - `cd sequoia-policy-config` - `git checkout origin/staging` - `cargo publish --features sequoia-openpgp/crypto-nettle --dry-run` 1. Wait until CI and `cargo publish ... --dry-run` are successful. In case of errors, correct them, and restart. 1. Merge the merge request. 1. Run `cargo publish --features sequoia-openpgp/crypto-nettle`. 1. Make a tag `vXXX` with the message `Release XXX.` signed with an offline-key, which has been certified by our `openpgp-ca@sequoia-pgp.org` key. 1. Push the signed tag `vXXX`. sequoia-policy-config-0.6.0/src/check.rs000064400000000000000000000017011046102023000162460ustar 00000000000000use std::io::Read; use std::fs::File; use sequoia_openpgp as openpgp; use openpgp::Result; use sequoia_policy_config::ConfiguredStandardPolicy; fn usage() -> ! { let binary = std::env::args().next() .unwrap_or_else(|| String::from("sequoia-policy-config-check")); eprintln!("Usage: {} [config.toml]", binary); eprintln!(""); eprintln!("If no configuration is supplied, the default configuration \ is checked."); std::process::exit(1); } fn main() -> Result<()> { let mut args = std::env::args(); if args.len() > 2 { eprintln!("Expected at most one argument."); usage(); } let mut p = ConfiguredStandardPolicy::new(); if let Some(filename) = args.nth(1) { let mut file = File::open(filename)?; let mut bytes = Vec::new(); file.read_to_end(&mut bytes)?; p.parse_bytes(bytes)?; } else { p.parse_default_config()?; } Ok(()) } sequoia-policy-config-0.6.0/src/lib.rs000064400000000000000000001766421046102023000157600ustar 00000000000000//! Configures a `StandardPolicy` using a configuration file. //! //! Sequoia's [`StandardPolicy`] can be configured using Rust. As //! with most things, Sequoia's low-level library avoids imposing a //! policy on users of the library, like where a configuration file //! should be or even what format it should have. When necessary, it //! is up to the application to provide an interface, and to configure //! the policy appropriately. //! //! [`StandardPolicy`]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/policy/struct.StandardPolicy.html //! //! This library provides a high-level interface that parses a //! configuration file, and returns a configured `StandardPolicy`. //! //! # Format //! //! The file format is based on [TOML]. It contains several sections, //! one for hash algorithms, one for asymmetric algorithms, etc. //! //! [TOML]: https://toml.io/ //! //! ## Forward Compatibility //! //! This parser is strict, but we want the configuration format to be //! forwards compatible so that the same configuration file can be //! used with different versions of the parser. //! //! ### Dealing with New Keys //! //! Unknown sections and unknown keys cause a parse error. To allow //! configuration files a degree of backwards compatibility, it is //! possible to set the per-map `ignore_invalid` key to the key or the //! list of keys that should be ignored if they are not recognized. //! For instance, if Sequoia adds support for `SHA4`, then you could //! do the following to unconditionally reject `SHA4` while ensuring //! that the configuration is still readable by older versions of //! Sequoia that don't know about `SHA4`: //! //! ```toml //! [hash_algorithms] //! ignore_invalid = [ "sha4" ] //! sha4 = never //! ``` //! //! (The same principle applies to sections.) //! //! ### Dealing with Type Changes //! //! Most keys are string types. In the future, we may want to make a //! given algorithm or data structure's configuration more nuanced. A //! logical way to do this is to change the key from taking a string //! type to taking a map type. //! //! To support this type of change, all keys that take a string are //! also recognized as maps with a single key, `default_disposition`. //! Thus, if `key` is ever extended in this way, //! `key.default_disposition` can be used to control the configuration //! of older versions, and new versions can use the configuration //! parameters. //! //! For instance, imagine that AES128 is found to be vulnerable to an //! attack called `foo` in certain, detectable situations. We could //! extend AES128 with a new key (`foo`) that is respected when those //! conditions are detected. This can be expressed in the following, //! backwards compatible manner: //! //! ```toml //! [symmetric_algorithms] //! aes128.default_disposition = "always" //! aes128.foo = "2023-01-01" //! aes128.ignore_invalid = "foo" //! ``` //! //! ## Cutoff Times //! //! Most settings take a so-called cutoff time. The cutoff time is //! the time at which an algorithm (e.g., the broken [SHA-1] hash //! algorithm) or a data structure (e.g. the obsolete [SED packet]) //! should no longer be considered valid. Using a cutoff time //! provides more nuance than simply marking an algorithm as invalid. //! In particular, it allows sun setting algorithms that have been //! weakened, but are not yet completely broken, and using data that //! has been saved to a trusted medium before its security was broken. //! //! Cutoff times are expressed using TOML's `datetime` datatype, which //! is an [RFC 3339] formatted timestamp. The following variants are //! valid: //! //! [SHA-1]: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-07#section-14.1 //! [SED packet]: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-07#section-5.7 //! //! Offset datetime: //! //! ```toml //! [hash_algorithms] //! sha1 = 2010-01-01T00:00:00Z //! ``` //! //! Local datetime: //! //! ```toml //! [hash_algorithms] //! sha1 = 2010-01-01T00:00:00+00:00 //! ``` //! //! Local date (interpreted as midnight in UTC): //! //! ```toml //! [hash_algorithms] //! sha1 = 2010-01-01 //! ``` //! //! The local time format is not supported as it doesn't make sense in //! this context. //! //! [RFC 3339]: https://www.rfc-editor.org/rfc/rfc3339 //! //! Two special values are also supported: `always` means that the //! algorithm or data structure should always be considered valid, and //! `never` means that the algorithm or data structure should never be //! considered valid. These values are checked for in a //! case-sensitive manner. //! //! ```toml //! [hash_algorithms] //! sha1 = "never" //! ``` //! //! ## Default Disposition //! //! In some situations, it is desirable to only allow a fixed set of //! algorithms. Using the cutoff mechanism, it is possible to accept //! or reject each of the known algorithms, but unknown algorithms, //! i.e., those that Sequoia will add in the future, and will likely //! enable by default, can't be rejected in this way, because their //! name is---by definition---not yet known. //! //! To accommodate this usage, it is possible to set an algorithm //! class or data structure class's default disposition using the //! `default_disposition` key. Currently, only one value is supported //! for this key: `never`. If this key is present in a section, then //! that key is processed first, and all algorithms are set to be //! rejected. The rest of the keys are then processed as usual. //! //! The following example shows how to only allow the SHA256 and //! SHA512 hash functions. Even if a theoretical SHA4 hash function //! is added to Sequoia, it will be rejected by this configuration. //! //! ```toml //! [hash_algorithms] //! sha256.collision_resistance = "always" //! sha256.second_preimage_resistance = "always" //! sha512.collision_resistance = "always" //! sha512.second_preimage_resistance = "always" //! default_disposition = "never" //! ``` //! //! ## Sections //! //! ### Hash Functions //! //! Hash algorithms are used to ensure multiple properties. Of //! particular relevance in the context of OpenPGP are collision //! resistance, and second preimage resistance. In some contexts like //! self signatures, only second preimage resistance is required. In //! other contexts, both properties are required. As collision //! resistance is much easier to attack, these two properties can be //! set separately. //! //! You configure just the second preimage resistance cutoff by //! setting the `ALGO.second_preimage_resistance` key. You configure //! just the collision resistance cutoff by setting the //! `ALGO.collision_resistance` key. Setting the `ALGO` key is //! shorthand for setting both. //! //! A hash algorithm's key is the lower-case version of the value //! returned by the [`Display` name][hash-display]. For instance, //! SHA1 is `sha1`. //! //! [hash-display]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/types/enum.HashAlgorithm.html#impl-Display //! //! ```toml //! [hash_algorithms] //! md5 = "never" //! sha1.second_preimage_resistance = 2030-01-01 //! sha1.collision_resistance = 2022-01-01 //! sha512 = "always" //! ``` //! //! ### Symmetric Algorithms //! //! Like hash algorithms, [symmetric algorithms] can be rejected //! outright or have a cutoff date. They don't have any subkeys like //! `collision_resistance`, so there is only one way to set the //! cutoff: using the `algo` key. //! //! [symmetric algorithms]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/types/enum.SymmetricAlgorithm.html#impl-Display //! //! The unencrypted variant, the unknown variants, and the private //! variants cannot currently be set. //! //! ```toml //! [symmetric_algorithms] //! cast5 = "never" //! aes128 = "always" //! ``` //! //! ### Asymmetric Algorithms //! //! Like symmetric algorithms, [asymmetric algorithms] can be rejected //! outright or have a cutoff date. //! //! [asymmetric algorithms]: https://docs.sequoia-pgp.org/sequoia_openpgp/policy/enum.AsymmetricAlgorithm.html#impl-Display //! //! The unknown variants, and the private variants cannot currently be //! set. //! //! ```toml //! [asymmetric_algorithms] //! rsa1024 = "never" //! rsa2048 = 2028-01-01 //! ``` //! //! ### AEAD Algorithms //! //! Like symmetric algorithms, [AEAD algorithms] can be rejected //! outright or have a cutoff date. //! //! [AEAD algorithms]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/types/enum.AEADAlgorithm.html#impl-Display //! //! The unknown variants, and the private variants cannot currently be //! set. //! //! ```toml //! [aead_algorithms] //! eax = "never" //! ocb = "always" //! ``` //! //! ### Packets //! //! Packets can be rejected outright or have a cutoff date. The [SED //! packet] is, for instance, considered broken, and messages that use //! it should generally be rejected unless they are known to not be //! from an attacker, e.g., because they were stored on a trusted //! medium before the attack was feasible. //! //! It is also possible to reject particular versions of a packet. In //! this case, the packet is a map and the fields `vX` where `X` is a //! `u8` can be used to set the cutoff for version `X` of the packet. //! This mechanism is only supported for packets that actually are //! versioned, and only for known versions. (Unknown versions can //! still be set in a forwards compatible way using the //! `ignore_invalid` key.) //! //! The packets are named after the [names of the Packet variants]. //! //! [names of the Packet variants]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/packet/enum.Tag.html#variants //! //! The reserved packet, the unknown variants, and the private //! variants cannot currently be set. //! //! ```toml //! [packets] //! sed = "never" //! seip = 2028-01-01 //! //! signature.v3 = 2017-01-01 //! signature.v4 = 2030-01-01 //! signature.v5 = "always" //! # v5 signatures are coming, but not yet recognized. //! signature.ignore_invalid = "v5" //! ``` //! //! ## Examples //! //! The following example shows how to use a configuration file to //! configure a `StandardPolicy`: //! //! ```rust //! use sequoia_openpgp as openpgp; //! use openpgp::policy::HashAlgoSecurity; //! use openpgp::types::HashAlgorithm; //! //! use sequoia_policy_config::ConfiguredStandardPolicy; //! //! # fn main() -> openpgp::Result<()> { //! let mut p = ConfiguredStandardPolicy::new(); //! p.parse_bytes(b"[hash_algorithms] //! sha1.collision_resistance = \"never\"")?; //! let p = &p.build(); //! //! assert_eq!(p.hash_cutoff(HashAlgorithm::SHA1, //! HashAlgoSecurity::CollisionResistance), //! Some(std::time::UNIX_EPOCH)); //! # Ok(()) } //! ``` use std::collections::HashSet; use std::env; use std::io; use std::path::Path; use std::path::PathBuf; use std::string::String; use std::time::SystemTime; use std::time::UNIX_EPOCH; use sequoia_openpgp as openpgp; use openpgp::packet::Tag; use openpgp::policy::AsymmetricAlgorithm; use openpgp::policy::StandardPolicy; use openpgp::policy::HashAlgoSecurity; use openpgp::types::AEADAlgorithm; use openpgp::types::HashAlgorithm; use openpgp::types::SymmetricAlgorithm; use anyhow; use anyhow::Context as _; use chrono::DateTime; use chrono::NaiveDate; use chrono::Utc; use toml::value; use toml::Value; #[cfg(test)] mod testdata; pub struct ConfiguredStandardPolicy<'a> { policy: StandardPolicy<'a>, } type Result = std::result::Result; /// Errors used in this crate. /// /// Note: This enum cannot be exhaustively matched to allow future /// extensions. #[non_exhaustive] #[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)] pub enum Error { /// Parse error #[error("Parse error: {0}")] ParseError(String), /// A Relative Path was provided where an absolute path was expected. #[error("Relative path not allowed: {0}")] RelativePathError(PathBuf), } /// A timestamp. /// /// None is always. type Timestamp = Option; /// Always accept. const ALWAYS: Timestamp = None; /// Never accept. /// /// By setting the acceptance time to the unix epoch, we never accept /// anything. const NEVER: Timestamp = Some(UNIX_EPOCH); // Parses a timestamp stored in a toml value. // // Recognizes the special values "always" and "never". fn parse_time(t: &Value) -> Result { let t = match t { Value::String(t) => t.clone(), Value::Datetime(t) => t.to_string(), _ => Err(Error::ParseError( format!("timestamp is not a string ({:?})", t)))?, }; Ok(match &t[..] { "always" => ALWAYS, "never" => NEVER, t => { let t = if let Ok(p) = DateTime::parse_from_rfc3339(t) { p.into() } else { let t = NaiveDate::parse_from_str(&t, "%Y-%m-%d") .context(format!("Parsing timestamp {}", t))? .and_hms_opt(0, 0, 0).expect("valid time"); let t: DateTime = DateTime::from_utc(t, Utc); t.into() }; Some(t) } }) } // Returns an error if a key is unknown. // // known_keys better be lowercase. fn check_sections(path: Option<&str>, section: &value::Map, known_keys: &[&str]) -> Result<()> { // known_keys better be lowercase. known_keys.iter().for_each(|&s| assert_eq!(&s.to_lowercase()[..], s)); let prefix = if let Some(path) = path { format!("{}.", path) } else { "".to_string() }; let keys: HashSet = section .keys() .cloned() .collect(); // The set of allowed keys are the known keys, plus // "ignore_invalid", and the value of "ignore_invalid". let mut allowed_keys: Vec = known_keys.iter() .map(|k| k.to_string()) .collect(); if let Some(ignore) = section.get("ignore_invalid") { allowed_keys.push("ignore_invalid".to_string()); match ignore { Value::String(k) => allowed_keys.push(k.clone()), Value::Array(ks) => { for k in ks { if let Value::String(k) = k { allowed_keys.push(k.clone()); } else { Err(Error::ParseError(format!( "'{}ignore_invalid' takes a string \ or an array of strings", prefix)))? } } } _ => { return Err(Error::ParseError(format!( "Invalid value for '{}ignore_invalid': {}, \ expected a string or an array of strings", prefix, ignore)).into()); } } } // Now check if there are any unknown sections. let unknown_keys = keys .difference(&HashSet::::from_iter(allowed_keys.into_iter())) .cloned() .collect::>(); if ! unknown_keys.is_empty() { return Err(Error::ParseError(format!( "{} has unknown keys: {}, valid keys are: {}", if let Some(path) = path { path } else { "top-level section" }, unknown_keys.join(", "), // We don't include the keys listed in ignore_invalid. known_keys.join(", "))).into()); } Ok(()) } const HASH_ALGO_PROPS: &[(&str, HashAlgoSecurity)] = &[ ("second_preimage_resistance", HashAlgoSecurity::SecondPreImageResistance), ("collision_resistance", HashAlgoSecurity::CollisionResistance), ]; const HASH_ALGO_MAP: [(&str, HashAlgorithm, &[(&str, HashAlgoSecurity)]); 7] = [ ("md5", HashAlgorithm::MD5, HASH_ALGO_PROPS), ("sha1", HashAlgorithm::SHA1, HASH_ALGO_PROPS), ("ripemd160", HashAlgorithm::RipeMD, HASH_ALGO_PROPS), ("sha256", HashAlgorithm::SHA256, HASH_ALGO_PROPS), ("sha384", HashAlgorithm::SHA384, HASH_ALGO_PROPS), ("sha512", HashAlgorithm::SHA512, HASH_ALGO_PROPS), ("sha224", HashAlgorithm::SHA224, HASH_ALGO_PROPS) ]; const ASYMM_ALGO_MAP: [(&str, AsymmetricAlgorithm, &[(&str, ())]); 18] = [ ("rsa1024", AsymmetricAlgorithm::RSA1024, &[]), ("rsa2048", AsymmetricAlgorithm::RSA2048, &[]), ("rsa3072", AsymmetricAlgorithm::RSA3072, &[]), ("rsa4096", AsymmetricAlgorithm::RSA4096, &[]), ("elgamal1024", AsymmetricAlgorithm::ElGamal1024, &[]), ("elgamal2048", AsymmetricAlgorithm::ElGamal2048, &[]), ("elgamal3072", AsymmetricAlgorithm::ElGamal3072, &[]), ("elgamal4096", AsymmetricAlgorithm::ElGamal4096, &[]), ("dsa1024", AsymmetricAlgorithm::DSA1024, &[]), ("dsa2048", AsymmetricAlgorithm::DSA2048, &[]), ("dsa3072", AsymmetricAlgorithm::DSA3072, &[]), ("dsa4096", AsymmetricAlgorithm::DSA4096, &[]), ("nistp256", AsymmetricAlgorithm::NistP256, &[]), ("nistp384", AsymmetricAlgorithm::NistP384, &[]), ("nistp521", AsymmetricAlgorithm::NistP521, &[]), ("brainpoolp256", AsymmetricAlgorithm::BrainpoolP256, &[]), ("brainpoolp512", AsymmetricAlgorithm::BrainpoolP512, &[]), ("cv25519", AsymmetricAlgorithm::Cv25519, &[]), ]; const SYMM_ALGO_MAP: [(&str, SymmetricAlgorithm, &[(&str, ())]); 11] = [ ("idea", SymmetricAlgorithm::IDEA, &[]), ("tripledes", SymmetricAlgorithm::TripleDES, &[]), ("cast5", SymmetricAlgorithm::CAST5, &[]), ("blowfish", SymmetricAlgorithm::Blowfish, &[]), ("aes128", SymmetricAlgorithm::AES128, &[]), ("aes192", SymmetricAlgorithm::AES192, &[]), ("aes256", SymmetricAlgorithm::AES256, &[]), ("twofish", SymmetricAlgorithm::Twofish, &[]), ("camellia128", SymmetricAlgorithm::Camellia128, &[]), ("camellia192", SymmetricAlgorithm::Camellia192, &[]), ("camellia256", SymmetricAlgorithm::Camellia256, &[]), ]; const AEAD_ALGO_MAP: [(&str, AEADAlgorithm, &[(&str, ())]); 2] = [ ("eax", AEADAlgorithm::EAX, &[]), ("ocb", AEADAlgorithm::OCB, &[]), ]; const PACKET_MAP: [(&str, Tag, &[(&str, u8)]); 18] = [ ("pkesk", Tag::PKESK, &[("v3", 3)]), ("signature", Tag::Signature, &[("v3", 3), ("v4", 4)]), ("skesk", Tag::SKESK, &[("v4", 4)]), ("onepasssig", Tag::OnePassSig, &[("v3", 3)]), ("secretkey", Tag::SecretKey, &[("v4", 4)]), ("publickey", Tag::PublicKey, &[("v4", 4)]), ("secretsubkey", Tag::SecretSubkey, &[("v4", 4)]), ("compresseddata", Tag::CompressedData, &[]), ("sed", Tag::SED, &[]), ("marker", Tag::Marker, &[]), ("literal", Tag::Literal, &[]), ("trust", Tag::Trust, &[]), ("userid", Tag::UserID, &[]), ("publicsubkey", Tag::PublicSubkey, &[("v4", 4)]), ("userattribute", Tag::UserAttribute, &[]), ("seip", Tag::SEIP, &[("v1", 1)]), ("mdc", Tag::MDC, &[]), ("aed", Tag::AED, &[("v1", 1)]), ]; impl<'a> ConfiguredStandardPolicy<'a> { /// The default environment variable. pub const ENV_VAR: &'static str = "SEQUOIA_CRYPTO_POLICY"; /// The default configuration file. pub const CONFIG_FILE: &'static str = "/etc/crypto-policies/back-ends/sequoia.config"; /// Returns a new `ConfiguredStandardPolicy` with a default /// `StandardPolicy`. /// /// Normally you'll want to follow this up with a call to /// [`ConfiguredStandardPolicy::parse_bytes`] or /// [`ConfiguredStandardPolicy::parse_default_config`]. pub fn new() -> Self { Self::from_policy(StandardPolicy::new()) } /// Returns a new `ConfiguredStandardPolicy`. /// /// The `StandardPolicy` is created using [`StandardPolicy::at`]. /// /// [`StandardPolicy::at`]: https://docs.rs/sequoia-openpgp/1.10.0/sequoia_openpgp/policy/struct.StandardPolicy.html#method.at /// /// Normally you'll want to follow this up with a call to /// [`ConfiguredStandardPolicy::parse_bytes`] or /// [`ConfiguredStandardPolicy::parse_default_config`]. pub fn at(t: T) -> Self where T: Into { Self::from_policy(StandardPolicy::at(t)) } /// Returns a new `ConfiguredStandardPolicy` using the provided /// `StandardPolicy`. /// /// Normally you'll want to follow this up with a call to /// [`ConfiguredStandardPolicy::parse_bytes`] or /// [`ConfiguredStandardPolicy::parse_default_config`]. pub fn from_policy(policy: StandardPolicy<'a>) -> Self { ConfiguredStandardPolicy { policy } } /// Parses the configuration file specified by the environment /// variable. /// /// To use the default environment variable, specify /// [`ConfiguredStandardPolicy::ENV_VAR`]. /// /// This function returns: `Ok(true)` if the policy was /// configured; `Ok(false)` if the policy was not configured; or, /// an error if there was a problem opening, reading, or parsing /// the configuration file. /// /// Specifically: /// /// - If the specified environment variable is not set, this /// function returns `Ok(false)` to indicate that the policy /// was not configured. /// /// - If the specified environment variable is set to the empty /// string, no configuration file is read, but the policy is /// considered to be configured (that is, the empty string /// means to use the policy as is), and the function returns /// `Ok(true)`. /// /// - If the environment variable is set to a relative path, /// this function returns an error. /// /// - If the environment variable is set to an absolute path, /// the specified file is parsed. If an error occurs while /// opening (including that the file does not exist), reading, /// or parsing the configuration file, the error is returned. /// If the configuration file is successfully parsed, the /// function returns `Ok(true)` to indicate that the policy is /// configured. pub fn parse_env_config(&mut self, env_var: &str) -> Result { let config_file = match env::var(env_var) { // Environment variable wasn't set. Err(_err) => return Ok(false), Ok(filename) => filename, }; if config_file.is_empty() { // We're configured: the empty string means to just use // the policy as is. return Ok(true); } let config_file = PathBuf::from(config_file); if config_file.is_relative() { // A relative path is an error. let err = anyhow::Error::from( Error::RelativePathError(config_file)); return Err(err) .context(format!("Invalid value for {}", env_var)); } // We've got a configuration file. Parse it. let config = match std::fs::read(&config_file) { Err(err) => { let err = anyhow::Error::from(err); return Err(err).with_context(|| { format!("Reading {:?}", config_file) }); } Ok(config) => config, }; self.parse_bytes(config) .with_context(|| { format!("Parsing {:?}", config_file) })?; // We're configured. Ok(true) } /// Configures the policy using the specified configuration file. /// /// If `config_file` does not exist, returns `Ok(false)` to /// indicate that the policy was not configured. /// /// If an error occurs while opening, reading, or parsing the /// configuration file, the error is returned. /// /// Otherwise, `Ok(true)` is returned to indicate that the /// policy was configured. pub fn parse_config_file

(&mut self, config_file: P) -> Result where P: AsRef { let config_file = config_file.as_ref(); let config = match std::fs::read(config_file) { Err(err) => { if err.kind() == io::ErrorKind::NotFound { // A missing configuration file is not an error. return Ok(false); } else { let err = anyhow::Error::from(err); return Err(err).with_context(|| { format!("Reading {:?}", config_file) }); } } Ok(config) => config, }; self.parse_bytes(config) .with_context(|| { format!("Parsing {:?}", config_file) })?; // We're configured. Ok(true) } /// Parses the specified configuration. /// /// This function first tries to configure the policy using the /// configuration file specified in the environment variable /// `env_var` using /// [`ConfiguredStandardPolicy::parse_env_config`]. If that /// returns `Ok(false)`, then it tries to parse `config_file` /// using [`ConfiguredStandardPolicy::parse_config_file`]. pub fn parse_config

(&mut self, env_var: &str, config_file: P) -> Result where P: AsRef { let config_file = config_file.as_ref(); match self.parse_env_config(env_var) { Ok(false) => { // No error and we didn't configure the policy. Fallback // to the configuration file. self.parse_config_file(config_file) } otherwise => otherwise, } } /// Parses the default configuration. /// /// This first tries to parse the configuration file specified in /// the environment variable `SEQUOIA_CRYPTO_POLICY`. See /// [`ConfiguredStandardPolicy::parse_env_config`] for the /// semantics. /// /// If `ConfiguredStandardPolicy::parse_env_config` doesn't /// configure the policy (i.e., it returns `Ok(false)`), this /// function tries to parse /// [`ConfiguredStandardPolicy::CONFIG_FILE`] using /// [`ConfiguredStandardPolicy::parse_config_file`]. pub fn parse_default_config(&mut self) -> Result { self.parse_config(Self::ENV_VAR, Self::CONFIG_FILE) } /// Configures the policy according to the configuration data. pub fn parse_bytes(&mut self, config: B) -> Result<()> where B: AsRef<[u8]> { let config = config.as_ref(); let config = std::str::from_utf8(config)?.parse::()?; let config = if let Value::Table(config) = config { config } else { return Err(Error::ParseError( format!("Expected toml sections")).into()); }; check_sections( None, &config, &[ "hash_algorithms", "asymmetric_algorithms", "symmetric_algorithms", "aead_algorithms", "packets", ])?; macro_rules! doit { (// The name of the section (&str). $section_name:literal, // HASH_ALGO_MAP, etc. $algo_map:ident, // A callback that consumes the values: // // fn set(default: Option, // properties: Vec<(AlgorithmId, Timestamp)>) $set:expr, // An iterator over all of the variants. If the // default_disposition key is set, $set is called once // for each variant. $variants:expr) => { if let Some(section) = config.get($section_name) { let section = if let Value::Table(section) = section { section } else { return Err(Error::ParseError( format!("{} is not a map", $section_name)).into()); }; let mut keys = $algo_map.into_iter() .map(|(k, _, _)| k) .collect::>(); keys.push("default_disposition"); check_sections( Some($section_name), §ion, &keys[..])?; // Handle default_disposition first. It is the // default; other settings override it. if let Some(disposition) = section.iter().find_map(|(k, d)| { if k == "default_disposition" { Some(d) } else { None } }) { match disposition.as_str() { // Reject everything by default. Some("never") => { // We assume that all types are a u8. // This is currently the case. for algo in $variants { $set(algo.into(), (Some(NEVER), vec![])); } } _ => { return Err(Error::ParseError(format!( "{}.default_disposition: \ invalid value ({:?}), expected never", $section_name, disposition)).into()); } } } // Iterate over the keys/value pairs. for (k, v) in section { // We already handled "default_disposition" above. if k == "default_disposition" { continue; } // Is the key known? let metadata = $algo_map .into_iter() .find_map(|(key, algo, props)| { if k == key { Some((algo, props)) } else { None } }); let (algo, props) = if let Some((algo, props)) = metadata { (algo, props) } else { // It's unknown, but in "ignore_invalid" // (otherwise check_sections would have // returned an error) so silently skip it. continue; }; // Parse the value. let t: (Option, Vec<(_, Timestamp)>) = match v { Value::Datetime(_) => { let t = Some(parse_time(v)?); (t, vec![]) } Value::String(_) => { let t = Some(parse_time(v)?); (t, vec![]) } Value::Table(m) => { // We got a table. If this key has // properties, then process them. // Otherwise, only look for the // default property. let mut names = props .into_iter() .map(|(name, _id)| name) .cloned() .collect::>(); let ids = props .into_iter() .map(|(_name, id)| id) .cloned() .collect::>(); names.push(&"default_disposition"); check_sections( Some(&format!("{}.{}", $section_name, k)), &m, &names[..])?; let default_disposition = m.get("default_disposition") .map(parse_time).transpose()?; let props: Vec<(_, Timestamp)> = names .into_iter() .zip(ids.into_iter()) .filter_map(|(name, id)| { match m.get(name).map(parse_time) { Some(Ok(t)) => Some(Ok((id, t))), // Parse error. Some(Err(err)) => Some(Err(err)), // property not present. None => None, } }) .collect::>>()?; (default_disposition, props) } v => { return Err(Error::ParseError(format!( "{}.{}: invalid value ({:?}), expected \ a valid timestamp, always, or never", $section_name, k, v)).into()); } }; $set(algo, t); } } } } doit!("hash_algorithms", HASH_ALGO_MAP, |algo: HashAlgorithm, props: (Option, Vec<(HashAlgoSecurity, Timestamp)>)| { let (default_disposition, props) = props; if let Some(default_disposition) = default_disposition { self.policy.reject_hash_property_at( algo, HashAlgoSecurity::SecondPreImageResistance, default_disposition); self.policy.reject_hash_property_at( algo, HashAlgoSecurity::CollisionResistance, default_disposition); } for (id, value) in props { self.policy.reject_hash_property_at( algo, id, value); } }, HashAlgorithm::variants()); doit!("asymmetric_algorithms", ASYMM_ALGO_MAP, |algo: AsymmetricAlgorithm, props: (Option, Vec<((), Timestamp)>)| { // No algorithm has any properties beyond the // default property. assert!(props.1.is_empty()); if let Some(t) = props.0 { self.policy.reject_asymmetric_algo_at( algo, t); } }, AsymmetricAlgorithm::variants()); doit!("symmetric_algorithms", SYMM_ALGO_MAP, |algo: SymmetricAlgorithm, props: (Option, Vec<((), Timestamp)>)| { // No algorithm has any properties beyond the // default property. assert!(props.1.is_empty()); if let Some(t) = props.0 { self.policy.reject_symmetric_algo_at( algo, t); } }, SymmetricAlgorithm::variants()); doit!("aead_algorithms", AEAD_ALGO_MAP, |algo: AEADAlgorithm, props: (Option, Vec<((), Timestamp)>)| { // No algorithm has any properties beyond the // default property. assert!(props.1.is_empty()); if let Some(t) = props.0 { self.policy.reject_aead_algo_at( algo, t); } }, AEADAlgorithm::variants()); doit!("packets", PACKET_MAP, |algo: Tag, props: (Option, Vec<(u8, Timestamp)>)| { if let Some(default_disposition) = props.0 { self.policy.reject_packet_tag_at( algo, default_disposition); } for (version, t) in props.1 { self.policy.reject_packet_tag_version_at( algo, version, t); } }, Tag::variants()); Ok(()) } /// Returns the configured policy. pub fn build(self) -> StandardPolicy<'a> { self.policy } } #[cfg(test)] mod tests { use super::*; use std::time::Duration; use openpgp::Cert; use openpgp::parse::Parse; // Check that invalid sections cause an error, unless they are // explicitly ignored. #[test] fn invalid_section() -> Result<()> { let mut p = ConfiguredStandardPolicy::new(); assert!(p.parse_bytes(b"x=1").is_err()); // A known section. p.parse_bytes(b"[hash_algorithms] sha1 = \"always\" ").expect("valid"); // A known section and an unknown section. assert!(p.parse_bytes(b"[hash_algorithms] sha1 = \"always\" [x] blah = 1 ").is_err()); // A known section, and an unknown section that we should // ignore. p.parse_bytes(b"ignore_invalid = \"x\" [hash_algorithms] sha1 = \"always\" [x] blah = 1 ").expect("valid"); p.parse_bytes(b"ignore_invalid = [ \"x\", \"y\" ] [hash_algorithms] sha1 = \"always\" [x] blah = 1 [y] blah = 1 ").expect("valid"); // Section names are case sensitive. assert!(p.parse_bytes(b"[HASH_ALGORITHMS] sha1 = \"never\" ").is_err()); assert!(p.parse_bytes(b"[Hash_Algorithms] sha1 = \"never\" ").is_err()); // Underscores can't be replaced by spaces. assert!(p.parse_bytes(b"[HASH_ALGORITHMS] sha1 = \"never\" ").is_err()); Ok(()) } // Make sure invalid keys cause an error, unless they are ignored. #[test] fn invalid_keys() -> Result<()> { let mut p = ConfiguredStandardPolicy::new(); // A known section with known keys. p.parse_bytes(b"[hash_algorithms] sha1 = \"always\" sha224 = \"never\" ").expect("valid"); // A known section with unknown keys. assert!(p.parse_bytes(b"[hash_algorithms] sha1 = \"always\" sha99 = \"never\" ").is_err()); // A known section with unknown keys, the ignore_invalid // directive is in the wrong place. assert!(p.parse_bytes(b" ignore_invalid = \"SHA99\" [hash_algorithms] sha1 = \"always\" SHA99 = \"never\" ").is_err()); // A known section with unknown, but ignored keys. p.parse_bytes(b"[hash_algorithms] ignore_invalid = \"SHA99\" sha1 = \"always\" SHA99 = \"never\" ").expect("valid"); // A known section with unknown keys, which are incorrectly // ignore (wrong case). assert!(p.parse_bytes(b" [hash_algorithms] ignore_invalid = \"SHA99\" sha1 = \"always\" sha99 = \"never\" ").is_err()); Ok(()) } /// Set one property at a time via a config file. Check that is /// has been set. Where appropriate, check that related /// properties have not been changed relative to the standard /// policy. #[test] fn get_set_one() -> Result<()> { let sp = StandardPolicy::new(); let times: [(&str, Timestamp); 5] = [ ("never", NEVER), ("always", ALWAYS), // $ date -u +%s --date='20200101' // 1577836800 ("2020-01-01T00:00:00Z", Some(UNIX_EPOCH + Duration::new(1577836800, 0))), // $ date -u +%s --date='20500101' // 2524608000 ("2050-01-01T00:00:00+00:00", Some(UNIX_EPOCH + Duration::new(2524608000, 0))), // $ date -u +%s --date='21050101' // 4260211200 ("2105-01-01", Some(UNIX_EPOCH + Duration::new(4260211200, 0))), ]; macro_rules! check_hash { ($id:expr, $algo:expr, $props:expr, $time:expr, $config:expr) => { let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes($config).expect("valid"); let p = p.build(); let all = [ HashAlgoSecurity::CollisionResistance, HashAlgoSecurity::SecondPreImageResistance, ]; for prop in all.iter().cloned() { if $props.contains(&prop) { assert_eq!(p.hash_cutoff(*$algo, prop), $time.1, "algo: {}, t: {}", $id, $time.0); } else { // Check that the other security properties // didn't change. assert_eq!( sp.hash_cutoff(*$algo, prop), p.hash_cutoff(*$algo, prop), "algo: {}, t: {}", $id, $time.0); } } } } for time in times.iter() { for (id, algo, _props) in HASH_ALGO_MAP.iter() { // Second preimage resistance and collision resistance. check_hash!(id, algo, [ HashAlgoSecurity::SecondPreImageResistance, HashAlgoSecurity::CollisionResistance, ], time, format!( "[hash_algorithms] {} = \"{}\" ", id, time.0)); // Second preimage resistance. check_hash!(id, algo, [ HashAlgoSecurity::SecondPreImageResistance ], time, format!( "[hash_algorithms] {}.second_preimage_resistance = \"{}\" ", id, time.0)); // Collision resistance. check_hash!(id, algo, [ HashAlgoSecurity::CollisionResistance ], time, format!( "[hash_algorithms] {}.collision_resistance = \"{}\" ", id, time.0)); // Different ways of naming the key. check_hash!(id, algo, [ HashAlgoSecurity::CollisionResistance ], time, format!( "[hash_algorithms.{}] collision_resistance = \"{}\" ", id, time.0)); check_hash!(id, algo, [ HashAlgoSecurity::CollisionResistance ], time, format!( "hash_algorithms.{}.collision_resistance = \"{}\" ", id, time.0)); } } macro_rules! check { ($id:expr, $algo:expr, $time:expr, $config:expr, $get:ident) => { let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes($config).expect("valid"); let p = p.build(); assert_eq!(p.$get($algo.clone()), $time.1, "algo: {}, t: {}", $id, $time.0); } } for time in times.iter() { for (id, algo, _props) in ASYMM_ALGO_MAP.iter() { check!(id, algo, time, format!( "[asymmetric_algorithms] {} = \"{}\" ", id, time.0), asymmetric_algo_cutoff); } } for time in times.iter() { for (id, algo, _props) in SYMM_ALGO_MAP.iter() { check!(id, algo, time, format!( "[symmetric_algorithms] {} = \"{}\" ", id, time.0), symmetric_algo_cutoff); } } for time in times.iter() { for (id, algo, _props) in AEAD_ALGO_MAP.iter() { check!(id, algo, time, format!( "[aead_algorithms] {} = \"{}\" ", id, time.0), aead_algo_cutoff); } } for time in times.iter() { for (id, algo, props) in PACKET_MAP.into_iter() { // Unversioned. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(format!( "[packets] {} = \"{}\" ", id, time.0)).expect("valid"); let p = p.build(); #[allow(deprecated)] let cutoff = p.packet_tag_cutoff(algo.clone()); assert_eq!( cutoff, time.1, "algo: {}, t: {}", id, time.0); // Setting the default means it should apply to all // versions, including "unknown" versions. for version in props.into_iter().map(|(_id, v)| v) .chain(std::iter::once(&99)) { assert_eq!( p.packet_tag_version_cutoff(algo.clone(), *version), time.1, "algo: {}, version: {}, t: {}", id, version, time.0); } // Versioned. for (prop, version) in props { let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(format!( "[packets] {}.{} = \"{}\" ", id, prop, time.0)).expect("valid"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff( algo.clone(), *version), time.1, "algo: {}, version: {}, t: {}", id, *version, time.0); } } } Ok(()) } // Convenience function for using a timestamp. fn ts(t: &str) -> Option { parse_time(&Value::String(t.into())).expect("valid timestamp") } /// Check a simple config file. #[test] fn simple_config() -> Result<()> { // Something simple. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[hash_algorithms] sha1 = \"always\" sha224 = 2017-03-04T13:25:35Z sha512.second_preimage_resistance = \"always\" sha512.collision_resistance = 2050-01-01 [symmetric_algorithms] cast5 = \"always\" aes128 = \"2040-01-01\" aes256 = \"2050-01-01\" ").expect("valid config"); let p = p.build(); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA1, HashAlgoSecurity::SecondPreImageResistance), ts("always")); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA224, HashAlgoSecurity::SecondPreImageResistance), ts("2017-03-04T13:25:35Z")); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA512, HashAlgoSecurity::CollisionResistance), ts("2050-01-01")); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA512, HashAlgoSecurity::SecondPreImageResistance), ts("always")); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::CAST5), ts("always")); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::AES128), ts("2040-01-01")); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::AES256), ts("2050-01-01")); Ok(()) } // Configure everything, then read it out again. #[test] fn all_config() -> Result<()> { let epoch = NaiveDate::from_ymd_opt(2020, 1, 1).expect("valid"); let mut d = epoch; let mut date = || -> String { let s = d.format("%Y-%m-%d"); d = d.succ_opt().expect("valid"); s.to_string() }; let mut config = String::new(); config.push_str("[hash_algorithms]\n"); for (id, algo, _props) in HASH_ALGO_MAP { config.push_str( &format!("{} = {} # {}\n", id, date(), algo)); } config.push_str("\n[asymmetric_algorithms]\n"); for (id, algo, _props) in ASYMM_ALGO_MAP { config.push_str( &format!("{} = {} # {}\n", id, date(), algo)); } config.push_str("\n[symmetric_algorithms]\n"); for (id, algo, _props) in SYMM_ALGO_MAP { config.push_str( &format!("{} = {} # {}\n", id, date(), algo)); } config.push_str("\n[aead_algorithms]\n"); for (id, algo, _props) in AEAD_ALGO_MAP { config.push_str( &format!("{} = {} # {}\n", id, date(), algo)); } config.push_str("\n[packets]\n"); for (id, algo, _props) in PACKET_MAP { config.push_str( &format!("{} = {} # {}\n", id, date(), algo)); } let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(config.clone()) .expect(&format!("valid config: {}", config)); let p = p.build(); // Reset the date to the epoch. let mut d = epoch; let mut date = || -> String { let s = d.format("%Y-%m-%d"); d = d.succ_opt().expect("valid"); s.to_string() }; // Make sure everything we set was really set. for (_, algo, _) in HASH_ALGO_MAP { assert_eq!( p.hash_cutoff(algo, HashAlgoSecurity::SecondPreImageResistance), ts(&date())); } for (_, algo, _) in ASYMM_ALGO_MAP { assert_eq!(p.asymmetric_algo_cutoff(algo), ts(&date())); } for (_, algo, _) in SYMM_ALGO_MAP { assert_eq!(p.symmetric_algo_cutoff(algo), ts(&date())); } for (_, algo, _) in AEAD_ALGO_MAP { assert_eq!(p.aead_algo_cutoff(algo), ts(&date())); } for (_, algo, props) in PACKET_MAP { let d = ts(&date()); #[allow(deprecated)] let cutoff = p.packet_tag_cutoff(algo); assert_eq!(cutoff, d); // Setting the default means it should apply to all // versions, including "unknown" versions. for version in props.into_iter().map(|(_id, v)| v) .chain(std::iter::once(&99)) { assert_eq!( p.packet_tag_version_cutoff(algo, *version), d, "algo: {}, version: {}, t: {:?}", algo, version, d); } } Ok(()) } #[test] fn check_sig() -> Result<()> { let alice = testdata::file("alice-secret.asc"); let cert = Cert::from_bytes(alice).expect("valid cert"); let now = ts("2022-10-30").unwrap(); // Should be valid according to the standard policy. let sp = &StandardPolicy::at(now); let _cert = cert.with_policy(sp, None).expect("valid under standard policy"); // If SHA512 has no collision resistance, the cert is still valid. let mut p = ConfiguredStandardPolicy::at(now); p.parse_bytes(b"[hash_algorithms] sha512.collision_resistance = \"never\"") .expect(&format!("valid config")); let p = p.build(); let _cert = cert.with_policy(&p, None) .expect("valid under: SHA512 has no collision resistance"); // If SHA512 has no 2nd preimage resistance, the cert is not valid. let mut p = ConfiguredStandardPolicy::at(now); p.parse_bytes(b"[hash_algorithms] sha512.second_preimage_resistance = \"never\"") .expect(&format!("valid config")); let p = p.build(); let _cert = assert!( cert.with_policy(&p, None).is_err(), "invalid under: SHA512 has no 2nd preimage resistance"); // If SHA512's 2nd preimage resistance is cutoff, it should be // invalid. let mut p = ConfiguredStandardPolicy::at(now); p.parse_bytes(&format!("[hash_algorithms] sha512.second_preimage_resistance = 2022-10-24")) .expect(&format!("valid config")); let p = p.build(); let _cert = assert!( cert.with_policy(&p, None).is_err(), "should be invalid under: SHA512 2nd preimage resistance cut off"); // If SHA512's 2nd preimage resistance will be cutoff, it // should be invalid. let mut p = ConfiguredStandardPolicy::at(ts("2022-10-26").unwrap()); p.parse_bytes(&format!("[hash_algorithms] sha512.second_preimage_resistance = 2022-10-27")) .expect(&format!("valid config")); let p = p.build(); let _cert = cert.with_policy(&p, ts("2022-10-26")).expect( "valid under: SHA512 2nd preimage resistance not yet cut off"); let mut p = ConfiguredStandardPolicy::at(ts("2022-10-29").unwrap()); p.parse_bytes(&format!("[hash_algorithms] sha512.second_preimage_resistance = 2022-10-27")) .expect(&format!("valid config")); let p = p.build(); let _cert = assert!( cert.with_policy(&p, ts("2022-10-28")).is_err(), "invalid under: SHA512 2nd preimage resistance cut off"); Ok(()) } #[test] fn default_disposition() -> Result<()> { // Reject everything. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[hash_algorithms] default_disposition = \"never\" [asymmetric_algorithms] default_disposition = \"never\" [symmetric_algorithms] default_disposition = \"never\" [aead_algorithms] default_disposition = \"never\" [packets] default_disposition = \"never\" ").expect("valid config"); let p = p.build(); for algo in 0..=u8::MAX { assert_eq!( p.hash_cutoff(algo.into(), HashAlgoSecurity::CollisionResistance), Some(UNIX_EPOCH)); assert_eq!( p.hash_cutoff(algo.into(), HashAlgoSecurity::SecondPreImageResistance), Some(UNIX_EPOCH)); } for (_, algo, _) in ASYMM_ALGO_MAP { assert_eq!(p.asymmetric_algo_cutoff(algo), Some(UNIX_EPOCH)); } for algo in 0..=u8::MAX { assert_eq!(p.symmetric_algo_cutoff(algo.into()), Some(UNIX_EPOCH)); } for algo in 0..=u8::MAX { assert_eq!(p.aead_algo_cutoff(algo.into()), Some(UNIX_EPOCH)); } for algo in 0..=u8::MAX { #[allow(deprecated)] let cutoff = p.packet_tag_cutoff(algo.into()); assert_eq!(cutoff, Some(UNIX_EPOCH)); } for (_, algo, props) in PACKET_MAP { // Setting the default means it should apply to all // versions, including "unknown" versions. for version in props.into_iter().map(|(_id, v)| v) .chain(std::iter::once(&99)) { assert_eq!( p.packet_tag_version_cutoff(algo, *version), Some(UNIX_EPOCH), "algo: {}, version: {}", algo, version); } } let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[hash_algorithms] sha512.collision_resistance = 2050-01-01 default_disposition = \"never\" [asymmetric_algorithms] rsa1024 = \"always\" default_disposition = \"never\" [symmetric_algorithms] aes128 = \"2040-01-01\" aes256 = \"2050-01-01\" default_disposition = \"never\" [aead_algorithms] ocb = \"always\" default_disposition = \"never\" [packets] seip = \"always\" default_disposition = \"never\" ").expect("valid config"); let p = p.build(); for algo in 0..=u8::MAX { let algo: HashAlgorithm = algo.into(); if algo == HashAlgorithm::SHA512 { assert_eq!( p.hash_cutoff(algo.into(), HashAlgoSecurity::CollisionResistance), ts("2050-01-01")); } else { assert_eq!( p.hash_cutoff(algo, HashAlgoSecurity::CollisionResistance), NEVER); } assert_eq!( p.hash_cutoff(algo.into(), HashAlgoSecurity::SecondPreImageResistance), NEVER); } for (_, algo, _) in ASYMM_ALGO_MAP { match algo { AsymmetricAlgorithm::RSA1024 => assert_eq!(p.asymmetric_algo_cutoff(algo), ALWAYS), algo => assert_eq!(p.asymmetric_algo_cutoff(algo), NEVER), } } for algo in 0..=u8::MAX { let algo = SymmetricAlgorithm::from(algo); match algo { SymmetricAlgorithm::AES128 => assert_eq!(p.symmetric_algo_cutoff(algo), ts("2040-01-01")), SymmetricAlgorithm::AES256 => assert_eq!(p.symmetric_algo_cutoff(algo), ts("2050-01-01")), algo => assert_eq!(p.symmetric_algo_cutoff(algo), NEVER), } } for algo in 0..=u8::MAX { let algo = AEADAlgorithm::from(algo); if algo == AEADAlgorithm::OCB { assert_eq!(p.aead_algo_cutoff(algo), ALWAYS); } else { assert_eq!(p.aead_algo_cutoff(algo), NEVER); } } for algo in 0..=u8::MAX { let algo = Tag::from(algo); #[allow(deprecated)] let cutoff = p.packet_tag_cutoff(algo.into()); if algo == Tag::SEIP { assert_eq!(cutoff, ALWAYS); } else { assert_eq!(cutoff, NEVER); } } for (_, algo, props) in PACKET_MAP { // Setting the default means it should apply to all // versions, including "unknown" versions. for version in props.into_iter().map(|(_id, v)| v) .chain(std::iter::once(&99)) { let cutoff = p.packet_tag_version_cutoff(algo, *version); if algo == Tag::SEIP { assert_eq!(cutoff, ALWAYS); } else { assert_eq!(cutoff, NEVER); } } } Ok(()) } // A string type can also be written as `key.default_disposition`. #[test] fn default_key() -> Result<()> { // Make sure `key` is the same as `key.default_disposition`: let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[hash_algorithms] sha512.default_disposition = 2050-01-01 [symmetric_algorithms] aes128.default_disposition = \"2040-01-01\" [aead_algorithms] ocb.default_disposition = \"always\" default_disposition = \"never\" ").expect("valid config"); let p = p.build(); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA512, HashAlgoSecurity::CollisionResistance), ts("2050-01-01")); assert_eq!( p.hash_cutoff(HashAlgorithm::SHA512, HashAlgoSecurity::SecondPreImageResistance), ts("2050-01-01")); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::AES128), ts("2040-01-01")); assert_eq!( p.aead_algo_cutoff(AEADAlgorithm::OCB), ts("always")); assert_eq!( p.aead_algo_cutoff(AEADAlgorithm::EAX), ts("never")); // `key` is a string type, which is used as a map with an // invalid key. let mut p = ConfiguredStandardPolicy::new(); assert!(p.parse_bytes(b"[symmetric_algorithms] aes128.foo = \"2040-01-01\"").is_err()); // `key` is a string type, which is used as a map with an // invalid key, which is in ignore_invalid. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[symmetric_algorithms] aes256.foo = \"2040-01-01\" aes256.ignore_invalid = \"foo\" ").expect("valid config"); let p = p.build(); let sp = &StandardPolicy::new(); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::AES256), sp.symmetric_algo_cutoff(SymmetricAlgorithm::AES256)); // `key` is a string type, which is used as a map with an // invalid key, which is in ignore_invalid, and there is a // default_disposition key. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[symmetric_algorithms] aes256.foo = \"2040-01-01\" aes256.default_disposition = \"2050-01-01\" aes256.ignore_invalid = \"foo\" ").expect("valid config"); let p = p.build(); assert_eq!( p.symmetric_algo_cutoff(SymmetricAlgorithm::AES256), ts("2050-01-01")); Ok(()) } #[test] fn unversioned_packets() -> Result<()> { let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[packets] signature = 2030-01-01 ").expect("valid config"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 3), ts("2030-01-01")); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 4), ts("2030-01-01")); Ok(()) } #[test] fn versioned_packets() -> Result<()> { let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[packets] signature.v3 = 2010-01-01 signature.v4 = 2030-01-01 ").expect("valid config"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 3), ts("2010-01-01")); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 4), ts("2030-01-01")); let mut p = ConfiguredStandardPolicy::new(); assert!(p.parse_bytes(b"[packets] signature.v9 = 2010-01-01 signature.v4 = 2030-01-01 ").is_err()); let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[packets] signature.v3 = 2010-01-01 signature.v9 = 2010-01-01 signature.ignore_invalid = \"v9\" signature.v4 = 2030-01-01 ").expect("valid config"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 3), ts("2010-01-01")); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 4), ts("2030-01-01")); // Use a default and override it for one version where the // override is less than the default. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[packets] signature.default_disposition = 2030-01-01 signature.v3 = 2010-01-01 ").expect("valid config"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 3), ts("2010-01-01")); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 4), ts("2030-01-01")); // Use a default and override it for one version where the // override is greater than the default. let mut p = ConfiguredStandardPolicy::new(); p.parse_bytes(b"[packets] signature.default_disposition = 2030-01-01 signature.v3 = 2040-01-01 ").expect("valid config"); let p = p.build(); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 3), ts("2040-01-01")); assert_eq!( p.packet_tag_version_cutoff(Tag::Signature, 4), ts("2030-01-01")); Ok(()) } } sequoia-policy-config-0.6.0/src/testdata.rs000064400000000000000000000023741046102023000170110ustar 00000000000000//! Test data. //! //! This module includes the test data from `tests/data` in a //! structured way. use std::fmt; use std::collections::BTreeMap; use std::path::PathBuf; use lazy_static::lazy_static; pub struct Test { path: &'static str, pub bytes: &'static [u8], } impl fmt::Display for Test { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "tests/data/{}", self.path) } } #[allow(unused)] pub fn dir() -> PathBuf { PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/data")) } /// Returns the content of the given file below `keystore/tests/data`. pub fn file(name: &str) -> &'static [u8] { lazy_static! { static ref FILES: BTreeMap<&'static str, &'static [u8]> = { let mut m: BTreeMap<&'static str, &'static [u8]> = Default::default(); macro_rules! add { ( $key: expr, $path: expr ) => { m.insert($key, include_bytes!($path)) } } include!(concat!(env!("OUT_DIR"), "/tests.index.rs.inc")); // Sanity checks. assert!(m.contains_key("alice-secret.asc")); m }; } FILES.get(name).unwrap_or_else(|| panic!("No such file {:?}", name)) } sequoia-policy-config-0.6.0/tests/check.rs000064400000000000000000000044751046102023000166340ustar 00000000000000use std::env::current_dir; use sequoia_openpgp as openpgp; use openpgp::Result; use assert_cmd::Command; // use predicates::prelude::*; #[test] fn bad_config() -> Result<()> { let cwd = current_dir()?; println!("The current directory is {}", cwd.display()); let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; let assert = cmd.arg("tests/config/bad.toml") .assert(); assert.failure(); Ok(()) } #[test] fn good_config() -> Result<()> { let cwd = current_dir()?; println!("The current directory is {}", cwd.display()); let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; let assert = cmd.arg("tests/config/good.toml") .assert(); assert.success(); Ok(()) } #[test] fn bad_config_env() -> Result<()> { let cwd = current_dir()?; println!("The current directory is {}", cwd.display()); let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; let cmd = cmd.env( "SEQUOIA_CRYPTO_POLICY", format!("{}/{}", cwd.display(), "tests/config/bad.toml")); let assert = cmd.assert(); assert.failure(); Ok(()) } #[test] fn good_config_env() -> Result<()> { let cwd = current_dir()?; println!("The current directory is {}", cwd.display()); let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; let cmd = cmd.env( "SEQUOIA_CRYPTO_POLICY", format!("{}/{}", cwd.display(), "tests/config/good.toml")); let assert = cmd.assert(); assert.success(); Ok(()) } // If no configuration is supplied, this will just read the default // configuration. #[test] fn no_args() -> Result<()> { let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; // Make the default config a no-op in case the system // configuration is bad. cmd.env("SEQUOIA_CRYPTO_POLICY", ""); let assert = cmd.assert(); assert.success(); Ok(()) } // Using a relative path in "SEQUOIA_CRYPTO_POLICY" is not allowed. #[test] fn relative_path_env() -> Result<()> { let cwd = current_dir()?; println!("The current directory is {}", cwd.display()); let mut cmd = Command::cargo_bin("sequoia-policy-config-check")?; let cmd = cmd.env( "SEQUOIA_CRYPTO_POLICY", "tests/config/good.toml"); let assert = cmd.assert(); assert.failure(); Ok(()) } sequoia-policy-config-0.6.0/tests/config/bad.toml000064400000000000000000000000621046102023000200650ustar 00000000000000[hash_algorithms] sha1 = "always" sha42 = "never" sequoia-policy-config-0.6.0/tests/config/good.toml000064400000000000000000000000421046102023000202650ustar 00000000000000[hash_algorithms] sha1 = "always" sequoia-policy-config-0.6.0/tests/data/alice-secret.asc000064400000000000000000000016041046102023000211410ustar 00000000000000-----BEGIN PGP PRIVATE KEY BLOCK----- Comment: 7B2D 9926 16FD 0088 6A83 1154 2F92 5915 9C83 38C1 Comment: Alice xVgEY1aAWBYJKwYBBAHaRw8BAQdA9Tg2NuCoA8QYEvjBuGLzxXPNzd7PyKg2vG5b JJkBlGMAAQDYOh3Is4tC0g7iMWkC7Gf0y2h94VB9UmgBRwJqC1Qc2Q49wsALBB8W CgB9BYJjVoBYAwsJBwkQL5JZFZyDOMFHFAAAAAAAHgAgc2FsdEBub3RhdGlvbnMu c2VxdW9pYS1wZ3Aub3JnxH3auv+f9ubvVPzyAH+B8afVL+Rf4pARSJGVpAZaQowD FQoIApsBAh4BFiEEey2ZJhb9AIhqgxFUL5JZFZyDOMEAAAP3AQDwX256ji+JmFmw K0gJqYk5Su6QsHGjaHniplTjiEsaBQEA8n9FB7Sj465lwJ91WuToXAKkedpNoP86 K1PYxWmNswPNGUFsaWNlIDxhbGljZUBleGFtcGxlLm9yZz7CwA4EExYKAIAFgmNW gFgDCwkHCRAvklkVnIM4wUcUAAAAAAAeACBzYWx0QG5vdGF0aW9ucy5zZXF1b2lh LXBncC5vcmc6yIpZHwZmJ/qczU/BFHlentZHUM9rdHUUO+4aQ/uC4AMVCggCmQEC mwECHgEWIQR7LZkmFv0AiGqDEVQvklkVnIM4wQAA0RUA/08n5I8nU6lLHPZU7QNO 0Cx0dhnPXliCVmNvorXPYd8BAP9cMGitLMXgT4CIKDSfhh3h/Z4TgOt0rEvtU8JG Fb3RCw== =loDe -----END PGP PRIVATE KEY BLOCK-----