File snpguest-0.3.2.obscpio of Package snpguest.35698

07070100000000000041ED000000000000000000000002656E15F100000000000000000000000000000000000000000000001700000000snpguest-0.3.2/.github07070100000001000081A4000000000000000000000001656E15F100000211000000000000000000000000000000000000002700000000snpguest-0.3.2/.github/auto_assign.yml# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: true

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers: 
  - DGonzalezVillal
  - tylerfanelli
  - larrydewey
  - ryansavino

# A list of keywords to be skipped the process that add reviewers if pull requests include it 
skipKeywords:
  - wip
  - WIP

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 2
07070100000002000081A4000000000000000000000001656E15F100000012000000000000000000000000000000000000001A00000000snpguest-0.3.2/.gitignore/target
Cargo.lock07070100000003000081A4000000000000000000000001656E15F10000D285000000000000000000000000000000000000001A00000000snpguest-0.3.2/Cargo.lock# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "addr2line"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
 "gimli",
]

[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"

[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
 "memchr",
]

[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
 "winapi",
]

[[package]]
name = "anyhow"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"

[[package]]
name = "asn1-rs"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0"
dependencies = [
 "asn1-rs-derive",
 "asn1-rs-impl",
 "displaydoc",
 "nom",
 "num-traits",
 "rusticata-macros",
 "thiserror",
 "time",
]

[[package]]
name = "asn1-rs-derive"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
 "synstructure",
]

[[package]]
name = "asn1-rs-impl"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
]

[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
 "hermit-abi 0.1.19",
 "libc",
 "winapi",
]

[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"

[[package]]
name = "backtrace"
version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
 "addr2line",
 "cc",
 "cfg-if",
 "libc",
 "miniz_oxide",
 "object",
 "rustc-demangle",
]

[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"

[[package]]
name = "base64"
version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"

[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
 "serde",
]

[[package]]
name = "bitfield"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"

[[package]]
name = "bitfield"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac"

[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"

[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"

[[package]]
name = "bumpalo"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"

[[package]]
name = "bytes"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"

[[package]]
name = "cc"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
 "libc",
]

[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
 "ansi_term",
 "atty",
 "bitflags 1.3.2",
 "strsim",
 "textwrap",
 "unicode-width",
 "vec_map",
]

[[package]]
name = "codicon"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12170080f3533d6f09a19f81596f836854d0fa4867dc32c8172b8474b4e9de61"

[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "core-foundation-sys"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"

[[package]]
name = "data-encoding"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"

[[package]]
name = "der-parser"
version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e"
dependencies = [
 "asn1-rs",
 "displaydoc",
 "nom",
 "num-bigint",
 "num-traits",
 "rusticata-macros",
]

[[package]]
name = "dirs"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
 "dirs-sys",
]

[[package]]
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
 "libc",
 "option-ext",
 "redox_users",
 "windows-sys 0.48.0",
]

[[package]]
name = "displaydoc"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "encoding_rs"
version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [
 "cfg-if",
]

[[package]]
name = "enumflags2"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939"
dependencies = [
 "enumflags2_derive",
]

[[package]]
name = "enumflags2_derive"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "env_logger"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [
 "humantime",
 "is-terminal",
 "log",
 "regex",
 "termcolor",
]

[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"

[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
 "libc",
 "windows-sys 0.52.0",
]

[[package]]
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"

[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
 "foreign-types-shared",
]

[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"

[[package]]
name = "form_urlencoded"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
 "percent-encoding",
]

[[package]]
name = "futures-channel"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
dependencies = [
 "futures-core",
]

[[package]]
name = "futures-core"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"

[[package]]
name = "futures-io"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"

[[package]]
name = "futures-sink"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"

[[package]]
name = "futures-task"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"

[[package]]
name = "futures-util"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
dependencies = [
 "futures-core",
 "futures-io",
 "futures-task",
 "memchr",
 "pin-project-lite",
 "pin-utils",
 "slab",
]

[[package]]
name = "getrandom"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
dependencies = [
 "cfg-if",
 "libc",
 "wasi",
]

[[package]]
name = "gimli"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"

[[package]]
name = "h2"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178"
dependencies = [
 "bytes",
 "fnv",
 "futures-core",
 "futures-sink",
 "futures-util",
 "http",
 "indexmap",
 "slab",
 "tokio",
 "tokio-util",
 "tracing",
]

[[package]]
name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"

[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
 "unicode-segmentation",
]

[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
 "libc",
]

[[package]]
name = "hermit-abi"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"

[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"

[[package]]
name = "hostname-validator"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f558a64ac9af88b5ba400d99b579451af0d39c6d360980045b91aac966d705e2"

[[package]]
name = "http"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
dependencies = [
 "bytes",
 "fnv",
 "itoa",
]

[[package]]
name = "http-body"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
 "bytes",
 "http",
 "pin-project-lite",
]

[[package]]
name = "httparse"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"

[[package]]
name = "httpdate"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"

[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"

[[package]]
name = "hyper"
version = "0.14.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
dependencies = [
 "bytes",
 "futures-channel",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "httparse",
 "httpdate",
 "itoa",
 "pin-project-lite",
 "socket2 0.4.10",
 "tokio",
 "tower-service",
 "tracing",
 "want",
]

[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
 "bytes",
 "hyper",
 "native-tls",
 "tokio",
 "tokio-native-tls",
]

[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
 "unicode-bidi",
 "unicode-normalization",
]

[[package]]
name = "indexmap"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
 "equivalent",
 "hashbrown",
]

[[package]]
name = "iocuddle"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8972d5be69940353d5347a1344cb375d9b457d6809b428b05bb1ca2fb9ce007"

[[package]]
name = "ipnet"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"

[[package]]
name = "is-terminal"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
 "hermit-abi 0.3.3",
 "rustix",
 "windows-sys 0.48.0",
]

[[package]]
name = "itoa"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"

[[package]]
name = "js-sys"
version = "0.3.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
dependencies = [
 "wasm-bindgen",
]

[[package]]
name = "kvm-bindings"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efe70e65a5b092161d17f5005b66e5eefe7a94a70c332e755036fc4af78c4e79"
dependencies = [
 "vmm-sys-util",
]

[[package]]
name = "kvm-ioctls"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bdde2b46ee7b6587ef79f751019c4726c4f2d3e4628df5d69f3f9c5cb6c6bd4"
dependencies = [
 "kvm-bindings",
 "libc",
 "vmm-sys-util",
]

[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"

[[package]]
name = "libc"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"

[[package]]
name = "libredox"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
 "bitflags 2.4.1",
 "libc",
 "redox_syscall",
]

[[package]]
name = "linux-raw-sys"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"

[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"

[[package]]
name = "mbox"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f88d5c34d63aad11aa4321ef55ccb064af58b3ad8091079ae22bf83e5eb75d6"
dependencies = [
 "libc",
 "rustc_version",
 "stable_deref_trait",
]

[[package]]
name = "memchr"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"

[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
 "autocfg",
]

[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"

[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"

[[package]]
name = "miniz_oxide"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
dependencies = [
 "adler",
]

[[package]]
name = "mio"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
dependencies = [
 "libc",
 "wasi",
 "windows-sys 0.48.0",
]

[[package]]
name = "native-tls"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
dependencies = [
 "lazy_static",
 "libc",
 "log",
 "openssl",
 "openssl-probe",
 "openssl-sys",
 "schannel",
 "security-framework",
 "security-framework-sys",
 "tempfile",
]

[[package]]
name = "nix"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
dependencies = [
 "bitflags 1.3.2",
 "cc",
 "cfg-if",
 "libc",
 "memoffset",
]

[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
 "memchr",
 "minimal-lexical",
]

[[package]]
name = "num-bigint"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
 "autocfg",
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-derive"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
 "autocfg",
 "num-traits",
]

[[package]]
name = "num-traits"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
dependencies = [
 "autocfg",
]

[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
 "hermit-abi 0.3.3",
 "libc",
]

[[package]]
name = "object"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
 "memchr",
]

[[package]]
name = "oid"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c19903c598813dba001b53beeae59bb77ad4892c5c1b9b3500ce4293a0d06c2"
dependencies = [
 "serde",
]

[[package]]
name = "oid-registry"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff"
dependencies = [
 "asn1-rs",
]

[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"

[[package]]
name = "openssl"
version = "0.10.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800"
dependencies = [
 "bitflags 2.4.1",
 "cfg-if",
 "foreign-types",
 "libc",
 "once_cell",
 "openssl-macros",
 "openssl-sys",
]

[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"

[[package]]
name = "openssl-src"
version = "300.1.6+3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085"
dependencies = [
 "cc",
]

[[package]]
name = "openssl-sys"
version = "0.9.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f"
dependencies = [
 "cc",
 "libc",
 "openssl-src",
 "pkg-config",
 "vcpkg",
]

[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"

[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"

[[package]]
name = "pest"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5"
dependencies = [
 "memchr",
 "thiserror",
 "ucd-trie",
]

[[package]]
name = "picky-asn1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "295eea0f33c16be21e2a98b908fdd4d73c04dd48c8480991b76dbcf0cb58b212"
dependencies = [
 "oid",
 "serde",
 "serde_bytes",
]

[[package]]
name = "picky-asn1-der"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5df7873a9e36d42dadb393bea5e211fe83d793c172afad5fb4ec846ec582793f"
dependencies = [
 "picky-asn1",
 "serde",
 "serde_bytes",
]

[[package]]
name = "picky-asn1-x509"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c5f20f71a68499ff32310f418a6fad8816eac1a2859ed3f0c5c741389dd6208"
dependencies = [
 "base64 0.21.5",
 "oid",
 "picky-asn1",
 "picky-asn1-der",
 "serde",
]

[[package]]
name = "pin-project-lite"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"

[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"

[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"

[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
 "proc-macro-error-attr",
 "proc-macro2",
 "quote",
 "syn 1.0.109",
 "version_check",
]

[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
 "proc-macro2",
 "quote",
 "version_check",
]

[[package]]
name = "proc-macro2"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
 "unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
 "proc-macro2",
]

[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
 "libc",
 "rand_chacha",
 "rand_core",
]

[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
 "ppv-lite86",
 "rand_core",
]

[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
 "getrandom",
]

[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
 "bitflags 1.3.2",
]

[[package]]
name = "redox_users"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
dependencies = [
 "getrandom",
 "libredox",
 "thiserror",
]

[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
 "aho-corasick",
 "memchr",
 "regex-automata",
 "regex-syntax",
]

[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
 "aho-corasick",
 "memchr",
 "regex-syntax",
]

[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"

[[package]]
name = "reqwest"
version = "0.11.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
dependencies = [
 "base64 0.21.5",
 "bytes",
 "encoding_rs",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "hyper",
 "hyper-tls",
 "ipnet",
 "js-sys",
 "log",
 "mime",
 "native-tls",
 "once_cell",
 "percent-encoding",
 "pin-project-lite",
 "serde",
 "serde_json",
 "serde_urlencoded",
 "system-configuration",
 "tokio",
 "tokio-native-tls",
 "tower-service",
 "url",
 "wasm-bindgen",
 "wasm-bindgen-futures",
 "web-sys",
 "winreg",
]

[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
 "cc",
 "libc",
 "once_cell",
 "spin",
 "untrusted",
 "web-sys",
 "winapi",
]

[[package]]
name = "rustc-demangle"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"

[[package]]
name = "rustc_version"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
 "semver",
]

[[package]]
name = "rusticata-macros"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632"
dependencies = [
 "nom",
]

[[package]]
name = "rustix"
version = "0.38.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a"
dependencies = [
 "bitflags 2.4.1",
 "errno",
 "libc",
 "linux-raw-sys",
 "windows-sys 0.52.0",
]

[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"

[[package]]
name = "schannel"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
dependencies = [
 "windows-sys 0.48.0",
]

[[package]]
name = "security-framework"
version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
dependencies = [
 "bitflags 1.3.2",
 "core-foundation",
 "core-foundation-sys",
 "libc",
 "security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "semver"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
 "semver-parser",
]

[[package]]
name = "semver-parser"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
dependencies = [
 "pest",
]

[[package]]
name = "serde"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
dependencies = [
 "serde_derive",
]

[[package]]
name = "serde-big-array"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f"
dependencies = [
 "serde",
]

[[package]]
name = "serde_bytes"
version = "0.11.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff"
dependencies = [
 "serde",
]

[[package]]
name = "serde_derive"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "serde_json"
version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "serde_urlencoded"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
 "form_urlencoded",
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "sev"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fd749a01c88a51ac718b59fe571177b31e478dfe059267977042477a0531224"
dependencies = [
 "bincode",
 "bitfield 0.13.2",
 "bitflags 1.3.2",
 "codicon",
 "dirs",
 "hex",
 "iocuddle",
 "kvm-ioctls",
 "openssl",
 "serde",
 "serde-big-array",
 "serde_bytes",
 "static_assertions",
 "uuid",
]

[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
 "autocfg",
]

[[package]]
name = "snpguest"
version = "0.3.1"
dependencies = [
 "anyhow",
 "asn1-rs",
 "bincode",
 "env_logger",
 "hex",
 "nix",
 "openssl",
 "rand",
 "reqwest",
 "serde",
 "sev",
 "structopt",
 "tss-esapi",
 "x509-parser",
]

[[package]]
name = "socket2"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
dependencies = [
 "libc",
 "winapi",
]

[[package]]
name = "socket2"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
 "libc",
 "windows-sys 0.48.0",
]

[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"

[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"

[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"

[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"

[[package]]
name = "structopt"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
dependencies = [
 "clap",
 "lazy_static",
 "structopt-derive",
]

[[package]]
name = "structopt-derive"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
 "heck",
 "proc-macro-error",
 "proc-macro2",
 "quote",
 "syn 1.0.109",
]

[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-ident",
]

[[package]]
name = "syn"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-ident",
]

[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
 "unicode-xid",
]

[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
 "bitflags 1.3.2",
 "core-foundation",
 "system-configuration-sys",
]

[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "target-lexicon"
version = "0.12.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"

[[package]]
name = "tempfile"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
 "cfg-if",
 "fastrand",
 "redox_syscall",
 "rustix",
 "windows-sys 0.48.0",
]

[[package]]
name = "termcolor"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
dependencies = [
 "winapi-util",
]

[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
 "unicode-width",
]

[[package]]
name = "thiserror"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
 "thiserror-impl",
]

[[package]]
name = "thiserror-impl"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]

[[package]]
name = "time"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
dependencies = [
 "itoa",
 "serde",
 "time-core",
 "time-macros",
]

[[package]]
name = "time-core"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"

[[package]]
name = "time-macros"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
dependencies = [
 "time-core",
]

[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
name = "tokio"
version = "1.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
dependencies = [
 "backtrace",
 "bytes",
 "libc",
 "mio",
 "num_cpus",
 "pin-project-lite",
 "socket2 0.5.5",
 "windows-sys 0.48.0",
]

[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
 "native-tls",
 "tokio",
]

[[package]]
name = "tokio-util"
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
dependencies = [
 "bytes",
 "futures-core",
 "futures-sink",
 "pin-project-lite",
 "tokio",
 "tracing",
]

[[package]]
name = "tower-service"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"

[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
 "pin-project-lite",
 "tracing-core",
]

[[package]]
name = "tracing-core"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
 "once_cell",
]

[[package]]
name = "try-lock"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"

[[package]]
name = "tss-esapi"
version = "7.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de234df360c349f78ecd33f0816ab3842db635732212b5cfad67f2638336864e"
dependencies = [
 "bitfield 0.14.0",
 "enumflags2",
 "hostname-validator",
 "log",
 "mbox",
 "num-derive",
 "num-traits",
 "oid",
 "picky-asn1",
 "picky-asn1-x509",
 "regex",
 "serde",
 "tss-esapi-sys",
 "zeroize",
]

[[package]]
name = "tss-esapi-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535cd192581c2ec4d5f82e670b1d3fbba6a23ccce8c85de387642051d7cad5b5"
dependencies = [
 "pkg-config",
 "target-lexicon",
]

[[package]]
name = "ucd-trie"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"

[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"

[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"

[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-segmentation"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"

[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"

[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"

[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"

[[package]]
name = "url"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
 "form_urlencoded",
 "idna",
 "percent-encoding",
]

[[package]]
name = "uuid"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
dependencies = [
 "serde",
]

[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"

[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"

[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"

[[package]]
name = "vmm-sys-util"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48b7b084231214f7427041e4220d77dfe726897a6d41fddee450696e66ff2a29"
dependencies = [
 "bitflags 1.3.2",
 "libc",
]

[[package]]
name = "want"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
 "try-lock",
]

[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasm-bindgen"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
dependencies = [
 "bumpalo",
 "log",
 "once_cell",
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12"
dependencies = [
 "cfg-if",
 "js-sys",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"

[[package]]
name = "web-sys"
version = "0.3.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f"
dependencies = [
 "js-sys",
 "wasm-bindgen",
]

[[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.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
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.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
 "windows-targets 0.48.5",
]

[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
 "windows-targets 0.52.0",
]

[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
 "windows_aarch64_gnullvm 0.48.5",
 "windows_aarch64_msvc 0.48.5",
 "windows_i686_gnu 0.48.5",
 "windows_i686_msvc 0.48.5",
 "windows_x86_64_gnu 0.48.5",
 "windows_x86_64_gnullvm 0.48.5",
 "windows_x86_64_msvc 0.48.5",
]

[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
 "windows_aarch64_gnullvm 0.52.0",
 "windows_aarch64_msvc 0.52.0",
 "windows_i686_gnu 0.52.0",
 "windows_i686_msvc 0.52.0",
 "windows_x86_64_gnu 0.52.0",
 "windows_x86_64_gnullvm 0.52.0",
 "windows_x86_64_msvc 0.52.0",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"

[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"

[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"

[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"

[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"

[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"

[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"

[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"

[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
 "cfg-if",
 "windows-sys 0.48.0",
]

[[package]]
name = "x509-parser"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8"
dependencies = [
 "asn1-rs",
 "base64 0.13.1",
 "data-encoding",
 "der-parser",
 "lazy_static",
 "nom",
 "oid-registry",
 "ring",
 "rusticata-macros",
 "thiserror",
 "time",
]

[[package]]
name = "zeroize"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
dependencies = [
 "zeroize_derive",
]

[[package]]
name = "zeroize_derive"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
]
07070100000004000081A4000000000000000000000001656E15F10000042E000000000000000000000000000000000000001A00000000snpguest-0.3.2/Cargo.toml[package]
name = "snpguest"
version = "0.3.2"
authors = ["The VirTEE Project Developers"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://github.com/virtee/snpguest"
repository = "https://github.com/virtee/snpguest"
description = "Navigation utility for AMD SEV-SNP guest environment"
readme = "README.md"
keywords = ["amd", "sev", "sev-snp", "snp"]
exclude = [ ".gitignore", ".github/*" ]
rust-version = "1.66"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = []
hyperv = ["tss-esapi"]

[dependencies]
structopt = "0.3"
env_logger = "0.10.0"
anyhow = "1.0.69"
sev = { version = "^1.2", default-features = false, features = ['openssl','snp']}
nix = "^0.23"
serde = { version = "1.0", features = ["derive"] }
bincode = "^1.2.1"
openssl = { version = "^0.10", features = ["vendored"]}
reqwest = { version="0.11.10", features = ["blocking"] }
hex = "0.4"
x509-parser = { version="^0.14", features=["verify"] }
asn1-rs = "0.5.2"
rand = "0.8.5"
tss-esapi = { version = "7.2", optional=true }
07070100000005000081A4000000000000000000000001656E15F100002C5D000000000000000000000000000000000000001700000000snpguest-0.3.2/LICENSE                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
07070100000006000081A4000000000000000000000001656E15F10000011F000000000000000000000000000000000000001900000000snpguest-0.3.2/README.md# snpguest

`snpguest` is a command line utility for interacting with the AMD Secure
Encrypted Virtualization - Secure Nested Paging (SEV-SNP) guest environment
(via the `/dev/sev-guest` device).

Please consult the manpage (docs/snpguest.1.adoc) for an overview of snpguest's
commands.
07070100000007000041ED000000000000000000000002656E15F100000000000000000000000000000000000000000000001400000000snpguest-0.3.2/docs07070100000008000081A4000000000000000000000001656E15F100001C95000000000000000000000000000000000000002400000000snpguest-0.3.2/docs/snpguest.1.adocsnpguest(1)
===========

NAME
----
snpguest - Command line tool for managing the AMD SEV-SNP Guest environment.


SYNOPSIS
--------
*snpguest* [GLOBAL_OPTIONS] [COMMAND] [COMMAND_ARGS] [SUBCOMMAND] [SUBCOMMAND_ARGS]
*snpguest* [_-h, --help_]


DESCRIPTION
-----------
snpguest is a CLI utility for navigating and interacting with the AMD SEV-SNP
guest firmware device of a guest system.


GLOBAL OPTIONS
--------------
*-q, --quiet*:: Don't print any output to the console.


COMMANDS
--------
*snpguest report*::
    usage: snpguest report $ATT_REPORT_PATH $REQUEST_FILE [-v, --vmpl] $VMPL [-r, --random] [-p, --platform]
    
    Requests an attestation report from the host and writes it in a file with the provided request data and vmpl. 
    Will write the contents of the attestation report in binary format into the specified report path.
    A path for the attestation report must be provided.
    User can pass 64 bytes of data in any file format into $REQUEST_FILE in order to use that data to request the attestation report.
    The user can use the --random flag to generate and use random data for request data.
    For Microsoft Hyper-V guests, a user can use the --platform flag to use the request data that was pre-generated
    from the platform. Currently, for Hyper-V guests, --platform is required, as there is no ability to write
    request data for the attestation report.
    If the user uses the --random flag, then the data will be written into the file they provided in $REQUEST_FILE.
    VMPL is an optional parameter and it defaults to 1.
    
    options:
    -h, --help  show a help message
    -r, --random  Generate 64 random bytes of data to pass for the report request
    -v, --vmpl Specify a different vmpl level for the attestation report (defaults to 1)

*snpguest certificates*::
    usage: snpguest certificates $ENCODING $CERTS_DIR
    
    Requests the certificate chain (ASK, ARK & VCEK) from host memory (requests extended-config).
    The user needs to specify the certificate encoding they would like store the certs in [PEM | DER].
    Currently only PEM and DER encondings are supported.
    All of the certs will be in the same encoding.
    The user also needs to provide the path to the directory where the certs will be stored.
    If the certificate already exists in the provided directory, it will be overwritten.
    The attestation report will be ingored for this request, to request and store an attestation report use the "report" command.
    
    options:
    -h, --help  show a help message

*snpguest fetch ca*::
    usage: snpguest fetch ca $ENCODING $PROCESSOR_MODEL $CERTS_DIR

    Requests the certificate authority chain (ARK & ASK) from the KDS.
    The user needs to specify the certificate encoding they would like store the certs in [PEM | DER].
    Currently only PEM and DER encondings are supported.
    Both of the certs will be in the same encoding.
    The user must specify their host processor model [Milan | Genoa].
    The user needs to provide the path to the directory where the certs will be stored.
    If the certificates already exist in the provided directory, they will be overwritten.

    options:
    -h, --help show a help message

*snpguest fetch vcek*::
    usage: snpguest fetch vcek $ENCODING $PROCESSOR_MODEL $CERTS_DIR $ATT_REPORT_PATH

    Requests the VCEK certificate from the KDS.
    The user needs to specify the certificate encoding they would like store the cert in [PEM | DER].
    Currently only PEM and DER encondings are supported.
    The user must specify their host processor model [Milan | Genoa].
    The user needs to provide the path to the directory where the VCEK will be stored.
    If the certificate already exists in the provided directory, it will be overwritten.
    The user also needs to provide the path to a stored attestation report that will be used to request the VCEK.

    options:
    -h, --help show a help message

*snpguest guest verify certs*::
    usage: snpguest verify certs $CERTS_DIR

    Verifies that the provided certificate chain has been properly signed by each certificate.
    The user needs to provide a directory were all 3 of the certificates are stored (ARK,ASK and VCEK).
    Error will be raised if any of the certificates fails verification.

    options:
    -h, --help show a help message

*snpguest verify attestation*::
    usage: snpguest verify attestation $CERTS_DIR $ATT_REPORT_PATH [-t, --tcb] [-s, --signature]

    Verifies the contents of the Attestation Report using the VCEK certificate.
    The user needs to provide the path to the directory containing the VCEK certificate.
    The user also needs to provide the path to a stored attestation report to be verified.
    Error will be raised if the attestation verification fails at any point.
    The user can use the [-t, --tcb] flag to only validate the tcb contents of the report.
    The user can use the [-s, --signature] flag to only validate the report signature.

    options:
    -h, --help show a help message
    -t, --tcb verify the tcb section of the report only
    -s, --signature verify the signature of the report only

*snpguest key*::
    usage: snpguest key $KEY_PATH $ROOT_KEY_SELECT [-g, --guest_field_select] [-s, --guest_svn] [-t, --tcb_version] [-v, --vmpl]
    Creates the derived key based on input parameters and stores it.
    $KEY_PATH is the path to store the derived key.
    $ROOT_KEY_SELECT is the root key from which to derive the key. Input either "vcek" or "vmrk".
    The --guest_field_select option specifies which Guest Field Select bits to enable. It is a 6 digit binary string. For each bit, 0 denotes off and 1 denotes on.
    The least significant (rightmost) bit is Guest Policy followed by Image ID, Family ID, Measurement, SVN, TCB Version which is the most significant (leftmost) bit. 
     example: snpguest key $KEY_PATH $ROOT_KEY_SELECT --guest_field_select 100001 (Denotes Guest Policy:On, Image ID:Off, Family ID:Off, Measurement:Off, SVN:Off, TCB Version:On)
    The --guest_svn specifies the guest SVN to mix into the key. Must not exceed the guest SVN provided at launch in the ID block.
    The --tcb_version specified the TCB version to mix into the derived key. Must not exceed CommittedTcb.


    options:
    -h, --help show a help message
    -g, --guest_field_select      Specify which Guest Field Select bits to enable. 
    -s, --guest_svn                Specify the guest SVN to mix into the key.
    -t, --tcb_version               Specify the TCB version to mix into the derived key. 
    -v, --vmpl                      Specify VMPL level the Guest is running on. Defaults to 1.
 


*snpguest guest display report*::
    usage: snpguest display report $ATT_REPORT_PATH

    Prints the attestation report contents into terminal.
    The user has to provide a path to a stored attestation report to display.

    options:
    -h, --help show a help message

*snpguest guest display key*::
    usage: snpguest display key $KEY_PATH

    Prints the derived key contents in hex format into terminal.
    The user has to provide the path of a stored derived key to display.

    options:
    -h, --help show a help message

*

REPORTING BUGS
--------------

Please report all bugs to <https://github.com/virtee/snpguest/issues>07070100000009000041ED000000000000000000000002656E15F100000000000000000000000000000000000000000000001300000000snpguest-0.3.2/src0707010000000A000081A4000000000000000000000001656E15F1000019FF000000000000000000000000000000000000001C00000000snpguest-0.3.2/src/certs.rs// SPDX-License-Identifier: Apache-2.0

use super::*;

use std::{
    fs,
    io::{ErrorKind, Read, Write},
    path::PathBuf,
    str::FromStr,
};

use sev::{
    certs::snp::{ca, Certificate, Chain},
    firmware::{guest::Firmware, host::CertType},
};

use openssl::x509::X509;

pub struct CertPaths {
    pub ark_path: PathBuf,
    pub ask_path: PathBuf,
    pub vcek_path: PathBuf,
}
#[derive(StructOpt, Clone, Copy)]
pub enum CertFormat {
    #[structopt(about = "Certificates are encoded in PEM format.")]
    Pem,

    #[structopt(about = "Certificates are encoded in DER format.")]
    Der,
}

impl FromStr for CertFormat {
    type Err = anyhow::Error;
    fn from_str(input: &str) -> Result<CertFormat, anyhow::Error> {
        match input.to_lowercase().as_str() {
            "pem" => Ok(CertFormat::Pem),
            "der" => Ok(CertFormat::Der),
            _ => Err(anyhow::anyhow!("Invalid Cert Format!")),
        }
    }
}

// Function to check if certificate is in .der or .pem depending on its contents
fn identify_cert(buf: &[u8]) -> CertFormat {
    // Pem certificates will start with this byte content
    const PEM_START: &[u8] = &[
        45, 45, 45, 45, 45, 66, 69, 71, 73, 78, 32, 67, 69, 82, 84, 73, 70, 73, 67, 65, 84, 69, 45,
        45, 45, 45, 45,
    ];

    match buf {
        PEM_START => CertFormat::Pem,
        _ => CertFormat::Der,
    }
}

// Function that will convert a cert path into a snp Certificate
pub fn convert_path_to_cert(
    cert_path: &PathBuf,
    cert_type: &str,
) -> Result<Certificate, anyhow::Error> {
    let mut buf = vec![];

    let mut current_file = if cert_path.as_os_str().is_empty() {
        match fs::File::open(format!("./certs/{cert_type}.pem")) {
            Ok(file) => file,
            Err(err) => match err.kind() {
                ErrorKind::NotFound => match fs::File::open(format!("./certs/{cert_type}.der")) {
                    Ok(file) => file,
                    Err(e) => {
                        return Err(anyhow::anyhow!("Problem opening {cert_type} file {:?}", e))
                    }
                },
                other_error => {
                    return Err(anyhow::anyhow!(
                        "Problem opening {cert_type} file {:?}",
                        other_error
                    ));
                }
            },
        }
    } else {
        fs::File::open(cert_path).context(format!("Could not open provided {cert_type} file"))?
    };

    current_file
        .read_to_end(&mut buf)
        .context(format!("Could not read contents of {cert_type} file"))?;

    let cert = match identify_cert(&buf[0..27]) {
        CertFormat::Pem => Certificate::from_pem(&buf)
            .context(format!("Could not convert {cert_type} data into X509"))?,
        CertFormat::Der => Certificate::from_der(&buf)
            .context(format!("Could not convert {cert_type} data into X509"))?,
    };

    Ok(cert)
}

// Tryfrom function that takes in 3 certificate paths returns a snp Certificate Chain
impl TryFrom<CertPaths> for Chain {
    type Error = anyhow::Error;
    fn try_from(content: CertPaths) -> Result<Self, Self::Error> {
        let ark_cert = convert_path_to_cert(&content.ark_path, "ark")?;
        let ask_cert = convert_path_to_cert(&content.ask_path, "ask")?;
        let vcek_cert = convert_path_to_cert(&content.vcek_path, "vcek")?;

        let ca_chain = ca::Chain {
            ark: ark_cert,
            ask: ask_cert,
        };

        Ok(Chain {
            ca: ca_chain,
            vcek: vcek_cert,
        })
    }
}

fn translate_cert(data: &[u8], cert_encoding: CertFormat) -> Vec<u8> {
    match (identify_cert(&data[0..27]), cert_encoding) {
        (CertFormat::Pem, CertFormat::Der) => X509::from_pem(data)
            .expect("Failed to parse the certificate")
            .to_der()
            .expect("Failed to convert to DER encoding"),
        (CertFormat::Der, CertFormat::Pem) => X509::from_der(data)
            .expect("Failed to parse the certificate")
            .to_pem()
            .expect("Failed to convert to PEM encoding"),
        _ => Vec::from(data),
    }
}

// Function used to write provided cert into desired directory.
pub fn write_cert(
    mut path: PathBuf,
    cert_type: &CertType,
    data: &[u8],
    encoding: CertFormat,
) -> Result<()> {
    // Get cert type into str
    let cert_str = match cert_type {
        CertType::ARK => "ark",
        CertType::ASK => "ask",
        CertType::VCEK => "vcek",
        _ => return Err(anyhow::anyhow!("Invalid cert type")),
    };

    let file_ext: &str = match encoding {
        CertFormat::Pem => "pem",
        CertFormat::Der => "der",
    };

    path.push(format!("{}.{}", cert_str, file_ext));

    let bytes: Vec<u8> = translate_cert(data, encoding);

    // Write cert into directory
    let mut file = if path.exists() {
        std::fs::OpenOptions::new()
            .write(true)
            .truncate(true)
            .open(path)
            .context(format!("Unable to overwrite {} cert contents", cert_str))?
    } else {
        fs::File::create(path).context(format!("Unable to create {} certificate", cert_str))?
    };

    file.write(&bytes)
        .context(format!("unable to write data to file {:?}", file))?;

    Ok(())
}

#[derive(StructOpt)]
pub struct CertificatesArgs {
    #[structopt(help = "Specify encoding to use for certificates. [PEM | DER]")]
    pub encoding: CertFormat,

    #[structopt(
        help = "Directory to store certificates in. Required if requesting an extended-report."
    )]
    pub certs_dir: PathBuf,
}

pub fn get_ext_certs(args: CertificatesArgs) -> Result<()> {
    let mut sev_fw: Firmware = Firmware::open().context("failed to open SEV firmware device.")?;

    // Generate random request data
    let request_data = report::create_random_request();

    // Request extended attestation report
    let (_, certificates) = sev_fw
        .get_ext_report(None, Some(request_data), None)
        .context("Failed to get extended report.")?;

    // Check if the returned table is empty
    if certificates.is_empty() {
        return Err(anyhow::anyhow!(
            "The certificate chain is empty! Certificates probably not loaded by the host."
        ));
    }

    // Create certificate directory if missing
    if !args.certs_dir.exists() {
        fs::create_dir(args.certs_dir.clone()).context("Could not create certs folder")?;
    };

    // Write certs into directory
    for cert in certificates.iter() {
        let path = args.certs_dir.clone();

        write_cert(path, &cert.cert_type, &cert.data, args.encoding)?;
    }

    Ok(())
}
0707010000000B000081A4000000000000000000000001656E15F1000007A0000000000000000000000000000000000000001E00000000snpguest-0.3.2/src/display.rs// SPDX-License-Identifier: Apache-2.0

use super::*;
use std::path::PathBuf;

#[derive(StructOpt)]
pub enum DisplayCmd {
    #[structopt(about = "Display an attestation report in console.")]
    Report(report_display::Args),

    #[structopt(about = "Display the derived key in console.")]
    Key(key_display::Args),
}

pub fn cmd(cmd: DisplayCmd, quiet: bool) -> Result<()> {
    match cmd {
        DisplayCmd::Report(args) => report_display::display_attestation_report(args, quiet),
        DisplayCmd::Key(args) => key_display::display_derived_key(args, quiet),
    }
}
mod report_display {
    use super::*;

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Path to attestation report to display.")]
        pub att_report_path: PathBuf,
    }

    // Print attestation report in console
    pub fn display_attestation_report(args: Args, quiet: bool) -> Result<()> {
        let att_report = report::read_report(args.att_report_path)
            .context("Could not open attestation report")?;

        if !quiet {
            println!("{}", att_report);
        };

        Ok(())
    }
}

mod key_display {
    use super::*;

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Path of key to be displayed.")]
        pub key_path: PathBuf,
    }

    // Print derived key in console
    pub fn display_derived_key(args: Args, quiet: bool) -> Result<()> {
        let key_report = key::read_key(args.key_path).context("Could not open key")?;

        if !quiet {
            let mut keydata: String = String::new();
            for (i, byte) in key_report.iter().enumerate() {
                if (i % 16) == 0 {
                    keydata.push('\n');
                }
                //Displaying key in Hex format
                keydata.push_str(&format!("{byte:02x} "));
            }
            keydata.push('\n');
            println!("{}", keydata);
        };

        Ok(())
    }
}
0707010000000C000081A4000000000000000000000001656E15F10000177A000000000000000000000000000000000000001C00000000snpguest-0.3.2/src/fetch.rs// SPDX-License-Identifier: Apache-2.0

use super::*;

use core::fmt;

use std::{fs, path::PathBuf, str::FromStr};

use reqwest::blocking::{get, Response};

use sev::firmware::host::CertType;

use certs::{write_cert, CertFormat};

#[derive(StructOpt)]
pub enum FetchCmd {
    #[structopt(about = "Fetch the certificate authority (ARK & ASK) from the KDS.")]
    CA(cert_authority::Args),

    #[structopt(about = "Fetch the VCEK from the KDS.")]
    Vcek(vcek::Args),
}

#[derive(Debug, Clone)]
pub enum ProcType {
    Milan,
    Genoa,
}

impl FromStr for ProcType {
    type Err = anyhow::Error;
    fn from_str(input: &str) -> Result<ProcType, anyhow::Error> {
        match input.to_lowercase().as_str() {
            "milan" => Ok(ProcType::Milan),
            "genoa" => Ok(ProcType::Genoa),
            _ => Err(anyhow::anyhow!("Processor type not found!")),
        }
    }
}

impl fmt::Display for ProcType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            ProcType::Milan => write!(f, "Milan"),
            ProcType::Genoa => write!(f, "Genoa"),
        }
    }
}

pub fn cmd(cmd: FetchCmd) -> Result<()> {
    match cmd {
        FetchCmd::CA(args) => cert_authority::fetch_ca(args),
        FetchCmd::Vcek(args) => vcek::fetch_vcek(args),
    }
}

mod cert_authority {
    use super::*;
    use openssl::x509::X509;

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Specify encoding to use for certificates. [PEM | DER]")]
        pub encoding: CertFormat,

        #[structopt(
            help = "Specify the processor model for the certificate chain. [Milan | Genoa]"
        )]
        pub processor_model: ProcType,

        #[structopt(help = "Directory to store the certificates in.")]
        pub certs_dir: PathBuf,
    }

    // Function to build kds request for ca chain and return a vector with the 2 certs (ASK & ARK)
    pub fn request_ca_kds(processor_model: ProcType) -> Result<Vec<X509>, anyhow::Error> {
        const KDS_CERT_SITE: &str = "https://kdsintf.amd.com";
        const KDS_VCEK: &str = "/vcek/v1";
        const KDS_CERT_CHAIN: &str = "cert_chain";

        // Should make -> https://kdsintf.amd.com/vcek/v1/{SEV_PROD_NAME}/cert_chain
        let url: String = format!("{KDS_CERT_SITE}{KDS_VCEK}/{processor_model}/{KDS_CERT_CHAIN}");

        let rsp: Response = get(url).context("Could not get certs from URL")?;

        // Parse response
        let body = rsp
            .bytes()
            .context("Unable to parse AMD certificate chain")?
            .to_vec();

        let certificates = X509::stack_from_pem(&body)?;

        Ok(certificates)
    }

    // Fetch the ca from the kds and write it into the certs directory
    pub fn fetch_ca(args: Args) -> Result<()> {
        // Get certs from kds
        let certificates = request_ca_kds(args.processor_model)?;

        // Create certs directory if missing
        if !args.certs_dir.exists() {
            fs::create_dir(args.certs_dir.clone()).context("Could not create certs folder")?;
        }

        let ark_cert = &certificates[1];
        let ask_cert = &certificates[0];

        write_cert(
            args.certs_dir.clone(),
            &CertType::ARK,
            &ark_cert.to_pem()?,
            args.encoding,
        )?;
        write_cert(
            args.certs_dir.clone(),
            &CertType::ASK,
            &ask_cert.to_pem()?,
            args.encoding,
        )?;

        Ok(())
    }
}

mod vcek {
    use super::*;

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Specify encoding to use for certificates. [PEM | DER]")]
        pub encoding: CertFormat,

        #[structopt(
            help = "Specify the processor model for the certificate chain. [Milan | Genoa]"
        )]
        pub processor_model: ProcType,

        #[structopt(help = "Directory to store the certificates in.")]
        pub certs_dir: PathBuf,

        #[structopt(help = "Path to attestation report to use to request VCEK.")]
        pub att_report_path: PathBuf,
    }

    // Function to request vcek from KDS. Return vcek in der format.
    pub fn request_vcek_kds(
        processor_model: ProcType,
        att_report_path: PathBuf,
    ) -> Result<Vec<u8>, anyhow::Error> {
        // KDS URL parameters
        const KDS_CERT_SITE: &str = "https://kdsintf.amd.com";
        const KDS_VCEK: &str = "/vcek/v1";

        // Grab attestation report if path provided, request report if no path is provided
        let att_report = if !att_report_path.exists() {
            return Err(anyhow::anyhow!("No attestation report in provided path."));
        } else {
            report::read_report(att_report_path).context("Could not open attestation report")?
        };

        // Use attestation report to get data for URL
        let hw_id: String = hex::encode(att_report.chip_id);

        let vcek_url: String = format!(
            "{KDS_CERT_SITE}{KDS_VCEK}/{processor_model}/\
            {hw_id}?blSPL={:02}&teeSPL={:02}&snpSPL={:02}&ucodeSPL={:02}",
            att_report.reported_tcb.bootloader,
            att_report.reported_tcb.tee,
            att_report.reported_tcb.snp,
            att_report.reported_tcb.microcode
        );

        // VCEK in DER format
        let vcek_rsp = get(vcek_url).context("Could not get VCEK from URL")?;

        let vcek_rsp_bytes = vcek_rsp.bytes().context("Unable to parse VCEK")?.to_vec();

        Ok(vcek_rsp_bytes)
    }

    // Function to request vcek from kds and write it into file
    pub fn fetch_vcek(args: Args) -> Result<()> {
        // Request vcek
        let vcek = request_vcek_kds(args.processor_model, args.att_report_path)?;

        if !args.certs_dir.exists() {
            fs::create_dir(args.certs_dir.clone()).context("Could not create certs folder")?;
        }

        let vcek_path = args.certs_dir.clone();

        write_cert(vcek_path, &CertType::VCEK, &vcek, args.encoding)?;

        Ok(())
    }
}
0707010000000D000041ED000000000000000000000002656E15F100000000000000000000000000000000000000000000001A00000000snpguest-0.3.2/src/hyperv0707010000000E000081A4000000000000000000000001656E15F100000E04000000000000000000000000000000000000002100000000snpguest-0.3.2/src/hyperv/mod.rs// SPDX-License-Identifier: Apache-2.0

use super::*;

use std::arch::x86_64::__cpuid;

const CPUID_GET_HIGHEST_FUNCTION: u32 = 0x80000000;
const CPUID_PROCESSOR_INFO_AND_FEATURE_BITS: u32 = 0x1;

const CPUID_FEATURE_HYPERVISOR: u32 = 1 << 31;

const CPUID_HYPERV_SIG: &str = "Microsoft Hv";
const CPUID_HYPERV_VENDOR_AND_MAX_FUNCTIONS: u32 = 0x40000000;
const CPUID_HYPERV_FEATURES: u32 = 0x40000003;
const CPUID_HYPERV_MIN: u32 = 0x40000005;
const CPUID_HYPERV_MAX: u32 = 0x4000ffff;
const CPUID_HYPERV_ISOLATION: u32 = 1 << 22;
const CPUID_HYPERV_CPU_MANAGEMENT: u32 = 1 << 12;
const CPUID_HYPERV_ISOLATION_CONFIG: u32 = 0x4000000C;
const CPUID_HYPERV_ISOLATION_TYPE_MASK: u32 = 0xf;
const CPUID_HYPERV_ISOLATION_TYPE_SNP: u32 = 2;

pub fn present() -> bool {
    let mut cpuid = unsafe { __cpuid(CPUID_PROCESSOR_INFO_AND_FEATURE_BITS) };
    if (cpuid.ecx & CPUID_FEATURE_HYPERVISOR) == 0 {
        return false;
    }

    cpuid = unsafe { __cpuid(CPUID_GET_HIGHEST_FUNCTION) };
    if cpuid.eax < CPUID_HYPERV_VENDOR_AND_MAX_FUNCTIONS {
        return false;
    }

    cpuid = unsafe { __cpuid(CPUID_HYPERV_VENDOR_AND_MAX_FUNCTIONS) };
    if cpuid.eax < CPUID_HYPERV_MIN || cpuid.eax > CPUID_HYPERV_MAX {
        return false;
    }

    let mut sig: Vec<u8> = vec![];
    sig.append(&mut cpuid.ebx.to_le_bytes().to_vec());
    sig.append(&mut cpuid.ecx.to_le_bytes().to_vec());
    sig.append(&mut cpuid.edx.to_le_bytes().to_vec());

    if sig != CPUID_HYPERV_SIG.as_bytes() {
        return false;
    }

    cpuid = unsafe { __cpuid(CPUID_HYPERV_FEATURES) };

    let isolated: bool = (cpuid.ebx & CPUID_HYPERV_ISOLATION) != 0;
    let managed: bool = (cpuid.ebx & CPUID_HYPERV_CPU_MANAGEMENT) != 0;

    if !isolated || managed {
        return false;
    }

    cpuid = unsafe { __cpuid(CPUID_HYPERV_ISOLATION_CONFIG) };
    let mask = cpuid.ebx & CPUID_HYPERV_ISOLATION_TYPE_MASK;
    let snp = CPUID_HYPERV_ISOLATION_TYPE_SNP;

    if mask != snp {
        return false;
    }

    true
}

pub mod report {
    use super::*;

    use anyhow::{anyhow, Context};
    use serde::{Deserialize, Serialize};
    use sev::firmware::guest::AttestationReport;
    use tss_esapi::{
        abstraction::nv,
        handles::NvIndexTpmHandle,
        interface_types::{resource_handles::NvAuth, session_handles::AuthSession},
        tcti_ldr::{DeviceConfig, TctiNameConf},
    };

    const VTPM_HCL_REPORT_NV_INDEX: u32 = 0x01400001;

    #[repr(C)]
    #[derive(Deserialize, Serialize, Debug, Clone, Copy)]
    struct Hcl {
        rsv1: [u32; 8],
        report: AttestationReport,
        rsv2: [u32; 5],
    }

    pub fn get(vmpl: u32) -> Result<AttestationReport> {
        if vmpl > 0 {
            return Err(anyhow!("Azure vTPM attestation report requires VMPL 0"));
        }
        let bytes = tpm2_read().context("unable to read attestation report bytes from vTPM")?;

        hcl_report(&bytes)
    }

    fn tpm2_read() -> Result<Vec<u8>> {
        let handle = NvIndexTpmHandle::new(VTPM_HCL_REPORT_NV_INDEX)
            .context("unable to initialize TPM handle")?;
        let mut ctx = tss_esapi::Context::new(TctiNameConf::Device(DeviceConfig::default()))?;
        ctx.set_sessions((Some(AuthSession::Password), None, None));

        nv::read_full(&mut ctx, NvAuth::Owner, handle)
            .context("unable to read non-volatile vTPM data")
    }

    fn hcl_report(bytes: &[u8]) -> Result<AttestationReport> {
        let hcl: Hcl =
            bincode::deserialize(bytes).context("unable to deserialize bytes from vTPM")?;

        Ok(hcl.report)
    }
}
0707010000000F000081A4000000000000000000000001656E15F100000E06000000000000000000000000000000000000001A00000000snpguest-0.3.2/src/key.rs// SPDX-License-Identifier: Apache-2.0

use super::*;
use sev::firmware::guest::{DerivedKey, Firmware, GuestFieldSelect};
use std::io::Read;
use std::{fs, path::PathBuf};

#[derive(StructOpt)]
pub struct KeyArgs {
    #[structopt(help = "This is the path where the derived key will be saved")]
    pub key_path: PathBuf,

    #[structopt(
        help = "This is the root key from which to derive the key. Input either VCEK or VMRK."
    )]
    pub root_key_select: String,

    #[structopt(
        long = "vmpl",
        short,
        help = "Specify VMPL level the Guest is running on. Defaults to 1."
    )]
    pub vmpl: Option<u32>,

    #[structopt(
        long = "guest_field_select",
        short = "g",
        help = "Specify which Guest Field Select bits to enable. It is a 6 digit binary string. For each bit, 0 denotes off and 1 denotes on.
        The least significant (rightmost) bit is Guest Policy followed by Image ID, Family ID, Measurement, SVN, TCB Version which is the most significant (leftmost) bit. "
    )]
    pub gfs: Option<String>,

    #[structopt(
        long = "guest_svn",
        short = "s",
        help = "Specify the guest SVN to mix into the key. Must not exceed the guest SVN provided at launch in the ID block."
    )]
    pub gsvn: Option<u32>,

    #[structopt(
        long = "tcb_version",
        short,
        help = "Specify the TCB version to mix into the derived key. Must not exceed CommittedTcb"
    )]
    pub tcbv: Option<u64>,
}

pub fn get_derived_key(args: KeyArgs) -> Result<()> {
    let root_key_select = match args.root_key_select.as_str() {
        "vcek" => false,
        "vmrk" => true,
        _ => return Err(anyhow::anyhow!("Invalid input. Enter either vcek or vmrk")),
    };

    let vmpl = match args.vmpl {
        Some(level) => {
            if level <= 3 {
                level
            } else {
                return Err(anyhow::anyhow!("Invalid Virtual Machine Privilege Level."));
            }
        }
        None => 1,
    };

    let gfs = match args.gfs {
        Some(gfs) => {
            let value: u64 = u64::from_str_radix(gfs.as_str(), 2).unwrap();
            if value <= 63 {
                value
            } else {
                return Err(anyhow::anyhow!("Invalid Guest Field Select option."));
            }
        }
        None => 0,
    };

    let gsvn: u32 = args.gsvn.unwrap_or(0);

    let tcbv: u64 = args.tcbv.unwrap_or(0);

    let request = DerivedKey::new(root_key_select, GuestFieldSelect(gfs), vmpl, gsvn, tcbv);
    let mut sev_fw = Firmware::open().context("failed to open SEV firmware device.")?;
    let derived_key: [u8; 32] = sev_fw
        .get_derived_key(None, request)
        .context("Failed to request derived key")?;

    // Create derived key path
    let key_path: PathBuf = args.key_path;

    // Write derived key into desired file
    let mut key_file = if key_path.exists() {
        std::fs::OpenOptions::new()
            .write(true)
            .truncate(true)
            .open(key_path)
            .context("Unable to overwrite derived key file contents")?
    } else {
        fs::File::create(key_path).context("Unable to create derived key file contents")?
    };

    bincode::serialize_into(&mut key_file, &derived_key)
        .context("Could not serialize derived key into file.")?;

    Ok(())
}

pub fn read_key(key_path: PathBuf) -> Result<Vec<u8>, anyhow::Error> {
    let mut key_file = fs::File::open(key_path)?;
    let mut key = Vec::new();
    // read the whole file
    key_file.read_to_end(&mut key)?;
    Ok(key)
}
07070100000010000081A4000000000000000000000001656E15F10000094E000000000000000000000000000000000000001B00000000snpguest-0.3.2/src/main.rs// SPDX-License-Identifier: Apache-2.0

mod certs;
mod display;
mod fetch;
mod key;
mod report;
mod verify;

#[cfg(feature = "hyperv")]
mod hyperv;

use certs::CertificatesArgs;
use display::DisplayCmd;
use fetch::FetchCmd;
use key::KeyArgs;
use report::ReportArgs;
use verify::VerifyCmd;

use anyhow::{Context, Result};
use structopt::StructOpt;

const VERSION: &str = env!("CARGO_PKG_VERSION");
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");

#[derive(StructOpt)]
struct SnpGuest {
    #[structopt(subcommand)]
    pub cmd: SnpGuestCmd,

    #[structopt(short, long, help = "Don't print anything to the console")]
    pub quiet: bool,
}

#[allow(clippy::large_enum_variant)]
#[derive(StructOpt)]
#[structopt(author = AUTHORS, version = VERSION, about = "Utilities for managing the SNP Guest environment")]
enum SnpGuestCmd {
    #[structopt(about = "Report command to request an attestation report.")]
    Report(ReportArgs),

    #[structopt(about = "Certificates command to request cached certificates from the AMD PSP")]
    Certificates(CertificatesArgs),

    #[structopt(about = "Fetch command to request certificates.")]
    Fetch(FetchCmd),

    #[structopt(about = "Verify command to verify certificates and attestation report.")]
    Verify(VerifyCmd),

    #[structopt(about = "Display command to display files in human readable form.")]
    Display(DisplayCmd),

    #[structopt(about = "Key command to generate derived key.")]
    Key(KeyArgs),
}

fn main() -> Result<()> {
    env_logger::init();

    let snpguest = SnpGuest::from_args();

    #[cfg(feature = "hyperv")]
    let hv = hyperv::present;

    #[cfg(not(feature = "hyperv"))]
    let hv = false;

    let status = match snpguest.cmd {
        SnpGuestCmd::Report(args) => report::get_report(args, hv),
        SnpGuestCmd::Certificates(args) => certs::get_ext_certs(args),
        SnpGuestCmd::Fetch(subcmd) => fetch::cmd(subcmd),
        SnpGuestCmd::Verify(subcmd) => verify::cmd(subcmd, snpguest.quiet),
        SnpGuestCmd::Display(subcmd) => display::cmd(subcmd, snpguest.quiet),
        SnpGuestCmd::Key(args) => key::get_derived_key(args),
    };

    if let Err(ref e) = status {
        if !snpguest.quiet {
            eprintln!("ERROR: {}", e);
            e.chain()
                .skip(1)
                .for_each(|cause| eprintln!("because: {}", cause));
        }
    }

    status
}
07070100000011000081A4000000000000000000000001656E15F10000135F000000000000000000000000000000000000001D00000000snpguest-0.3.2/src/report.rs// SPDX-License-Identifier: Apache-2.0

use super::*;

use std::{
    fs::{self, File, OpenOptions},
    io::{Read, Write},
    path::PathBuf,
};

use anyhow::{anyhow, Result};
use rand::{thread_rng, RngCore};
use sev::firmware::guest::{AttestationReport, Firmware};

// Read a bin-formatted attestation report.
pub fn read_report(att_report_path: PathBuf) -> Result<AttestationReport, anyhow::Error> {
    let attestation_file = fs::File::open(att_report_path)?;

    let attestation_report = bincode::deserialize_from(attestation_file)
        .context("Could not parse attestation report.")?;

    Ok(attestation_report)
}

// Create 64 random bytes of data for attestation report request
pub fn create_random_request() -> [u8; 64] {
    let mut data = [0u8; 64];
    thread_rng().fill_bytes(&mut data);
    data
}

#[derive(StructOpt)]
pub struct ReportArgs {
    #[structopt(help = "File to write the attestation report to.")]
    pub att_report_path: PathBuf,

    #[structopt(
        long = "random",
        short,
        help = "Use random data for attestation report request. Writes data to ./random-request-file.txt by default, use --request to specify where to write data."
    )]
    pub random: bool,

    #[structopt(
        long = "vmpl",
        short,
        help = "Specify VMPL level the Guest is running on. Defaults to 1."
    )]
    pub vmpl: Option<u32>,

    #[structopt(
        help = "Provide file with data for attestation-report request. If provided with random flag, then the random data will be written in the provided path."
    )]
    pub request_file: PathBuf,

    #[structopt(
        long,
        short,
        help = "Expect that the 64-byte report data will already be provided by the platform provider."
    )]
    pub platform: bool,
}

impl ReportArgs {
    pub fn verify(&self, hyperv: bool) -> Result<()> {
        if self.random && self.platform {
            return Err(anyhow!(
                "--random and --platform both enabled (not allowed). Consult man page."
            ));
        }

        if self.random && hyperv {
            return Err(anyhow!(
                "--random enabled yet Hyper-V guest detected (not allowed). Consult man page."
            ));
        }

        if self.platform && !hyperv {
            return Err(anyhow!("--platform enabled yet Hyper-V guest not detected (not allowed). Consult man page."));
        }

        Ok(())
    }
}

#[cfg(feature = "hyperv")]
fn request_hardware_report(
    _data: Option<[u8; 64]>,
    vmpl: Option<u32>,
) -> Result<AttestationReport> {
    hyperv::report::get(vmpl.unwrap_or(0))
}

#[cfg(not(feature = "hyperv"))]
fn request_hardware_report(data: Option<[u8; 64]>, vmpl: Option<u32>) -> Result<AttestationReport> {
    let mut fw = Firmware::open().context("unable to open /dev/sev")?;
    fw.get_report(None, data, vmpl)
        .context("unable to fetch attestation report")
}

// Request attestation report and write it into a file
pub fn get_report(args: ReportArgs, hv: bool) -> Result<()> {
    args.verify(hv)?;

    let data: Option<[u8; 64]> = if args.random {
        Some(create_random_request())
    } else if args.platform {
        None
    } else {
        /*
         * Read from the request file.
         */
        let mut bytes = [0u8; 64];
        let mut file = File::open(&args.request_file)?;
        file.read_exact(&mut bytes)
            .context("unable to read 64 bytes from REQUEST_FILE")?;

        Some(bytes)
    };

    let report = request_hardware_report(data, args.vmpl)?;

    /*
     * Serialize and write attestation report.
     */
    let mut file = OpenOptions::new()
        .create(true)
        .truncate(true)
        .write(true)
        .open(&args.att_report_path)?;

    bincode::serialize_into(&mut file, &report)
        .context("Could not serialize attestation report into file.")?;

    /*
     * Write reports report data (only for --random or --platform).
     */
    if args.random {
        reqdata_write(args.request_file, &report).context("unable to write random request data")?;
    } else if args.platform {
        reqdata_write(args.request_file, &report)
            .context("unable to write platform request data")?;
    }

    Ok(())
}

fn reqdata_write(name: PathBuf, report: &AttestationReport) -> Result<()> {
    let mut file = OpenOptions::new()
        .create(true)
        .truncate(true)
        .write(true)
        .open(name)
        .context("unable to create or write to request data file")?;

    write_hex(&mut file, &report.report_data).context("unable to write report data to REQUEST_FILE")
}

pub fn write_hex(file: &mut File, data: &[u8]) -> Result<()> {
    let mut line_counter = 0;
    for val in data {
        // Make it blocks for easier read
        if line_counter.eq(&16) {
            writeln!(file)?;
            line_counter = 0;
        }

        write!(file, "{:02x}", val)?;
        line_counter += 1;
    }
    Ok(())
}
07070100000012000081A4000000000000000000000001656E15F100008B25000000000000000000000000000000000000001D00000000snpguest-0.3.2/src/verify.rs// SPDX-License-Identifier: Apache-2.0

use super::*;

use certs::{convert_path_to_cert, CertPaths};

use std::{io::ErrorKind, path::PathBuf};

use openssl::{ecdsa::EcdsaSig, sha::Sha384};
use sev::certs::snp::Chain;

#[derive(StructOpt)]
pub enum VerifyCmd {
    #[structopt(about = "Verify the certificate chain.")]
    Certs(certificate_chain::Args),

    #[structopt(about = "Verify the attestation report.")]
    Attestation(attestation::Args),
}

pub fn cmd(cmd: VerifyCmd, quiet: bool) -> Result<()> {
    match cmd {
        VerifyCmd::Certs(args) => certificate_chain::validate_cc(args, quiet),
        VerifyCmd::Attestation(args) => attestation::verify_attesation(args, quiet),
    }
}

// Find a certificate in specified directory according to its extension
pub fn find_cert_in_dir(dir: PathBuf, cert: &str) -> Result<PathBuf, anyhow::Error> {
    if dir.join(format!("{cert}.pem")).exists() {
        Ok(dir.join(format!("{cert}.pem")))
    } else if dir.join(format!("{cert}.der")).exists() {
        Ok(dir.join(format!("{cert}.der")))
    } else {
        return Err(anyhow::anyhow!("{cert} certificate not found in directory"));
    }
}

mod certificate_chain {
    use sev::certs::snp::Verifiable;

    use super::*;

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Path to directory containing certificate chain")]
        pub certs_dir: PathBuf,
    }

    // Function to validate certificate chain
    pub fn validate_cc(args: Args, quiet: bool) -> Result<()> {
        let ark_path = find_cert_in_dir(args.certs_dir.clone(), "ark")?;
        let ask_path = find_cert_in_dir(args.certs_dir.clone(), "ask")?;
        let vcek_path = find_cert_in_dir(args.certs_dir, "vcek")?;

        // Get a cert chain from directory
        let cert_chain: Chain = CertPaths {
            ark_path,
            ask_path,
            vcek_path,
        }
        .try_into()?;

        let ark = cert_chain.ca.ark;
        let ask = cert_chain.ca.ask;
        let vcek = cert_chain.vcek;

        // Verify each signature and print result in console
        match (&ark, &ark).verify() {
            Ok(()) => {
                if !quiet {
                    println!("The AMD ARK was self-signed!");
                }
            }
            Err(e) => match e.kind() {
                ErrorKind::Other => return Err(anyhow::anyhow!("The AMD ARK is not self-signed!")),
                _ => {
                    return Err(anyhow::anyhow!(
                        "Failed to verify the ARK cerfificate: {:?}",
                        e
                    ))
                }
            },
        }

        match (&ark, &ask).verify() {
            Ok(()) => {
                if !quiet {
                    println!("The AMD ASK was signed by the AMD ARK!");
                }
            }
            Err(e) => match e.kind() {
                ErrorKind::Other => {
                    return Err(anyhow::anyhow!("The AMD ASK ws not signed by the AMD ARK!"))
                }
                _ => return Err(anyhow::anyhow!("Failed to verify ASK certificate: {:?}", e)),
            },
        }

        match (&ask, &vcek).verify() {
            Ok(()) => {
                if !quiet {
                    println!("The VCEK was signed by the AMD ASK!");
                }
            }
            Err(e) => match e.kind() {
                ErrorKind::Other => {
                    return Err(anyhow::anyhow!("The VCEK was not signed by the AMD ASK!"))
                }
                _ => {
                    return Err(anyhow::anyhow!(
                        "Failed to verify VCEK certificate: {:?}",
                        e
                    ))
                }
            },
        }
        Ok(())
    }
}

mod attestation {
    use super::*;

    use asn1_rs::{oid, FromDer, Oid};

    use x509_parser::{self, certificate::X509Certificate, prelude::X509Extension};

    use sev::{certs::snp::Certificate, firmware::guest::AttestationReport};

    enum SnpOid {
        BootLoader,
        Tee,
        Snp,
        Ucode,
        HwId,
    }

    // OID extensions for the VCEK, will be used to verify attestation report
    impl SnpOid {
        fn oid(&self) -> Oid {
            match self {
                SnpOid::BootLoader => oid!(1.3.6 .1 .4 .1 .3704 .1 .3 .1),
                SnpOid::Tee => oid!(1.3.6 .1 .4 .1 .3704 .1 .3 .2),
                SnpOid::Snp => oid!(1.3.6 .1 .4 .1 .3704 .1 .3 .3),
                SnpOid::Ucode => oid!(1.3.6 .1 .4 .1 .3704 .1 .3 .8),
                SnpOid::HwId => oid!(1.3.6 .1 .4 .1 .3704 .1 .4),
            }
        }
    }

    #[derive(StructOpt)]
    pub struct Args {
        #[structopt(help = "Path to directory containing VCEK.")]
        pub certs_dir: PathBuf,

        #[structopt(help = "Path to attestation report to use for validation.")]
        pub att_report_path: PathBuf,

        #[structopt(long = "tcb", short, help = "Run the tcb verification only.")]
        pub tcb: bool,

        #[structopt(
            long = "signature",
            short,
            help = "Run the signature verification only."
        )]
        pub signature: bool,
    }

    fn verify_attestation_signature(
        vcek: Certificate,
        att_report: AttestationReport,
        quiet: bool,
    ) -> Result<()> {
        let vcek_pubkey = vcek
            .public_key()
            .context("Failed to get the public key from the VCEK.")?
            .ec_key()
            .context("Failed to convert VCEK public key into ECkey.")?;

        // Get the attestation report signature
        let ar_signature = EcdsaSig::try_from(&att_report.signature)
            .context("Failed to get ECDSA Signature from attestation report.")?;
        let signed_bytes = &bincode::serialize(&att_report)
            .context("Failed to get the signed bytes from the attestation report.")?[0x0..0x2A0];

        let mut hasher: Sha384 = Sha384::new();

        hasher.update(signed_bytes);

        let base_message_digest: [u8; 48] = hasher.finish();

        // Verify signature
        if ar_signature
            .verify(base_message_digest.as_ref(), vcek_pubkey.as_ref())
            .context("Failed to verify attestation report signature with VCEK public key.")?
        {
            if !quiet {
                println!("VCEK signed the Attestation Report!");
            }
        } else {
            return Err(anyhow::anyhow!("VCEK did NOT sign the Attestation Report!"));
        }

        Ok(())
    }

    // Check the cert extension byte to value
    fn check_cert_bytes(ext: &X509Extension, val: &[u8]) -> bool {
        match ext.value[0] {
            // Integer
            0x2 => {
                if ext.value[1] != 0x1 && ext.value[1] != 0x2 {
                    panic!("Invalid octet length encountered!");
                } else if let Some(byte_value) = ext.value.last() {
                    byte_value == &val[0]
                } else {
                    false
                }
            }
            // Octet String
            0x4 => {
                if ext.value[1] != 0x40 {
                    panic!("Invalid octet length encountered!");
                } else if ext.value[2..].len() != 0x40 {
                    panic!("Invalid size of bytes encountered!");
                } else if val.len() != 0x40 {
                    panic!("Invalid certificate harward id length encountered!")
                }

                &ext.value[2..] == val
            }
            // Legacy and others.
            _ => {
                // Keep around for a bit for old VCEK without x509 DER encoding.
                if ext.value.len() == 0x40 && val.len() == 0x40 {
                    ext.value == val
                } else {
                    panic!("Invalid type encountered!");
                }
            }
        }
    }

    fn verify_attestation_tcb(
        vcek: Certificate,
        att_report: AttestationReport,
        quiet: bool,
    ) -> Result<()> {
        let vcek_der = vcek.to_der().context("Could not convert VCEK to der.")?;
        let (_, vcek_x509) = X509Certificate::from_der(&vcek_der)
            .context("Could not create X509Certificate from der")?;

        // Collect extensions from VCEK
        let extensions: std::collections::HashMap<Oid, &X509Extension> = vcek_x509
            .extensions_map()
            .context("Failed getting VCEK oids.")?;

        // Compare bootloaders
        if let Some(cert_bl) = extensions.get(&SnpOid::BootLoader.oid()) {
            if !check_cert_bytes(cert_bl, &att_report.reported_tcb.bootloader.to_le_bytes()) {
                return Err(anyhow::anyhow!(
                    "Report TCB Boot Loader and Certificate Boot Loader mismatch encountered."
                ));
            }
            if !quiet {
                println!(
                    "Reported TCB Boot Loader from certificate matches the attestation report."
                );
            }
        }

        // Compare TEE information
        if let Some(cert_tee) = extensions.get(&SnpOid::Tee.oid()) {
            if !check_cert_bytes(cert_tee, &att_report.reported_tcb.tee.to_le_bytes()) {
                return Err(anyhow::anyhow!(
                    "Report TCB TEE and Certificate TEE mismatch encountered."
                ));
            }
            if !quiet {
                println!("Reported TCB TEE from certificate matches the attestation report.");
            }
        }

        // Compare SNP information
        if let Some(cert_snp) = extensions.get(&SnpOid::Snp.oid()) {
            if !check_cert_bytes(cert_snp, &att_report.reported_tcb.snp.to_le_bytes()) {
                return Err(anyhow::anyhow!(
                    "Report TCB SNP and Certificate SNP mismatch encountered."
                ));
            }
            if !quiet {
                println!("Reported TCB SNP from certificate matches the attestation report.");
            }
        }

        // Compare Microcode information
        if let Some(cert_ucode) = extensions.get(&SnpOid::Ucode.oid()) {
            if !check_cert_bytes(cert_ucode, &att_report.reported_tcb.microcode.to_le_bytes()) {
                return Err(anyhow::anyhow!(
                    "Report TCB Microcode and Certificate Microcode mismatch encountered."
                ));
            }
            if !quiet {
                println!("Reported TCB Microcode from certificate matches the attestation report.");
            }
        }

        // Compare HWID information
        if let Some(cert_hwid) = extensions.get(&SnpOid::HwId.oid()) {
            if !check_cert_bytes(cert_hwid, &att_report.chip_id) {
                return Err(anyhow::anyhow!(
                    "Report TCB ID and Certificate ID mismatch encountered."
                ));
            }
            if !quiet {
                println!("Chip ID from certificate matches the attestation report.");
            }
        }

        Ok(())
    }

    pub fn verify_attesation(args: Args, quiet: bool) -> Result<()> {
        // Get attestation report
        let att_report = if !args.att_report_path.exists() {
            return Err(anyhow::anyhow!("No attestation report was found. Provide an attestation report to request VCEK from the KDS."));
        } else {
            report::read_report(args.att_report_path)
                .context("Could not open attestation report")?
        };

        // Get VCEK and grab its public key
        let vcek_path = find_cert_in_dir(args.certs_dir, "vcek")?;
        let vcek = convert_path_to_cert(&vcek_path, "vcek")?;

        if args.tcb || args.signature {
            if args.tcb {
                verify_attestation_tcb(vcek.clone(), att_report, quiet)?;
            }
            if args.signature {
                verify_attestation_signature(vcek, att_report, quiet)?;
            }
        } else {
            verify_attestation_tcb(vcek.clone(), att_report, quiet)?;
            verify_attestation_signature(vcek, att_report, quiet)?;
        }

        Ok(())
    }

    #[cfg(test)]
    mod tests {
        use super::*;
        use x509_parser::{self, certificate::X509Certificate};

        /// Important note that this is NOT a valid certificate,
        /// and the signature will NOT match at all.
        fn cert_and_hw_id_legacy() -> ([u8; 1361], [u8; 64]) {
            (
                [
                    0x30, 0x82, 0x05, 0x4d, 0x30, 0x82, 0x02, 0xfc, 0xa0, 0x03, 0x02, 0x01, 0x02,
                    0x02, 0x01, 0x00, 0x30, 0x46, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
                    0x01, 0x01, 0x0a, 0x30, 0x39, 0xa0, 0x0f, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
                    0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0xa1, 0x1c, 0x30, 0x1a,
                    0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x08, 0x30, 0x0d,
                    0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00,
                    0xa2, 0x03, 0x02, 0x01, 0x30, 0xa3, 0x03, 0x02, 0x01, 0x01, 0x30, 0x7b, 0x31,
                    0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x45, 0x6e, 0x67,
                    0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x0b, 0x30, 0x09, 0x06,
                    0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x14, 0x30, 0x12, 0x06,
                    0x03, 0x55, 0x04, 0x07, 0x0c, 0x0b, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x20, 0x43,
                    0x6c, 0x61, 0x72, 0x61, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08,
                    0x0c, 0x02, 0x43, 0x41, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0a,
                    0x0c, 0x16, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x4d, 0x69,
                    0x63, 0x72, 0x6f, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x31, 0x12,
                    0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x53, 0x45, 0x56, 0x2d,
                    0x4d, 0x69, 0x6c, 0x61, 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x32,
                    0x30, 0x33, 0x32, 0x32, 0x34, 0x31, 0x35, 0x35, 0x5a, 0x17, 0x0d, 0x33, 0x30,
                    0x30, 0x32, 0x30, 0x33, 0x32, 0x32, 0x34, 0x31, 0x35, 0x35, 0x5a, 0x30, 0x7a,
                    0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x45, 0x6e,
                    0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x0b, 0x30, 0x09,
                    0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x14, 0x30, 0x12,
                    0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0b, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x20,
                    0x43, 0x6c, 0x61, 0x72, 0x61, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
                    0x08, 0x0c, 0x02, 0x43, 0x41, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04,
                    0x0a, 0x0c, 0x16, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x4d,
                    0x69, 0x63, 0x72, 0x6f, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x31,
                    0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x53, 0x45, 0x56,
                    0x2d, 0x56, 0x43, 0x45, 0x4b, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86,
                    0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0x03,
                    0x62, 0x00, 0x04, 0x70, 0x5b, 0xf7, 0x2b, 0xaa, 0xb4, 0x71, 0xed, 0xbe, 0x34,
                    0x4b, 0xbf, 0xaf, 0x15, 0xa3, 0xa2, 0x94, 0x1b, 0xc1, 0x54, 0x54, 0x1c, 0xec,
                    0x54, 0x25, 0xac, 0xa8, 0x27, 0xb2, 0x83, 0xd3, 0x9d, 0xdb, 0x68, 0xf9, 0xea,
                    0x6b, 0x37, 0x64, 0x6c, 0x5c, 0x92, 0x05, 0x7f, 0x5a, 0x9f, 0x10, 0xe9, 0x07,
                    0xfb, 0x33, 0x66, 0x51, 0xe0, 0x91, 0xc2, 0x9f, 0x4f, 0x48, 0xbd, 0x4d, 0x44,
                    0x14, 0xb4, 0x89, 0xdd, 0x5b, 0x8e, 0xb0, 0x69, 0x60, 0x75, 0x75, 0x84, 0x2e,
                    0x9d, 0x93, 0x1a, 0x7d, 0x95, 0xad, 0xd3, 0xb7, 0xa4, 0x8c, 0x78, 0xad, 0xf5,
                    0x5c, 0x9f, 0x56, 0x2e, 0x39, 0x83, 0xdc, 0xc9, 0xa3, 0x82, 0x01, 0x17, 0x30,
                    0x82, 0x01, 0x13, 0x30, 0x10, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c,
                    0x78, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x17, 0x06, 0x09, 0x2b,
                    0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x02, 0x04, 0x0a, 0x16, 0x08, 0x4d,
                    0x69, 0x6c, 0x61, 0x6e, 0x2d, 0x42, 0x30, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06,
                    0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x01, 0x04, 0x03, 0x02, 0x01, 0x03,
                    0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03,
                    0x02, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01,
                    0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x04, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30,
                    0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x05,
                    0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04,
                    0x01, 0x9c, 0x78, 0x01, 0x03, 0x06, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11,
                    0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x07, 0x04,
                    0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01,
                    0x9c, 0x78, 0x01, 0x03, 0x03, 0x04, 0x03, 0x02, 0x01, 0x0a, 0x30, 0x12, 0x06,
                    0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x08, 0x04, 0x04,
                    0x02, 0x02, 0x00, 0xa9, 0x30, 0x4d, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01,
                    0x9c, 0x78, 0x01, 0x04, 0x04, 0x40, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                    0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
                    0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
                    0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
                    0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,
                    0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x30, 0x46, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
                    0xf7, 0x0d, 0x01, 0x01, 0x0a, 0x30, 0x39, 0xa0, 0x0f, 0x30, 0x0d, 0x06, 0x09,
                    0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0xa1, 0x1c,
                    0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x08,
                    0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02,
                    0x05, 0x00, 0xa2, 0x03, 0x02, 0x01, 0x30, 0xa3, 0x03, 0x02, 0x01, 0x01, 0x03,
                    0x82, 0x02, 0x01, 0x00, 0x31, 0xf0, 0x71, 0xa1, 0xc2, 0x35, 0xee, 0x9f, 0xb5,
                    0x87, 0x0d, 0x2e, 0xe9, 0xa2, 0x28, 0x47, 0x1d, 0xb2, 0x5b, 0xfd, 0x74, 0x58,
                    0xa2, 0xc9, 0x85, 0xac, 0x4e, 0xad, 0x59, 0x9a, 0xba, 0x93, 0xfb, 0xc0, 0x12,
                    0xc3, 0x4b, 0xf5, 0x10, 0x5a, 0xd9, 0xbe, 0x75, 0x1f, 0xeb, 0x5f, 0xed, 0x86,
                    0x3f, 0xe7, 0xca, 0xb3, 0xd7, 0x98, 0xa8, 0x97, 0x6e, 0xc8, 0x9e, 0xbf, 0x8f,
                    0x2e, 0x0f, 0xab, 0xbd, 0xa6, 0xe6, 0xac, 0xe8, 0x42, 0x2d, 0xd3, 0x1c, 0x7f,
                    0x4e, 0xd1, 0x07, 0xd8, 0x9b, 0x3a, 0x9d, 0xdc, 0x59, 0xf5, 0x97, 0x59, 0x96,
                    0xbd, 0xc6, 0xc1, 0x70, 0x03, 0x4c, 0xc0, 0xce, 0x40, 0xd9, 0xec, 0x41, 0x27,
                    0xe5, 0xf2, 0xa5, 0xf5, 0x6f, 0x40, 0x8c, 0xf9, 0x31, 0x62, 0x0d, 0xc8, 0xd1,
                    0xf9, 0x5b, 0x2a, 0x8f, 0x20, 0xc5, 0x77, 0xd8, 0x47, 0x68, 0xc9, 0xaa, 0xc9,
                    0xd9, 0x3e, 0x43, 0x69, 0x69, 0xae, 0xce, 0xcc, 0x58, 0xc7, 0x3f, 0xdd, 0x2a,
                    0xa3, 0x2c, 0x89, 0x8f, 0x1f, 0x57, 0xe1, 0x0b, 0x50, 0x81, 0x0b, 0x61, 0xb2,
                    0x97, 0x4f, 0x33, 0xb1, 0xd9, 0x20, 0x21, 0x5f, 0x1f, 0xac, 0xa0, 0x11, 0xc6,
                    0xb5, 0xcd, 0xa7, 0x50, 0xe6, 0xe4, 0x83, 0x54, 0x16, 0xe9, 0x03, 0x92, 0x1f,
                    0x4e, 0xb1, 0x58, 0xe8, 0xe6, 0xb0, 0x66, 0xf0, 0x00, 0x9f, 0x42, 0x20, 0xb3,
                    0x0e, 0x8d, 0xd2, 0x0b, 0x3b, 0x65, 0xfc, 0x6b, 0x4c, 0x69, 0x63, 0x10, 0xa4,
                    0xb5, 0x92, 0xaa, 0x16, 0xfb, 0xf3, 0x6b, 0x4d, 0xf7, 0x7c, 0x69, 0x63, 0x51,
                    0x0e, 0x5c, 0x5b, 0x5f, 0x66, 0x56, 0x62, 0x8e, 0x56, 0x69, 0xc0, 0x97, 0xa4,
                    0x16, 0x68, 0xc0, 0xe6, 0xb1, 0xbe, 0x9f, 0x7b, 0x28, 0x0b, 0x94, 0x71, 0xc4,
                    0x70, 0x82, 0xbb, 0x0b, 0xd4, 0x8b, 0x1a, 0xd9, 0x11, 0x78, 0x2c, 0x0d, 0xe2,
                    0xaf, 0x92, 0xd5, 0x88, 0xbf, 0x10, 0xf1, 0x0b, 0x6c, 0x05, 0x16, 0x2f, 0xa0,
                    0xef, 0x24, 0xf2, 0xf6, 0x90, 0x0a, 0x88, 0xca, 0x76, 0xc2, 0xb0, 0xf0, 0xff,
                    0x52, 0x9a, 0x10, 0xc4, 0x4e, 0xed, 0xab, 0x24, 0x30, 0x87, 0x9f, 0xa4, 0x63,
                    0x21, 0x1a, 0xb4, 0xc2, 0xc6, 0x8d, 0x13, 0x02, 0xb1, 0xab, 0x5e, 0x2a, 0x45,
                    0xd1, 0x22, 0x6e, 0x7a, 0x93, 0xca, 0xf1, 0x87, 0x5d, 0x21, 0x0c, 0xef, 0x84,
                    0xac, 0x54, 0xfd, 0x01, 0xe6, 0x77, 0x0a, 0xf1, 0x33, 0x2d, 0xeb, 0x8a, 0x45,
                    0xb0, 0xdf, 0x80, 0x56, 0x2d, 0xaf, 0xee, 0x25, 0x29, 0x55, 0xe2, 0xc9, 0xfb,
                    0xce, 0x08, 0x4f, 0x39, 0x47, 0x3f, 0x02, 0x41, 0xab, 0x71, 0xac, 0xd2, 0xd1,
                    0xf1, 0xb6, 0x4d, 0xc6, 0xe4, 0x1f, 0xf9, 0x9f, 0x11, 0x56, 0x28, 0xe4, 0xef,
                    0x99, 0x70, 0x4c, 0x50, 0x07, 0xef, 0x0d, 0xb1, 0xea, 0xc1, 0xad, 0x3c, 0xb0,
                    0xcf, 0xe3, 0x2f, 0x41, 0xcf, 0x3b, 0x1b, 0x1a, 0xfb, 0x61, 0xca, 0x12, 0x42,
                    0xaf, 0x27, 0x73, 0x91, 0x37, 0x9e, 0xac, 0xd3, 0x0e, 0xe9, 0xb3, 0x18, 0xbd,
                    0xf8, 0xbc, 0x39, 0xf8, 0xcb, 0xbb, 0x6b, 0x56, 0x62, 0x1d, 0x22, 0x8c, 0x0a,
                    0x76, 0x44, 0xfb, 0x13, 0x71, 0xb9, 0xff, 0xf9, 0xc3, 0x42, 0x89, 0x89, 0x6e,
                    0x63, 0x21, 0x6f, 0x47, 0xdd, 0x56, 0x72, 0xd4, 0x59, 0x14, 0x70, 0x98, 0x88,
                    0xf7, 0x52, 0xcb, 0x9d, 0x9a, 0xc3, 0x1c, 0x3d, 0x9b, 0xda, 0xad, 0xec, 0xc4,
                    0x78, 0xa7, 0x74, 0xa0, 0x01, 0xab, 0x35, 0x46, 0xa0, 0xba, 0xb1, 0x77, 0xff,
                    0x88, 0x71, 0xdc, 0x0a, 0xc3, 0x70, 0x12, 0xb3, 0x18, 0x55, 0x01, 0x3d, 0x83,
                    0x28, 0xf8, 0xd7, 0x88, 0x43, 0xfa, 0xc7, 0xa2, 0x3f, 0xcd, 0x2b, 0xcb, 0xcf,
                    0x7f, 0x57, 0x6d, 0x3a, 0xc8, 0x14, 0x4e, 0x88, 0x8d,
                ],
                [
                    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
                    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
                    0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
                    0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
                    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                ],
            )
        }

        /// Important note that this is NOT a valid certificate,
        /// and the signature will NOT match at all.
        fn cert_and_hw_id() -> ([u8; 1362], [u8; 64]) {
            (
                [
                    0x30, 0x82, 0x05, 0x4e, 0x30, 0x82, 0x02, 0xfd, 0xa0, 0x03, 0x02, 0x01, 0x02,
                    0x02, 0x01, 0x00, 0x30, 0x46, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
                    0x01, 0x01, 0x0a, 0x30, 0x39, 0xa0, 0x0f, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
                    0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0xa1, 0x1c, 0x30, 0x1a,
                    0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x08, 0x30, 0x0d,
                    0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00,
                    0xa2, 0x03, 0x02, 0x01, 0x30, 0xa3, 0x03, 0x02, 0x01, 0x01, 0x30, 0x7b, 0x31,
                    0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x45, 0x6e, 0x67,
                    0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x0b, 0x30, 0x09, 0x06,
                    0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x14, 0x30, 0x12, 0x06,
                    0x03, 0x55, 0x04, 0x07, 0x0c, 0x0b, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x20, 0x43,
                    0x6c, 0x61, 0x72, 0x61, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08,
                    0x0c, 0x02, 0x43, 0x41, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0a,
                    0x0c, 0x16, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x4d, 0x69,
                    0x63, 0x72, 0x6f, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x31, 0x12,
                    0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x53, 0x45, 0x56, 0x2d,
                    0x4d, 0x69, 0x6c, 0x61, 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x38,
                    0x31, 0x37, 0x31, 0x34, 0x32, 0x37, 0x30, 0x39, 0x5a, 0x17, 0x0d, 0x33, 0x30,
                    0x30, 0x38, 0x31, 0x37, 0x31, 0x34, 0x32, 0x37, 0x30, 0x39, 0x5a, 0x30, 0x7a,
                    0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x45, 0x6e,
                    0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x0b, 0x30, 0x09,
                    0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x14, 0x30, 0x12,
                    0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0b, 0x53, 0x61, 0x6e, 0x74, 0x61, 0x20,
                    0x43, 0x6c, 0x61, 0x72, 0x61, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
                    0x08, 0x0c, 0x02, 0x43, 0x41, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04,
                    0x0a, 0x0c, 0x16, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x4d,
                    0x69, 0x63, 0x72, 0x6f, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x31,
                    0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x08, 0x53, 0x45, 0x56,
                    0x2d, 0x56, 0x43, 0x45, 0x4b, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86,
                    0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0x03,
                    0x62, 0x00, 0x04, 0x07, 0x79, 0x5c, 0xaa, 0x60, 0x2f, 0x16, 0x5e, 0x8d, 0x37,
                    0x46, 0x93, 0x87, 0xc5, 0x06, 0x4a, 0x52, 0x46, 0xc9, 0x72, 0x0b, 0xdb, 0x7a,
                    0xd2, 0x15, 0xb2, 0xc6, 0x61, 0x3c, 0x6f, 0x9b, 0x1e, 0xd4, 0x61, 0x48, 0xee,
                    0xbd, 0xdd, 0xef, 0x56, 0xc3, 0xb6, 0x40, 0xdf, 0xd0, 0x5e, 0xbb, 0x3c, 0x0c,
                    0x77, 0x2e, 0xea, 0x5a, 0xb0, 0xa9, 0x4b, 0x2e, 0x9a, 0x85, 0x92, 0x08, 0x55,
                    0x7c, 0x23, 0xc3, 0x2a, 0xe1, 0xac, 0xb0, 0x2f, 0x3d, 0x59, 0x15, 0xe9, 0xbd,
                    0x2e, 0x64, 0xb4, 0x37, 0x73, 0xb8, 0x04, 0xd5, 0xd5, 0x1b, 0x11, 0x5e, 0x60,
                    0x1a, 0xc1, 0xf3, 0x86, 0x9d, 0x3e, 0x32, 0xe2, 0xa3, 0x82, 0x01, 0x18, 0x30,
                    0x82, 0x01, 0x14, 0x30, 0x10, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c,
                    0x78, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x17, 0x06, 0x09, 0x2b,
                    0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x02, 0x04, 0x0a, 0x16, 0x08, 0x4d,
                    0x69, 0x6c, 0x61, 0x6e, 0x2d, 0x42, 0x30, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06,
                    0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00,
                    0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03,
                    0x02, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01,
                    0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x04, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30,
                    0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x05,
                    0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04,
                    0x01, 0x9c, 0x78, 0x01, 0x03, 0x06, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11,
                    0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x07, 0x04,
                    0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01,
                    0x9c, 0x78, 0x01, 0x03, 0x03, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x11, 0x06,
                    0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c, 0x78, 0x01, 0x03, 0x08, 0x04, 0x03,
                    0x02, 0x01, 0x1e, 0x30, 0x4f, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x9c,
                    0x78, 0x01, 0x04, 0x04, 0x42, 0x04, 0x40, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
                    0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
                    0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
                    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c,
                    0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
                    0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x30, 0x46, 0x06, 0x09, 0x2a, 0x86, 0x48,
                    0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0a, 0x30, 0x39, 0xa0, 0x0f, 0x30, 0x0d, 0x06,
                    0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0xa1,
                    0x1c, 0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
                    0x08, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02,
                    0x02, 0x05, 0x00, 0xa2, 0x03, 0x02, 0x01, 0x30, 0xa3, 0x03, 0x02, 0x01, 0x01,
                    0x03, 0x82, 0x02, 0x01, 0x00, 0x12, 0x41, 0x24, 0x4a, 0xf3, 0xf8, 0xfb, 0x0f,
                    0x70, 0x33, 0x9a, 0x0e, 0x36, 0x9e, 0xf5, 0x89, 0xad, 0x85, 0x6b, 0xed, 0xd1,
                    0x25, 0x2d, 0x23, 0x89, 0x16, 0x80, 0xcb, 0xee, 0xbd, 0x70, 0x97, 0x92, 0x24,
                    0x76, 0x0b, 0xf9, 0x15, 0x9e, 0x8e, 0x4c, 0xb4, 0x9d, 0x61, 0x9d, 0x3d, 0xfe,
                    0x3a, 0xf3, 0x36, 0xb4, 0xc8, 0xb7, 0x56, 0xad, 0x1a, 0x1f, 0x35, 0xf5, 0x36,
                    0xf9, 0xb5, 0xed, 0x8f, 0x95, 0x0d, 0x37, 0x0f, 0xa8, 0x89, 0xba, 0x1c, 0x96,
                    0x91, 0x97, 0x62, 0x4f, 0xc7, 0x93, 0x87, 0x6d, 0x23, 0xdc, 0xc0, 0xbb, 0xcd,
                    0x17, 0x38, 0xae, 0xbd, 0x0d, 0xc4, 0xcc, 0xa4, 0x3f, 0xc8, 0x7d, 0x0d, 0x0b,
                    0x5c, 0xf1, 0xba, 0x9b, 0x20, 0x29, 0x95, 0xb0, 0x96, 0x02, 0x4d, 0x9d, 0xcd,
                    0x82, 0x0a, 0x60, 0x92, 0x51, 0xa1, 0x3c, 0x69, 0xec, 0x27, 0x81, 0x8e, 0x28,
                    0xc7, 0x4e, 0x34, 0xbb, 0x9f, 0xb0, 0x49, 0xc7, 0x6e, 0xe6, 0xb7, 0x6b, 0x1f,
                    0x91, 0x20, 0x0a, 0x80, 0xd2, 0x9f, 0x67, 0x24, 0xe0, 0x75, 0x40, 0x9b, 0x4a,
                    0xdd, 0xeb, 0xab, 0x34, 0x5f, 0x59, 0x3d, 0x3b, 0x06, 0xf0, 0x4d, 0x7d, 0xf9,
                    0x26, 0xeb, 0x35, 0xcb, 0x08, 0x35, 0x7b, 0xbf, 0x02, 0x4e, 0xa5, 0x50, 0xf8,
                    0x91, 0xf3, 0x60, 0xed, 0x80, 0x0d, 0xe1, 0x7e, 0x2b, 0x86, 0x75, 0x3d, 0x0c,
                    0x83, 0xea, 0x64, 0x50, 0x6c, 0xbd, 0xe2, 0x17, 0x6e, 0x45, 0xaa, 0x10, 0xe8,
                    0x84, 0xcc, 0xa1, 0x06, 0xb6, 0x8b, 0xa5, 0x96, 0xb0, 0x83, 0xba, 0x61, 0xe6,
                    0xa4, 0x14, 0xd3, 0x26, 0xf3, 0x19, 0x31, 0xbe, 0x40, 0x2a, 0x18, 0x53, 0x58,
                    0x75, 0x1d, 0x46, 0xe2, 0xfe, 0x47, 0xa3, 0xa9, 0x39, 0x68, 0xee, 0x37, 0x8f,
                    0x57, 0xe6, 0x12, 0x92, 0x34, 0xa6, 0x0a, 0x51, 0xcb, 0x4c, 0xce, 0x54, 0xe2,
                    0xbe, 0x8b, 0x8c, 0x02, 0xe5, 0x3c, 0x3a, 0x7b, 0x7f, 0x7b, 0x3b, 0x80, 0x44,
                    0x98, 0x9c, 0x52, 0x1d, 0x29, 0x42, 0xce, 0x9f, 0x95, 0xc5, 0x79, 0xbe, 0xd8,
                    0x06, 0x71, 0xff, 0xa2, 0x0a, 0xe2, 0x21, 0xa9, 0x59, 0xda, 0xac, 0x05, 0xe8,
                    0x2e, 0xa5, 0x1f, 0x01, 0xaf, 0xae, 0xc6, 0x90, 0xbb, 0x5d, 0x7b, 0xa9, 0x84,
                    0xff, 0x1c, 0x11, 0x78, 0x07, 0x89, 0x0a, 0x09, 0x4f, 0xc8, 0x4c, 0xb1, 0x7e,
                    0x68, 0x12, 0xa6, 0x3d, 0xae, 0x6b, 0x69, 0x8d, 0xc9, 0x03, 0x5f, 0x4d, 0x45,
                    0x47, 0xde, 0xf0, 0xa5, 0x1a, 0x19, 0x97, 0x37, 0x0e, 0xe8, 0x8a, 0xd2, 0x30,
                    0x07, 0xbf, 0xb4, 0x09, 0x80, 0x93, 0xa4, 0x91, 0x28, 0x40, 0xe3, 0x2c, 0xf3,
                    0x46, 0xf0, 0x22, 0xb3, 0xb7, 0xc5, 0x92, 0x69, 0x7a, 0x4d, 0xdb, 0xf7, 0x67,
                    0x97, 0x6f, 0x83, 0xcf, 0x5d, 0x29, 0x8b, 0x55, 0x72, 0xd3, 0xa2, 0xcb, 0x65,
                    0x21, 0x76, 0x84, 0xed, 0x75, 0xd5, 0xf3, 0x74, 0xff, 0xc1, 0x1a, 0x8d, 0x65,
                    0xac, 0x4f, 0xb0, 0x8c, 0x87, 0xae, 0x6a, 0xf0, 0xf9, 0x56, 0x23, 0xfc, 0x29,
                    0x5a, 0x1c, 0xd4, 0x12, 0xf9, 0x79, 0x66, 0x97, 0xad, 0x95, 0xc1, 0xa9, 0x0e,
                    0xf3, 0x2b, 0x94, 0x17, 0xc3, 0xfd, 0x51, 0x1f, 0x94, 0x35, 0xad, 0xa7, 0xf9,
                    0x61, 0x57, 0xf3, 0x67, 0x53, 0x17, 0xc7, 0xee, 0x1f, 0x54, 0x11, 0x1a, 0xd4,
                    0xc9, 0x33, 0x4b, 0x3a, 0x71, 0x27, 0xd7, 0xbb, 0x9f, 0x96, 0xba, 0xfa, 0x8a,
                    0x9c, 0x1e, 0x80, 0x6e, 0xfa, 0xa5, 0xd6, 0xba, 0xd7, 0x92, 0x71, 0xe9, 0x4e,
                    0x82, 0xa9, 0x02, 0x2a, 0x3b, 0xb8, 0x4e, 0x01, 0x53, 0x34, 0xa6, 0x70, 0x61,
                    0x56, 0x95, 0x1b, 0x59, 0xfe, 0x46, 0x94, 0x84, 0x8c, 0xa2, 0x2a, 0x16, 0x0c,
                    0xc2, 0x59, 0x9e, 0xac, 0xca, 0xa9, 0x93, 0xe6, 0x84, 0xf4,
                ],
                [
                    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
                    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
                    0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
                    0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
                    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                ],
            )
        }

        #[test]
        fn test_check_cert_bytes_legacy() {
            let (legacy_cert_bytes, val) = cert_and_hw_id_legacy();

            let dummy_x509: X509Certificate =
                X509Certificate::from_der(&legacy_cert_bytes).unwrap().1;
            let extensions = dummy_x509.extensions_map().unwrap();

            let ext = extensions.get(&SnpOid::HwId.oid()).unwrap();

            assert!(check_cert_bytes(ext, &val));
        }

        #[test]
        fn test_check_cert_bytes() {
            let (cert_bytes, val) = cert_and_hw_id();

            let dummy_x509: X509Certificate = X509Certificate::from_der(&cert_bytes).unwrap().1;
            let extensions = dummy_x509.extensions_map().unwrap();

            let ext = extensions.get(&SnpOid::HwId.oid()).unwrap();

            assert!(check_cert_bytes(ext, val.as_slice()));
        }

        #[test]
        fn test_check_cert_bytes_integer() {
            let (cert_bytes, _) = cert_and_hw_id();
            let val = 0x1Eu8;
            let dummy_x509: X509Certificate = X509Certificate::from_der(&cert_bytes).unwrap().1;
            let extensions = dummy_x509.extensions_map().unwrap();
            let ext = extensions.get(&SnpOid::Ucode.oid()).unwrap();
            assert!(check_cert_bytes(ext, &val.to_ne_bytes()));
        }
    }
}
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!278 blocks
openSUSE Build Service is sponsored by