diff --git a/TestVectors/runtimes/python/poetry.lock b/TestVectors/runtimes/python/poetry.lock new file mode 100644 index 000000000..765b15188 --- /dev/null +++ b/TestVectors/runtimes/python/poetry.lock @@ -0,0 +1,462 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "aws-cryptographic-material-providers" +version = "1.8.0" +description = "AWS Cryptographic Material Providers Library for Python" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptography-internal-dynamodb = {path = "../../../ComAmazonawsDynamodb/runtimes/python"} +aws-cryptography-internal-kms = {path = "../../../ComAmazonawsKms/runtimes/python"} +aws-cryptography-internal-primitives = {path = "../../../AwsCryptographyPrimitives/runtimes/python"} +aws-cryptography-internal-standard-library = {path = "../../../StandardLibrary/runtimes/python"} + +[package.source] +type = "directory" +url = "../../../mpl/AwsCryptographicMaterialProviders/runtimes/python" + +[[package]] +name = "aws-cryptography-internal-dynamodb" +version = "1.8.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptography-internal-standard-library = {path = "../../../StandardLibrary/runtimes/python"} +boto3 = "^1.35.42" + +[package.source] +type = "directory" +url = "../../../mpl/ComAmazonawsDynamodb/runtimes/python" + +[[package]] +name = "aws-cryptography-internal-kms" +version = "1.8.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptography-internal-standard-library = {path = "../../../StandardLibrary/runtimes/python"} +boto3 = "^1.35.42" + +[package.source] +type = "directory" +url = "../../../mpl/ComAmazonawsKms/runtimes/python" + +[[package]] +name = "aws-cryptography-internal-mpl-testvectors" +version = "0.1.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptographic-material-providers = {path = "../../../AwsCryptographicMaterialProviders/runtimes/python"} + +[package.source] +type = "directory" +url = "../../../mpl/TestVectorsAwsCryptographicMaterialProviders/runtimes/python" + +[[package]] +name = "aws-cryptography-internal-primitives" +version = "1.8.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptography-internal-standard-library = {path = "../../../StandardLibrary/runtimes/python"} +cryptography = "^43.0.1" + +[package.source] +type = "directory" +url = "../../../mpl/AwsCryptographyPrimitives/runtimes/python" + +[[package]] +name = "aws-cryptography-internal-standard-library" +version = "1.8.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +DafnyRuntimePython = "4.8.1.post1" +pytz = "^2023.3.post1" + +[package.source] +type = "directory" +url = "../../../mpl/StandardLibrary/runtimes/python" + +[[package]] +name = "aws-encryption-sdk" +version = "0.1.0" +description = "" +optional = false +python-versions = "^3.11.0" +files = [] +develop = false + +[package.dependencies] +aws-cryptographic-material-providers = {path = "../../../mpl/AwsCryptographicMaterialProviders/runtimes/python"} + +[package.source] +type = "directory" +url = "../../../AwsEncryptionSDK/runtimes/python" + +[[package]] +name = "boto3" +version = "1.35.80" +description = "The AWS SDK for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "boto3-1.35.80-py3-none-any.whl", hash = "sha256:21a3b18c3a7fd20e463708fe3fa035983105dc7f3a1c274e1903e1583ab91159"}, + {file = "boto3-1.35.80.tar.gz", hash = "sha256:50dae461ab5fbedfb81b690895d48a918fed0d5fdff37be1c4232770c0dc9712"}, +] + +[package.dependencies] +botocore = ">=1.35.80,<1.36.0" +jmespath = ">=0.7.1,<2.0.0" +s3transfer = ">=0.10.0,<0.11.0" + +[package.extras] +crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] + +[[package]] +name = "botocore" +version = "1.35.80" +description = "Low-level, data-driven core of boto 3." +optional = false +python-versions = ">=3.8" +files = [ + {file = "botocore-1.35.80-py3-none-any.whl", hash = "sha256:36e589dccb62380abd628b08fecfa2f7c89b99f41ec9fc42c467c94008c0be4a"}, + {file = "botocore-1.35.80.tar.gz", hash = "sha256:b8dfceca58891cb2711bd6455ec4f7159051f3796e0f64adef9bb334f19d8a92"}, +] + +[package.dependencies] +jmespath = ">=0.7.1,<2.0.0" +python-dateutil = ">=2.1,<3.0.0" +urllib3 = {version = ">=1.25.4,<2.2.0 || >2.2.0,<3", markers = "python_version >= \"3.10\""} + +[package.extras] +crt = ["awscrt (==0.22.0)"] + +[[package]] +name = "cffi" +version = "1.17.1" +description = "Foreign Function Interface for Python calling C code." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cffi-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:df8b1c11f177bc2313ec4b2d46baec87a5f3e71fc8b45dab2ee7cae86d9aba14"}, + {file = "cffi-1.17.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f2cdc858323644ab277e9bb925ad72ae0e67f69e804f4898c070998d50b1a67"}, + {file = "cffi-1.17.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:edae79245293e15384b51f88b00613ba9f7198016a5948b5dddf4917d4d26382"}, + {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45398b671ac6d70e67da8e4224a065cec6a93541bb7aebe1b198a61b58c7b702"}, + {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ad9413ccdeda48c5afdae7e4fa2192157e991ff761e7ab8fdd8926f40b160cc3"}, + {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5da5719280082ac6bd9aa7becb3938dc9f9cbd57fac7d2871717b1feb0902ab6"}, + {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bb1a08b8008b281856e5971307cc386a8e9c5b625ac297e853d36da6efe9c17"}, + {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:045d61c734659cc045141be4bae381a41d89b741f795af1dd018bfb532fd0df8"}, + {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:6883e737d7d9e4899a8a695e00ec36bd4e5e4f18fabe0aca0efe0a4b44cdb13e"}, + {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6b8b4a92e1c65048ff98cfe1f735ef8f1ceb72e3d5f0c25fdb12087a23da22be"}, + {file = "cffi-1.17.1-cp310-cp310-win32.whl", hash = "sha256:c9c3d058ebabb74db66e431095118094d06abf53284d9c81f27300d0e0d8bc7c"}, + {file = "cffi-1.17.1-cp310-cp310-win_amd64.whl", hash = "sha256:0f048dcf80db46f0098ccac01132761580d28e28bc0f78ae0d58048063317e15"}, + {file = "cffi-1.17.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a45e3c6913c5b87b3ff120dcdc03f6131fa0065027d0ed7ee6190736a74cd401"}, + {file = "cffi-1.17.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:30c5e0cb5ae493c04c8b42916e52ca38079f1b235c2f8ae5f4527b963c401caf"}, + {file = "cffi-1.17.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f75c7ab1f9e4aca5414ed4d8e5c0e303a34f4421f8a0d47a4d019ceff0ab6af4"}, + {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ed2dd2972641495a3ec98445e09766f077aee98a1c896dcb4ad0d303628e41"}, + {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:46bf43160c1a35f7ec506d254e5c890f3c03648a4dbac12d624e4490a7046cd1"}, + {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a24ed04c8ffd54b0729c07cee15a81d964e6fee0e3d4d342a27b020d22959dc6"}, + {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:610faea79c43e44c71e1ec53a554553fa22321b65fae24889706c0a84d4ad86d"}, + {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a9b15d491f3ad5d692e11f6b71f7857e7835eb677955c00cc0aefcd0669adaf6"}, + {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:de2ea4b5833625383e464549fec1bc395c1bdeeb5f25c4a3a82b5a8c756ec22f"}, + {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b"}, + {file = "cffi-1.17.1-cp311-cp311-win32.whl", hash = "sha256:85a950a4ac9c359340d5963966e3e0a94a676bd6245a4b55bc43949eee26a655"}, + {file = "cffi-1.17.1-cp311-cp311-win_amd64.whl", hash = "sha256:caaf0640ef5f5517f49bc275eca1406b0ffa6aa184892812030f04c2abf589a0"}, + {file = "cffi-1.17.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:805b4371bf7197c329fcb3ead37e710d1bca9da5d583f5073b799d5c5bd1eee4"}, + {file = "cffi-1.17.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:733e99bc2df47476e3848417c5a4540522f234dfd4ef3ab7fafdf555b082ec0c"}, + {file = "cffi-1.17.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1257bdabf294dceb59f5e70c64a3e2f462c30c7ad68092d01bbbfb1c16b1ba36"}, + {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da95af8214998d77a98cc14e3a3bd00aa191526343078b530ceb0bd710fb48a5"}, + {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d63afe322132c194cf832bfec0dc69a99fb9bb6bbd550f161a49e9e855cc78ff"}, + {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f79fc4fc25f1c8698ff97788206bb3c2598949bfe0fef03d299eb1b5356ada99"}, + {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b62ce867176a75d03a665bad002af8e6d54644fad99a3c70905c543130e39d93"}, + {file = "cffi-1.17.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:386c8bf53c502fff58903061338ce4f4950cbdcb23e2902d86c0f722b786bbe3"}, + {file = "cffi-1.17.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4ceb10419a9adf4460ea14cfd6bc43d08701f0835e979bf821052f1805850fe8"}, + {file = "cffi-1.17.1-cp312-cp312-win32.whl", hash = "sha256:a08d7e755f8ed21095a310a693525137cfe756ce62d066e53f502a83dc550f65"}, + {file = "cffi-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:51392eae71afec0d0c8fb1a53b204dbb3bcabcb3c9b807eedf3e1e6ccf2de903"}, + {file = "cffi-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f3a2b4222ce6b60e2e8b337bb9596923045681d71e5a082783484d845390938e"}, + {file = "cffi-1.17.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2"}, + {file = "cffi-1.17.1-cp313-cp313-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d01b12eeeb4427d3110de311e1774046ad344f5b1a7403101878976ecd7a10f3"}, + {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:706510fe141c86a69c8ddc029c7910003a17353970cff3b904ff0686a5927683"}, + {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de55b766c7aa2e2a3092c51e0483d700341182f08e67c63630d5b6f200bb28e5"}, + {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c59d6e989d07460165cc5ad3c61f9fd8f1b4796eacbd81cee78957842b834af4"}, + {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd398dbc6773384a17fe0d3e7eeb8d1a21c2200473ee6806bb5e6a8e62bb73dd"}, + {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:3edc8d958eb099c634dace3c7e16560ae474aa3803a5df240542b305d14e14ed"}, + {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9"}, + {file = "cffi-1.17.1-cp313-cp313-win32.whl", hash = "sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d"}, + {file = "cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a"}, + {file = "cffi-1.17.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:636062ea65bd0195bc012fea9321aca499c0504409f413dc88af450b57ffd03b"}, + {file = "cffi-1.17.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7eac2ef9b63c79431bc4b25f1cd649d7f061a28808cbc6c47b534bd789ef964"}, + {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e221cf152cff04059d011ee126477f0d9588303eb57e88923578ace7baad17f9"}, + {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:31000ec67d4221a71bd3f67df918b1f88f676f1c3b535a7eb473255fdc0b83fc"}, + {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f17be4345073b0a7b8ea599688f692ac3ef23ce28e5df79c04de519dbc4912c"}, + {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2b1fac190ae3ebfe37b979cc1ce69c81f4e4fe5746bb401dca63a9062cdaf1"}, + {file = "cffi-1.17.1-cp38-cp38-win32.whl", hash = "sha256:7596d6620d3fa590f677e9ee430df2958d2d6d6de2feeae5b20e82c00b76fbf8"}, + {file = "cffi-1.17.1-cp38-cp38-win_amd64.whl", hash = "sha256:78122be759c3f8a014ce010908ae03364d00a1f81ab5c7f4a7a5120607ea56e1"}, + {file = "cffi-1.17.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b2ab587605f4ba0bf81dc0cb08a41bd1c0a5906bd59243d56bad7668a6fc6c16"}, + {file = "cffi-1.17.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28b16024becceed8c6dfbc75629e27788d8a3f9030691a1dbf9821a128b22c36"}, + {file = "cffi-1.17.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d599671f396c4723d016dbddb72fe8e0397082b0a77a4fab8028923bec050e8"}, + {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca74b8dbe6e8e8263c0ffd60277de77dcee6c837a3d0881d8c1ead7268c9e576"}, + {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87"}, + {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98e3969bcff97cae1b2def8ba499ea3d6f31ddfdb7635374834cf89a1a08ecf0"}, + {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdf5ce3acdfd1661132f2a9c19cac174758dc2352bfe37d98aa7512c6b7178b3"}, + {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9755e4345d1ec879e3849e62222a18c7174d65a6a92d5b346b1863912168b595"}, + {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:f1e22e8c4419538cb197e4dd60acc919d7696e5ef98ee4da4e01d3f8cfa4cc5a"}, + {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c03e868a0b3bc35839ba98e74211ed2b05d2119be4e8a0f224fba9384f1fe02e"}, + {file = "cffi-1.17.1-cp39-cp39-win32.whl", hash = "sha256:e31ae45bc2e29f6b2abd0de1cc3b9d5205aa847cafaecb8af1476a609a2f6eb7"}, + {file = "cffi-1.17.1-cp39-cp39-win_amd64.whl", hash = "sha256:d016c76bdd850f3c626af19b0542c9677ba156e4ee4fccfdd7848803533ef662"}, + {file = "cffi-1.17.1.tar.gz", hash = "sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824"}, +] + +[package.dependencies] +pycparser = "*" + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "cryptography" +version = "43.0.3" +description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." +optional = false +python-versions = ">=3.7" +files = [ + {file = "cryptography-43.0.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:bf7a1932ac4176486eab36a19ed4c0492da5d97123f1406cf15e41b05e787d2e"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63efa177ff54aec6e1c0aefaa1a241232dcd37413835a9b674b6e3f0ae2bfd3e"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e1ce50266f4f70bf41a2c6dc4358afadae90e2a1e5342d3c08883df1675374f"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:443c4a81bb10daed9a8f334365fe52542771f25aedaf889fd323a853ce7377d6"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:74f57f24754fe349223792466a709f8e0c093205ff0dca557af51072ff47ab18"}, + {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9762ea51a8fc2a88b70cf2995e5675b38d93bf36bd67d91721c309df184f49bd"}, + {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:81ef806b1fef6b06dcebad789f988d3b37ccaee225695cf3e07648eee0fc6b73"}, + {file = "cryptography-43.0.3-cp37-abi3-win32.whl", hash = "sha256:cbeb489927bd7af4aa98d4b261af9a5bc025bd87f0e3547e11584be9e9427be2"}, + {file = "cryptography-43.0.3-cp37-abi3-win_amd64.whl", hash = "sha256:f46304d6f0c6ab8e52770addfa2fc41e6629495548862279641972b6215451cd"}, + {file = "cryptography-43.0.3-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:8ac43ae87929a5982f5948ceda07001ee5e83227fd69cf55b109144938d96984"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:846da004a5804145a5f441b8530b4bf35afbf7da70f82409f151695b127213d5"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f996e7268af62598f2fc1204afa98a3b5712313a55c4c9d434aef49cadc91d4"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f7b178f11ed3664fd0e995a47ed2b5ff0a12d893e41dd0494f406d1cf555cab7"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:c2e6fc39c4ab499049df3bdf567f768a723a5e8464816e8f009f121a5a9f4405"}, + {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:e1be4655c7ef6e1bbe6b5d0403526601323420bcf414598955968c9ef3eb7d16"}, + {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:df6b6c6d742395dd77a23ea3728ab62f98379eff8fb61be2744d4679ab678f73"}, + {file = "cryptography-43.0.3-cp39-abi3-win32.whl", hash = "sha256:d56e96520b1020449bbace2b78b603442e7e378a9b3bd68de65c782db1507995"}, + {file = "cryptography-43.0.3-cp39-abi3-win_amd64.whl", hash = "sha256:0c580952eef9bf68c4747774cde7ec1d85a6e61de97281f2dba83c7d2c806362"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:d03b5621a135bffecad2c73e9f4deb1a0f977b9a8ffe6f8e002bf6c9d07b918c"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:a2a431ee15799d6db9fe80c82b055bae5a752bef645bba795e8e52687c69efe3"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:281c945d0e28c92ca5e5930664c1cefd85efe80e5c0d2bc58dd63383fda29f83"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:f18c716be16bc1fea8e95def49edf46b82fccaa88587a45f8dc0ff6ab5d8e0a7"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:4a02ded6cd4f0a5562a8887df8b3bd14e822a90f97ac5e544c162899bc467664"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:53a583b6637ab4c4e3591a15bc9db855b8d9dee9a669b550f311480acab6eb08"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:1ec0bcf7e17c0c5669d881b1cd38c4972fade441b27bda1051665faaa89bdcaa"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2ce6fae5bdad59577b44e4dfed356944fbf1d925269114c28be377692643b4ff"}, + {file = "cryptography-43.0.3.tar.gz", hash = "sha256:315b9001266a492a6ff443b61238f956b214dbec9910a081ba5b6646a055a805"}, +] + +[package.dependencies] +cffi = {version = ">=1.12", markers = "platform_python_implementation != \"PyPy\""} + +[package.extras] +docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=1.1.1)"] +docstest = ["pyenchant (>=1.6.11)", "readme-renderer", "sphinxcontrib-spelling (>=4.0.1)"] +nox = ["nox"] +pep8test = ["check-sdist", "click", "mypy", "ruff"] +sdist = ["build"] +ssh = ["bcrypt (>=3.1.5)"] +test = ["certifi", "cryptography-vectors (==43.0.3)", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"] +test-randomorder = ["pytest-randomly"] + +[[package]] +name = "dafnyruntimepython" +version = "4.8.1.post1" +description = "Dafny runtime for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "DafnyRuntimePython-4.8.1.post1-py3-none-any.whl", hash = "sha256:72e5d9e27413301b2ca5fb0be304bca96e63e6ea4e1dbcc5ee5b4bd68a5a415f"}, + {file = "dafnyruntimepython-4.8.1.post1.tar.gz", hash = "sha256:71a4983ae4a55272c7edfef012a5ff36e2db02441f3a3ac0c2bd02cf57324c4c"}, +] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "jmespath" +version = "1.0.1" +description = "JSON Matching Expressions" +optional = false +python-versions = ">=3.7" +files = [ + {file = "jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980"}, + {file = "jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"}, +] + +[[package]] +name = "packaging" +version = "24.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pycparser" +version = "2.22" +description = "C parser in Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc"}, + {file = "pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"}, +] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "pytz" +version = "2023.4" +description = "World timezone definitions, modern and historical" +optional = false +python-versions = "*" +files = [ + {file = "pytz-2023.4-py2.py3-none-any.whl", hash = "sha256:f90ef520d95e7c46951105338d918664ebfd6f1d995bd7d153127ce90efafa6a"}, + {file = "pytz-2023.4.tar.gz", hash = "sha256:31d4583c4ed539cd037956140d695e42c033a19e984bfce9964a3f7d59bc2b40"}, +] + +[[package]] +name = "s3transfer" +version = "0.10.4" +description = "An Amazon S3 Transfer Manager" +optional = false +python-versions = ">=3.8" +files = [ + {file = "s3transfer-0.10.4-py3-none-any.whl", hash = "sha256:244a76a24355363a68164241438de1b72f8781664920260c48465896b712a41e"}, + {file = "s3transfer-0.10.4.tar.gz", hash = "sha256:29edc09801743c21eb5ecbc617a152df41d3c287f67b615f73e5f750583666a7"}, +] + +[package.dependencies] +botocore = ">=1.33.2,<2.0a.0" + +[package.extras] +crt = ["botocore[crt] (>=1.33.2,<2.0a.0)"] + +[[package]] +name = "six" +version = "1.17.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, +] + +[[package]] +name = "urllib3" +version = "2.2.3" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.8" +files = [ + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +h2 = ["h2 (>=4,<5)"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11.0" +content-hash = "381f995f8cf538eccb77844811a375e3693c76060a7e7066767e7aaf835e3405" diff --git a/TestVectors/runtimes/python/pyproject.toml b/TestVectors/runtimes/python/pyproject.toml new file mode 100644 index 000000000..ff9a624d0 --- /dev/null +++ b/TestVectors/runtimes/python/pyproject.toml @@ -0,0 +1,24 @@ +[tool.poetry] +name = "aws-encryption-sdk-test-vectors" +version = "0.1.0" +description = "" +authors = ["AWS Crypto Tools "] +packages = [ + { include = "aws_encryption_sdk_test_vectors", from = "src" } +] +# Include generated internaldafny files in package distributions, +# even though they are not included in version control +include = ["**/internaldafny/generated/*.py"] + +[tool.poetry.dependencies] +python = "^3.11.0" +aws-cryptographic-material-providers = { path = "../../../mpl/AwsCryptographicMaterialProviders/runtimes/python", develop = false} +aws-cryptography-internal-mpl-testvectors = { path = "../../../mpl/TestVectorsAwsCryptographicMaterialProviders/runtimes/python", develop = false} +aws-encryption-sdk = { path = "../../../AwsEncryptionSDK/runtimes/python", develop = false} + +[tool.poetry.group.test.dependencies] +pytest = "^7.4.0" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__init__.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__init__.py new file mode 100644 index 000000000..b9427e19d --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__init__.py @@ -0,0 +1,8 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Initialize generated Dafny +from .internaldafny.generated import module_ + +# Initialize externs +from .internaldafny import extern diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..c3c02684f Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 000000000..1b73b3e23 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/__pycache__/__init__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__init__.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__init__.py new file mode 100644 index 000000000..df1c5e11e --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__init__.py @@ -0,0 +1,3 @@ +from . import ( + wrapped_esdk, +) \ No newline at end of file diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..39f1879c8 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 000000000..b0629a044 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/__init__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-311.pyc new file mode 100644 index 000000000..7d5ed83e1 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-312.pyc new file mode 100644 index 000000000..b5192d0ea Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/__pycache__/wrapped_esdk.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/wrapped_esdk.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/wrapped_esdk.py new file mode 100644 index 000000000..04d938847 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/extern/wrapped_esdk.py @@ -0,0 +1,18 @@ +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.client +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.config +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_encryption_sdk_test_vectors.smithygenerated.aws_cryptography_encryptionsdk.shim as shim + +class default__(WrappedESDK.default__): + + @staticmethod + def WrappedESDK(config): + smithy_client = aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.client.AwsEncryptionSdk( + dafny_client=EncryptionSdk.default__.ESDK(config).value + ) + wrapped_client = shim.ESDKShim(smithy_client) + return Wrappers.Result_Success(wrapped_client) + +WrappedESDK.default__ = default__ \ No newline at end of file diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4NoReqEc.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4NoReqEc.py new file mode 100644 index 000000000..2be6e72aa --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4NoReqEc.py @@ -0,0 +1,277 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors + +# Module: AllEsdkV4NoReqEc + +class default__: + def __init__(self): + pass + + @_dafny.classproperty + def AllPositiveKeyringTestsNoReqCmmNoKmsRsa(instance): + return ((((((((((_dafny.Set({})) | (AllDefaultCmm.default__.SuccessTestingRequiredEncryptionContextKeysReproducedEncryptionContext)) | (AllHierarchy.default__.Tests)) | (AllKms.default__.Tests)) | (AllKmsMrkAware.default__.Tests)) | (AllKmsMrkAwareDiscovery.default__.Tests)) | (AllRawAES.default__.Tests)) | (AllRawRSA.default__.Tests)) | (AllMulti.default__.Tests)) | (AllRawECDH.default__.Tests)) | (AllKmsEcdh.default__.Tests) + @_dafny.classproperty + def frameSize(instance): + return 512 + @_dafny.classproperty + def AllPostiveKeyringTestsNoDBESuiteNoReqEC(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AllPositiveKeyringTestsNoReqCmmNoKmsRsa).Elements: + d_0_keyringConfig_: TestVectors.EncryptTestVector = compr_0_ + if ((d_0_keyringConfig_) in (default__.AllPositiveKeyringTestsNoReqCmmNoKmsRsa)) and (not((d_0_keyringConfig_).is_NegativeEncryptKeyringVector)): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_keyringConfig_).encryptDescription, (d_0_keyringConfig_).decryptDescription, Wrappers.Option_None(), Wrappers.Option_None(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_keyringConfig_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def AwsKmsRsaTests(instance): + return AllKmsRsa.default__.Tests + @_dafny.classproperty + def esdkAlgorithmSuitesKmsRsa(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_0_ in (AllAlgorithmSuites.default__.AllAlgorithmSuites).Elements: + d_0_suite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_0_ + if AlgorithmSuites.AlgorithmSuite._Is(d_0_suite_): + if (((d_0_suite_) in (AllAlgorithmSuites.default__.AllAlgorithmSuites)) and (not(((d_0_suite_).signature).is_ECDSA))) and (((d_0_suite_).id).is_ESDK): + coll0_ = coll0_.union(_dafny.Set([d_0_suite_])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def AllPositiveKeyringTestsNoDBEKmsRsa(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AwsKmsRsaTests).Elements: + d_0_keyringConfig_: TestVectors.EncryptTestVector = compr_0_ + if ((d_0_keyringConfig_) in (default__.AwsKmsRsaTests)) and (not((d_0_keyringConfig_).is_NegativeEncryptKeyringVector)): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (default__.esdkAlgorithmSuitesKmsRsa).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (default__.esdkAlgorithmSuitesKmsRsa): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_keyringConfig_).encryptDescription, (d_0_keyringConfig_).decryptDescription, Wrappers.Option_None(), Wrappers.Option_None(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_keyringConfig_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def Tests(instance): + return (default__.AllPostiveKeyringTestsNoDBESuiteNoReqEC) | (default__.AllPositiveKeyringTestsNoDBEKmsRsa) diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4WithReqEc.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4WithReqEc.py new file mode 100644 index 000000000..a92d1789a --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/AllEsdkV4WithReqEc.py @@ -0,0 +1,246 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc + +# Module: AllEsdkV4WithReqEc + +class default__: + def __init__(self): + pass + + @_dafny.classproperty + def AllPositiveReqEcTests(instance): + return AllRequiredEncryptionContextCmm.default__.SuccessTestingRequiredEncryptionContextKeysReproducedEncryptionContext + @_dafny.classproperty + def frameSize(instance): + return 512 + @_dafny.classproperty + def AllPositiveReqEcEsdkTests(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AllPositiveReqEcTests).Elements: + d_0_config_: TestVectors.EncryptTestVector = compr_0_ + if (d_0_config_) in (default__.AllPositiveReqEcTests): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_config_).encryptDescription, (d_0_config_).decryptDescription, Wrappers.Option_Some((d_0_config_).encryptionContext), (d_0_config_).reproducedEncryptionContext, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_config_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def Tests(instance): + return default__.AllPositiveReqEcEsdkTests diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkManifestOptions.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkManifestOptions.py new file mode 100644 index 000000000..93dcdb192 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkManifestOptions.py @@ -0,0 +1,266 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK + +# Module: EsdkManifestOptions + + +class ManifestOptions: + @classmethod + def default(cls, ): + return lambda: ManifestOptions_Decrypt(_dafny.Seq(""), _dafny.Seq(""), Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_Decrypt(self) -> bool: + return isinstance(self, ManifestOptions_Decrypt) + @property + def is_Encrypt(self) -> bool: + return isinstance(self, ManifestOptions_Encrypt) + @property + def is_DecryptSingle(self) -> bool: + return isinstance(self, ManifestOptions_DecryptSingle) + @property + def is_EncryptManifest(self) -> bool: + return isinstance(self, ManifestOptions_EncryptManifest) + +class ManifestOptions_Decrypt(ManifestOptions, NamedTuple('Decrypt', [('manifestPath', Any), ('manifestFileName', Any), ('testName', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.Decrypt({_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.manifestFileName)}, {_dafny.string_of(self.testName)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_Decrypt) and self.manifestPath == __o.manifestPath and self.manifestFileName == __o.manifestFileName and self.testName == __o.testName + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_Encrypt(ManifestOptions, NamedTuple('Encrypt', [('manifestPath', Any), ('manifest', Any), ('decryptManifestOutput', Any), ('testName', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.Encrypt({_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.manifest)}, {_dafny.string_of(self.decryptManifestOutput)}, {_dafny.string_of(self.testName)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_Encrypt) and self.manifestPath == __o.manifestPath and self.manifest == __o.manifest and self.decryptManifestOutput == __o.decryptManifestOutput and self.testName == __o.testName + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_DecryptSingle(ManifestOptions, NamedTuple('DecryptSingle', [('keysPath', Any), ('keyDescription', Any), ('base64Bytes', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.DecryptSingle({_dafny.string_of(self.keysPath)}, {_dafny.string_of(self.keyDescription)}, {_dafny.string_of(self.base64Bytes)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_DecryptSingle) and self.keysPath == __o.keysPath and self.keyDescription == __o.keyDescription and self.base64Bytes == __o.base64Bytes + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_EncryptManifest(ManifestOptions, NamedTuple('EncryptManifest', [('encryptManifestOutput', Any), ('version', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.EncryptManifest({_dafny.string_of(self.encryptManifestOutput)}, {_dafny.string_of(self.version)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_EncryptManifest) and self.encryptManifestOutput == __o.encryptManifestOutput and self.version == __o.version + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestManifests.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestManifests.py new file mode 100644 index 000000000..dcc58de4a --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestManifests.py @@ -0,0 +1,633 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest + +# Module: EsdkTestManifests + +class default__: + def __init__(self): + pass + + @staticmethod + def StartDecryptVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = default__.GetManifest((op).manifestPath, (op).manifestFileName) + d_0_valueOrError0_ = out0_ + if not(not((d_0_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(40,27): " + _dafny.string_of(d_0_valueOrError0_)) + d_1_decryptManifest_: ManifestData + d_1_decryptManifest_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need((d_1_decryptManifest_).is_DecryptManifest, _dafny.Seq("Not a decrypt manifest")) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_3_valueOrError2_ = ParseEsdkJsonManifest.default__.BuildDecryptTestVector(op, (d_1_decryptManifest_).version, (d_1_decryptManifest_).keys, (d_1_decryptManifest_).jsonTests) + if (d_3_valueOrError2_).IsFailure(): + output = (d_3_valueOrError2_).PropagateFailure() + return output + d_4_decryptVectors_: _dafny.Seq + d_4_decryptVectors_ = (d_3_valueOrError2_).Extract() + out1_: Wrappers.Result + out1_ = default__.TestDecrypts((d_1_decryptManifest_).keys, d_4_decryptVectors_) + output = out1_ + return output + + @staticmethod + def TestDecryptVector_q(v): + return (True) and (((v).decryptionMethod).is_OneShot) + + @staticmethod + def TestDecrypts(keys, vectors): + manifest: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Starting "))) + _dafny.print(_dafny.string_of(len(vectors))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Decrypt Tests =================== \n\n"))) + d_0_hasFailure_: bool + d_0_hasFailure_ = False + d_1_skipped_: int + d_1_skipped_ = 0 + hi0_ = len(vectors) + for d_2_i_ in range(0, hi0_): + d_3_vector_: EsdkTestVectors.EsdkDecryptTestVector + d_3_vector_ = (vectors)[d_2_i_] + if default__.TestDecryptVector_q(d_3_vector_): + d_4_pass_: bool + out0_: bool + out0_ = EsdkTestVectors.default__.TestDecrypt(keys, d_3_vector_) + d_4_pass_ = out0_ + if not(d_4_pass_): + d_0_hasFailure_ = True + elif True: + d_1_skipped_ = (d_1_skipped_) + (1) + _dafny.print(_dafny.string_of(_dafny.Seq("\nSKIP===> "))) + _dafny.print(_dafny.string_of((d_3_vector_).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Completed "))) + _dafny.print(_dafny.string_of(len(vectors))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Decrypt Tests =================== \n\n"))) + if (0) < (d_1_skipped_): + _dafny.print(_dafny.string_of(_dafny.Seq("Skipped: "))) + _dafny.print(_dafny.string_of(d_1_skipped_)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + if not(not(d_0_hasFailure_)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(92,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + manifest = Wrappers.Result_Success(_dafny.Seq([])) + return manifest + + @staticmethod + def StartEncryptVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = default__.GetManifest((op).manifestPath, (op).manifest) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_encryptManifest_: ManifestData + d_1_encryptManifest_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need((d_1_encryptManifest_).is_EncryptManifest, _dafny.Seq("Not a encrypt manifest")) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_3_valueOrError2_ = ParseEsdkJsonManifest.default__.BuildEncryptTestVector(op, (d_1_encryptManifest_).version, (d_1_encryptManifest_).keys, (d_1_encryptManifest_).jsonTests) + if (d_3_valueOrError2_).IsFailure(): + output = (d_3_valueOrError2_).PropagateFailure() + return output + d_4_encryptVectors_: _dafny.Seq + d_4_encryptVectors_ = (d_3_valueOrError2_).Extract() + d_5_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = AtomicPrimitives.default__.AtomicPrimitives(AtomicPrimitives.default__.DefaultCryptoConfig()) + d_5_valueOrError3_ = out1_ + if not(not((d_5_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(114,13): " + _dafny.string_of(d_5_valueOrError3_)) + d_6_p_: AtomicPrimitives.AtomicPrimitivesClient + d_6_p_ = (d_5_valueOrError3_).Extract() + d_7_plaintext_: _dafny.Map + d_7_plaintext_ = _dafny.Map({}) + hi0_ = len((d_1_encryptManifest_).plaintext) + for d_8_i_ in range(0, hi0_): + let_tmp_rhs0_ = ((d_1_encryptManifest_).plaintext)[d_8_i_] + d_9_name_ = let_tmp_rhs0_[0] + d_10_length_ = let_tmp_rhs0_[1] + d_11_valueOrError4_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out2_: Wrappers.Result + out2_ = (d_6_p_).GenerateRandomBytes(AwsCryptographyPrimitivesTypes.GenerateRandomBytesInput_GenerateRandomBytesInput(d_10_length_)) + d_11_valueOrError4_ = out2_ + if not(not((d_11_valueOrError4_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(119,18): " + _dafny.string_of(d_11_valueOrError4_)) + d_12_data_: _dafny.Seq + d_12_data_ = (d_11_valueOrError4_).Extract() + _dafny.print(_dafny.string_of((((op).decryptManifestOutput) + (EsdkTestVectors.default__.plaintextPathRoot)) + (d_9_name_))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n\n"))) + d_13_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out3_: Wrappers.Result + out3_ = EsdkTestVectors.default__.WriteVectorsFile((((op).decryptManifestOutput) + (EsdkTestVectors.default__.plaintextPathRoot)) + (d_9_name_), d_12_data_) + d_13_valueOrError5_ = out3_ + if (d_13_valueOrError5_).IsFailure(): + output = (d_13_valueOrError5_).PropagateFailure() + return output + d_14___v0_: tuple + d_14___v0_ = (d_13_valueOrError5_).Extract() + d_7_plaintext_ = (d_7_plaintext_) | (_dafny.Map({d_9_name_: d_12_data_})) + d_15_encryptTests_q_: Wrappers.Result + out4_: Wrappers.Result + out4_ = default__.ToEncryptTests((d_1_encryptManifest_).keys, d_4_encryptVectors_) + d_15_encryptTests_q_ = out4_ + d_16_valueOrError6_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + def lambda0_(d_17_e_): + def iife0_(_pat_let6_0): + def iife1_(d_18___v1_): + return _dafny.Seq("Cmm failure") + return iife1_(_pat_let6_0) + return iife0_(EsdkTestVectors.default__.MplVectorPrintErr(d_17_e_)) + + d_16_valueOrError6_ = (d_15_encryptTests_q_).MapFailure(lambda0_) + if (d_16_valueOrError6_).IsFailure(): + output = (d_16_valueOrError6_).PropagateFailure() + return output + d_19_encryptTests_: _dafny.Seq + d_19_encryptTests_ = (d_16_valueOrError6_).Extract() + d_20_valueOrError7_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out5_: Wrappers.Result + out5_ = default__.TestEncrypts(d_7_plaintext_, (d_1_encryptManifest_).keys, d_19_encryptTests_) + d_20_valueOrError7_ = out5_ + if (d_20_valueOrError7_).IsFailure(): + output = (d_20_valueOrError7_).PropagateFailure() + return output + d_21_decryptVectors_: _dafny.Seq + d_21_decryptVectors_ = (d_20_valueOrError7_).Extract() + d_22_valueOrError8_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out6_: Wrappers.Result + out6_ = WriteVectors.default__.WriteDecryptManifest(op, (d_1_encryptManifest_).keys, d_21_decryptVectors_) + d_22_valueOrError8_ = out6_ + if (d_22_valueOrError8_).IsFailure(): + output = (d_22_valueOrError8_).PropagateFailure() + return output + d_23___v2_: tuple + d_23___v2_ = (d_22_valueOrError8_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def TestEncryptVector_q(vector): + return (True) and (not (((vector).frameLength).is_Some) or (AwsCryptographyEncryptionSdkTypes.default__.IsValid__FrameLength(((vector).frameLength).value))) + + @staticmethod + def ToEncryptTests(keys, vectors): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_encryptTests_: _dafny.Seq + d_0_encryptTests_ = _dafny.Seq([]) + hi0_ = len(vectors) + for d_1_i_ in range(0, hi0_): + d_2_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = EsdkTestVectors.default__.EncryptVectorToEncryptTest(keys, (vectors)[d_1_i_]) + d_2_valueOrError0_ = out0_ + if (d_2_valueOrError0_).IsFailure(): + output = (d_2_valueOrError0_).PropagateFailure() + return output + d_3_test_: EsdkTestVectors.EncryptTest + d_3_test_ = (d_2_valueOrError0_).Extract() + d_0_encryptTests_ = (d_0_encryptTests_) + (_dafny.Seq([d_3_test_])) + output = Wrappers.Result_Success(d_0_encryptTests_) + return output + return output + + @staticmethod + def TestEncrypts(plaintexts, keys, tests): + manifest: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Starting "))) + _dafny.print(_dafny.string_of(len(tests))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Encrypt Tests =================== \n\n"))) + d_0_hasFailure_: bool + d_0_hasFailure_ = False + d_1_decryptVectors_: _dafny.Seq + d_1_decryptVectors_ = _dafny.Seq([]) + d_2_skipped_: _dafny.Seq + d_2_skipped_ = _dafny.Seq([]) + hi0_ = len(tests) + for d_3_i_ in range(0, hi0_): + d_4_test_: EsdkTestVectors.EncryptTest + d_4_test_ = (tests)[d_3_i_] + d_5_valueOrError0_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_5_valueOrError0_ = Wrappers.default__.Need((((d_4_test_).vector).id).is_Some, _dafny.Seq("Vector is missing uuid")) + if (d_5_valueOrError0_).IsFailure(): + manifest = (d_5_valueOrError0_).PropagateFailure() + return manifest + if default__.TestEncryptVector_q((d_4_test_).vector): + d_6_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_6_valueOrError1_ = Wrappers.default__.Need(((((d_4_test_).vector).algorithmSuiteId).is_Some) and ((((((d_4_test_).vector).algorithmSuiteId).value).id).is_ESDK), _dafny.Seq("Vector is using an algorithm suite other than ESDK")) + if (d_6_valueOrError1_).IsFailure(): + manifest = (d_6_valueOrError1_).PropagateFailure() + return manifest + d_7_valueOrError2_: Wrappers.Result = Wrappers.Result.default(EsdkTestVectors.EncryptTestOutput.default())() + out0_: Wrappers.Result + out0_ = EsdkTestVectors.default__.TestEncrypt(plaintexts, keys, d_4_test_) + d_7_valueOrError2_ = out0_ + if (d_7_valueOrError2_).IsFailure(): + manifest = (d_7_valueOrError2_).PropagateFailure() + return manifest + d_8_pass_: EsdkTestVectors.EncryptTestOutput + d_8_pass_ = (d_7_valueOrError2_).Extract() + if not((d_8_pass_).output): + d_0_hasFailure_ = True + elif ((d_8_pass_).vector).is_Some: + d_1_decryptVectors_ = (d_1_decryptVectors_) + (_dafny.Seq([((d_8_pass_).vector).value])) + elif True: + d_2_skipped_ = (d_2_skipped_) + (_dafny.Seq([((((d_4_test_).vector).id).value) + (_dafny.Seq("\n"))])) + _dafny.print(_dafny.string_of(_dafny.Seq("\nSKIP===> "))) + _dafny.print(_dafny.string_of((((d_4_test_).vector).id).value)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Completed "))) + _dafny.print(_dafny.string_of(len(tests))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Encrypt Tests =================== \n\n"))) + if not(not(d_0_hasFailure_)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(215,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + manifest = Wrappers.Result_Success(d_1_decryptVectors_) + return manifest + + @staticmethod + def GetManifest(manifestPath, manifestFileName): + manifestData: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out0_: Wrappers.Result + out0_ = FileIO.default__.ReadBytesFromFile((manifestPath) + (manifestFileName)) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + manifestData = (d_0_valueOrError0_).PropagateFailure() + return manifestData + d_1_decryptManifestBv_: _dafny.Seq + d_1_decryptManifestBv_ = (d_0_valueOrError0_).Extract() + d_2_decryptManifestBytes_: _dafny.Seq + d_2_decryptManifestBytes_ = JSONHelpers.default__.BvToBytes(d_1_decryptManifestBv_) + d_3_valueOrError1_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + def lambda0_(d_4_e_): + return (d_4_e_).ToString() + + d_3_valueOrError1_ = (JSON_API.default__.Deserialize(d_2_decryptManifestBytes_)).MapFailure(lambda0_) + if (d_3_valueOrError1_).IsFailure(): + manifestData = (d_3_valueOrError1_).PropagateFailure() + return manifestData + d_5_manifestJson_: JSON_Values.JSON + d_5_manifestJson_ = (d_3_valueOrError1_).Extract() + d_6_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_6_valueOrError2_ = Wrappers.default__.Need((d_5_manifestJson_).is_Object, _dafny.Seq("Not a JSON object")) + if (d_6_valueOrError2_).IsFailure(): + manifestData = (d_6_valueOrError2_).PropagateFailure() + return manifestData + d_7_valueOrError3_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_7_valueOrError3_ = JSONHelpers.default__.GetObject(_dafny.Seq("manifest"), (d_5_manifestJson_).obj) + if (d_7_valueOrError3_).IsFailure(): + manifestData = (d_7_valueOrError3_).PropagateFailure() + return manifestData + d_8_manifest_: _dafny.Seq + d_8_manifest_ = (d_7_valueOrError3_).Extract() + d_9_valueOrError4_: Wrappers.Result = Wrappers.Result.default(System_.nat.default)() + d_9_valueOrError4_ = JSONHelpers.default__.GetNat(_dafny.Seq("version"), d_8_manifest_) + if (d_9_valueOrError4_).IsFailure(): + manifestData = (d_9_valueOrError4_).PropagateFailure() + return manifestData + d_10_version_: int + d_10_version_ = (d_9_valueOrError4_).Extract() + d_11_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_11_valueOrError5_ = JSONHelpers.default__.GetString(_dafny.Seq("type"), d_8_manifest_) + if (d_11_valueOrError5_).IsFailure(): + manifestData = (d_11_valueOrError5_).PropagateFailure() + return manifestData + d_12_typ_: _dafny.Seq + d_12_typ_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_13_valueOrError6_ = JSONHelpers.default__.GetString(_dafny.Seq("keys"), (d_5_manifestJson_).obj) + if (d_13_valueOrError6_).IsFailure(): + manifestData = (d_13_valueOrError6_).PropagateFailure() + return manifestData + d_14_keyManifestUri_: _dafny.Seq + d_14_keyManifestUri_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_15_valueOrError7_ = Wrappers.default__.Need((_dafny.Seq("file://")) < (d_14_keyManifestUri_), _dafny.Seq("Unexpected URI prefix")) + if (d_15_valueOrError7_).IsFailure(): + manifestData = (d_15_valueOrError7_).PropagateFailure() + return manifestData + d_16_keyManifestPath_: _dafny.Seq + d_16_keyManifestPath_ = (manifestPath) + (_dafny.Seq((d_14_keyManifestUri_)[7::])) + d_17_valueOrError8_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = KeyVectors.default__.KeyVectors(AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyVectorsConfig_KeyVectorsConfig(d_16_keyManifestPath_)) + d_17_valueOrError8_ = out1_ + if not(not((d_17_valueOrError8_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(263,16): " + _dafny.string_of(d_17_valueOrError8_)) + d_18_keys_: KeyVectors.KeyVectorsClient + d_18_keys_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_19_valueOrError9_ = JSONHelpers.default__.GetObject(_dafny.Seq("tests"), (d_5_manifestJson_).obj) + if (d_19_valueOrError9_).IsFailure(): + manifestData = (d_19_valueOrError9_).PropagateFailure() + return manifestData + d_20_jsonTests_: _dafny.Seq + d_20_jsonTests_ = (d_19_valueOrError9_).Extract() + source0_ = d_12_typ_ + with _dafny.label("match0"): + if True: + if (source0_) == (_dafny.Seq("awses-decrypt")): + d_21_valueOrError10_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_21_valueOrError10_ = Wrappers.default__.Need(EsdkTestVectors.default__.SupportedDecryptVersion_q(d_10_version_), _dafny.Seq("Unsupported manifest version")) + if (d_21_valueOrError10_).IsFailure(): + manifestData = (d_21_valueOrError10_).PropagateFailure() + return manifestData + d_22_valueOrError11_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_22_valueOrError11_ = JSONHelpers.default__.Get(_dafny.Seq("client"), (d_5_manifestJson_).obj) + if (d_22_valueOrError11_).IsFailure(): + manifestData = (d_22_valueOrError11_).PropagateFailure() + return manifestData + d_23_client_: JSON_Values.JSON + d_23_client_ = (d_22_valueOrError11_).Extract() + manifestData = Wrappers.Result_Success(ManifestData_DecryptManifest(d_10_version_, d_18_keys_, d_23_client_, d_20_jsonTests_)) + raise _dafny.Break("match0") + if True: + if (source0_) == (_dafny.Seq("awses-encrypt")): + d_24_valueOrError12_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_24_valueOrError12_ = Wrappers.default__.Need(EsdkTestVectors.default__.SupportedEncryptVersion_q(d_10_version_), _dafny.Seq("Unsupported manifest version")) + if (d_24_valueOrError12_).IsFailure(): + manifestData = (d_24_valueOrError12_).PropagateFailure() + return manifestData + d_25_valueOrError13_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_25_valueOrError13_ = JSONHelpers.default__.GetObject(_dafny.Seq("plaintexts"), (d_5_manifestJson_).obj) + if (d_25_valueOrError13_).IsFailure(): + manifestData = (d_25_valueOrError13_).PropagateFailure() + return manifestData + d_26_plaintextsJson_: _dafny.Seq + d_26_plaintextsJson_ = (d_25_valueOrError13_).Extract() + d_27_valueOrError15_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + def lambda1_(d_28_obj_): + def iife0_(_pat_let7_0): + def iife1_(d_29_valueOrError14_): + return ((d_29_valueOrError14_).PropagateFailure() if (d_29_valueOrError14_).IsFailure() else Wrappers.Result_Success(((d_28_obj_)[0], (((d_28_obj_)[1]).num).n))) + return iife1_(_pat_let7_0) + return iife0_(Wrappers.default__.Need((((d_28_obj_)[1]).is_Number) and (((0) < ((((d_28_obj_)[1]).num).n)) and (((((d_28_obj_)[1]).num).n) <= (BoundedInts.default__.INT32__MAX))), _dafny.Seq("Size is not a natural number."))) + + d_27_valueOrError15_ = Seq.default__.MapWithResult(lambda1_, d_26_plaintextsJson_) + if (d_27_valueOrError15_).IsFailure(): + manifestData = (d_27_valueOrError15_).PropagateFailure() + return manifestData + d_30_plaintextsLength_: _dafny.Seq + d_30_plaintextsLength_ = (d_27_valueOrError15_).Extract() + manifestData = Wrappers.Result_Success(ManifestData_EncryptManifest(d_10_version_, d_18_keys_, d_30_plaintextsLength_, d_20_jsonTests_)) + raise _dafny.Break("match0") + if True: + manifestData = Wrappers.Result_Failure((_dafny.Seq("Unsupported manifest type:")) + (d_12_typ_)) + pass + return manifestData + + +class ManifestData: + @classmethod + def default(cls, ): + return lambda: ManifestData_DecryptManifest(int(0), None, JSON_Values.JSON.default()(), _dafny.Seq({})) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_DecryptManifest(self) -> bool: + return isinstance(self, ManifestData_DecryptManifest) + @property + def is_EncryptManifest(self) -> bool: + return isinstance(self, ManifestData_EncryptManifest) + +class ManifestData_DecryptManifest(ManifestData, NamedTuple('DecryptManifest', [('version', Any), ('keys', Any), ('client', Any), ('jsonTests', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestManifests.ManifestData.DecryptManifest({_dafny.string_of(self.version)}, {_dafny.string_of(self.keys)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.jsonTests)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestData_DecryptManifest) and self.version == __o.version and self.keys == __o.keys and self.client == __o.client and self.jsonTests == __o.jsonTests + def __hash__(self) -> int: + return super().__hash__() + +class ManifestData_EncryptManifest(ManifestData, NamedTuple('EncryptManifest', [('version', Any), ('keys', Any), ('plaintext', Any), ('jsonTests', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestManifests.ManifestData.EncryptManifest({_dafny.string_of(self.version)}, {_dafny.string_of(self.keys)}, {_dafny.string_of(self.plaintext)}, {_dafny.string_of(self.jsonTests)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestData_EncryptManifest) and self.version == __o.version and self.keys == __o.keys and self.plaintext == __o.plaintext and self.jsonTests == __o.jsonTests + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestVectors.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestVectors.py new file mode 100644 index 000000000..6baf1da54 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/EsdkTestVectors.py @@ -0,0 +1,780 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions + +# Module: EsdkTestVectors + +class default__: + def __init__(self): + pass + + @staticmethod + def SupportedGenerateManifestVersion_q(v): + return (False) or ((v) == (4)) + + @staticmethod + def SupportedEncryptVersion_q(v): + return (((v) == (1)) or ((v) == (4))) or ((v) == (5)) + + @staticmethod + def SupportedDecryptVersion_q(v): + return (((v) == (1)) or ((v) == (2))) or ((v) == (3)) + + @staticmethod + def TestDecrypt(keys, vector): + output: bool = False + if ((vector).algorithmSuiteId).is_Some: + d_0_id_: _dafny.Seq + d_0_id_ = AllAlgorithmSuites.default__.ToHex(((vector).algorithmSuiteId).value) + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-DECRYPT===> "))) + _dafny.print(_dafny.string_of((vector).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(d_0_id_)) + _dafny.print(_dafny.string_of(_dafny.Seq(" "))) + _dafny.print(_dafny.string_of((vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + elif True: + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-DECRYPT===> "))) + _dafny.print(_dafny.string_of((vector).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of((vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + d_1_test_q_: Wrappers.Result + out0_: Wrappers.Result + out0_ = default__.DecryptVectorToDecryptTest(keys, vector) + d_1_test_q_ = out0_ + if (d_1_test_q_).is_Failure: + _dafny.print(_dafny.string_of((d_1_test_q_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + output = False + return output + d_2_test_: DecryptTest + d_2_test_ = (d_1_test_q_).value + d_3_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out1_: Wrappers.Result + out1_ = default__.ReadVectorsFile((((d_2_test_).vector).manifestPath) + (((d_2_test_).vector).ciphertextPath)) + d_3_valueOrError0_ = out1_ + if not(not((d_3_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(202,22): " + _dafny.string_of(d_3_valueOrError0_)) + d_4_ciphertext_: _dafny.Seq + d_4_ciphertext_ = (d_3_valueOrError0_).Extract() + d_5_plaintext_: _dafny.Seq = _dafny.Seq({}) + if (((d_2_test_).vector).is_PositiveDecryptTestVector) or (((d_2_test_).vector).is_PositiveV1OrV2DecryptTestVector): + d_6_valueOrError1_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out2_: Wrappers.Result + out2_ = default__.ReadVectorsFile((((d_2_test_).vector).manifestPath) + (((d_2_test_).vector).plaintextPath)) + d_6_valueOrError1_ = out2_ + if not(not((d_6_valueOrError1_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(205,19): " + _dafny.string_of(d_6_valueOrError1_)) + d_5_plaintext_ = (d_6_valueOrError1_).Extract() + d_7_input_: AwsCryptographyEncryptionSdkTypes.DecryptInput + d_7_input_ = AwsCryptographyEncryptionSdkTypes.DecryptInput_DecryptInput(d_4_ciphertext_, Wrappers.Option_Some((d_2_test_).cmm), Wrappers.Option_None(), ((d_2_test_).vector).reproducedEncryptionContext) + d_8_result_: Wrappers.Result + out3_: Wrappers.Result + out3_ = ((d_2_test_).client).Decrypt(d_7_input_) + d_8_result_ = out3_ + source0_ = (d_2_test_).vector + with _dafny.label("match0"): + if True: + if source0_.is_PositiveDecryptTestVector: + output = ((d_8_result_).is_Success) and ((((d_8_result_).value).plaintext) == (d_5_plaintext_)) + raise _dafny.Break("match0") + if True: + if source0_.is_NegativeDecryptTestVector: + output = (True) and ((d_8_result_).is_Failure) + raise _dafny.Break("match0") + if True: + output = ((d_8_result_).is_Success) and ((((d_8_result_).value).plaintext) == (d_5_plaintext_)) + pass + if not(output): + if ((((d_2_test_).vector).is_PositiveDecryptTestVector) or (((d_2_test_).vector).is_PositiveV1OrV2DecryptTestVector)) and ((d_8_result_).is_Failure): + _dafny.print(_dafny.string_of((d_8_result_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + if (((d_8_result_).error).is_AwsCryptographyMaterialProviders) and ((((d_8_result_).error).AwsCryptographyMaterialProviders).is_CollectionOfErrors): + _dafny.print(_dafny.string_of(_dafny.Seq("list:"))) + _dafny.print(_dafny.string_of((((d_8_result_).error).AwsCryptographyMaterialProviders).list)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + return output + + @staticmethod + def DecryptVectorToDecryptTest(keys, vector): + output: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_0_valueOrError0_ = Wrappers.default__.Need(not((vector).is_NegativeDecryptTestVector), AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Negative Test Vectors not supported at this time"))) + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_valueOrError1_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorCmm(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorCmmInput_TestVectorCmmInput((vector).decryptDescriptions, AwsCryptographyMaterialProvidersTestVectorKeysTypes.CmmOperation_DECRYPT())) + d_1_valueOrError1_ = out0_ + if (d_1_valueOrError1_).IsFailure(): + output = (d_1_valueOrError1_).PropagateFailure() + return output + d_2_cmm_: AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + d_2_cmm_ = (d_1_valueOrError1_).Extract() + d_3_commitmentPolicy_: AwsCryptographyMaterialProvidersTypes.CommitmentPolicy + if ((vector).algorithmSuiteId).is_Some: + d_3_commitmentPolicy_ = AllAlgorithmSuites.default__.GetCompatibleCommitmentPolicy(((vector).algorithmSuiteId).value) + elif True: + d_3_commitmentPolicy_ = AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT()) + d_4_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_4_valueOrError2_ = Wrappers.default__.Need((d_3_commitmentPolicy_).is_ESDK, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Compatible commitment policy is not for ESDK"))) + if (d_4_valueOrError2_).IsFailure(): + output = (d_4_valueOrError2_).PropagateFailure() + return output + d_5_config_: AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig + d_5_config_ = WrappedESDK.default__.WrappedAwsEncryptionSdkConfigWithSuppliedCommitment((d_3_commitmentPolicy_).ESDK) + d_6_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedESDK.default__.WrappedESDK(d_5_config_) + d_6_valueOrError3_ = out1_ + if not(not((d_6_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(281,18): " + _dafny.string_of(d_6_valueOrError3_)) + d_7_client_: AwsCryptographyEncryptionSdkTypes.IAwsEncryptionSdkClient + d_7_client_ = (d_6_valueOrError3_).Extract() + d_8_test_: DecryptTest + d_8_test_ = DecryptTest_DecryptTest(d_2_cmm_, d_7_client_, vector) + output = Wrappers.Result_Success(d_8_test_) + return output + + @staticmethod + def TestEncrypt(plaintexts, keys, test): + output: Wrappers.Result = Wrappers.Result.default(EncryptTestOutput.default())() + d_0_id_: _dafny.Seq + d_0_id_ = AllAlgorithmSuites.default__.ToHex((((test).vector).algorithmSuiteId).value) + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-ENCRYPT===> "))) + _dafny.print(_dafny.string_of((((test).vector).id).value)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(d_0_id_)) + _dafny.print(_dafny.string_of(_dafny.Seq(" "))) + _dafny.print(_dafny.string_of(((test).vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + d_1_vector_: EsdkEncryptTestVector + d_1_vector_ = (test).vector + if not((((test).vector).plaintextPath) in (plaintexts)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(324,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + d_2_plaintext_: _dafny.Seq + d_2_plaintext_ = (plaintexts)[((test).vector).plaintextPath] + d_3_frameLength_: Wrappers.Option + d_3_frameLength_ = (d_1_vector_).frameLength + d_4_input_: AwsCryptographyEncryptionSdkTypes.EncryptInput + d_4_input_ = AwsCryptographyEncryptionSdkTypes.EncryptInput_EncryptInput(d_2_plaintext_, ((test).vector).encryptionContext, Wrappers.Option_Some((test).cmm), Wrappers.Option_None(), Wrappers.Option_Some((((((test).vector).algorithmSuiteId).value).id).ESDK), d_3_frameLength_) + d_5_result_: Wrappers.Result + out0_: Wrappers.Result + out0_ = ((test).client).Encrypt(d_4_input_) + d_5_result_ = out0_ + if ((d_5_result_).is_Success) and ((((test).vector).is_PositiveEncryptTestVector) or (((test).vector).is_PositiveEncryptNegativeDecryptTestVector)): + d_6_valueOrError0_: Wrappers.Result = Wrappers.Result.default(EsdkDecryptTestVector.default())() + out1_: Wrappers.Result + out1_ = default__.EncryptTestToDecryptVector(test, (d_5_result_).value) + d_6_valueOrError0_ = out1_ + if (d_6_valueOrError0_).IsFailure(): + output = (d_6_valueOrError0_).PropagateFailure() + return output + d_7_decryptVector_: EsdkDecryptTestVector + d_7_decryptVector_ = (d_6_valueOrError0_).Extract() + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(True, Wrappers.Option_Some(d_7_decryptVector_))) + elif ((d_5_result_).is_Failure) and (((test).vector).is_NegativeEncryptTestVector): + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(True, Wrappers.Option_None())) + elif True: + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(False, Wrappers.Option_None())) + if (not(((test).vector).is_NegativeEncryptTestVector)) and ((d_5_result_).is_Failure): + _dafny.print(_dafny.string_of((d_5_result_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + return output + + @staticmethod + def EncryptVectorToEncryptTest(keys, vector): + output: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorCmm(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorCmmInput_TestVectorCmmInput(((vector).encryptDescriptions if (vector).is_PositiveEncryptTestVector else ((vector).encryptDescriptions if (vector).is_PositiveEncryptNegativeDecryptTestVector else (vector).encryptDescriptions)), AwsCryptographyMaterialProvidersTestVectorKeysTypes.CmmOperation_ENCRYPT())) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_cmm_: AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + d_1_cmm_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need(((vector).algorithmSuiteId).is_Some, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Missing AlgorithmSuiteId in test vector"))) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_commitmentPolicy_: AwsCryptographyMaterialProvidersTypes.CommitmentPolicy + d_3_commitmentPolicy_ = AllAlgorithmSuites.default__.GetCompatibleCommitmentPolicy(((vector).algorithmSuiteId).value) + d_4_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_4_valueOrError2_ = Wrappers.default__.Need((d_3_commitmentPolicy_).is_ESDK, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Compatible commitment policy is not for ESDK"))) + if (d_4_valueOrError2_).IsFailure(): + output = (d_4_valueOrError2_).PropagateFailure() + return output + d_5_config_: AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig + d_5_config_ = WrappedESDK.default__.WrappedAwsEncryptionSdkConfigWithSuppliedCommitment((d_3_commitmentPolicy_).ESDK) + d_6_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedESDK.default__.WrappedESDK(d_5_config_) + d_6_valueOrError3_ = out1_ + if not(not((d_6_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(397,18): " + _dafny.string_of(d_6_valueOrError3_)) + d_7_client_: AwsCryptographyEncryptionSdkTypes.IAwsEncryptionSdkClient + d_7_client_ = (d_6_valueOrError3_).Extract() + d_8_test_: EncryptTest + d_8_test_ = EncryptTest_EncryptTest(d_1_cmm_, d_7_client_, vector) + output = Wrappers.Result_Success(d_8_test_) + return output + + @staticmethod + def EncryptTestToDecryptVector(test, result): + output: Wrappers.Result = Wrappers.Result.default(EsdkDecryptTestVector.default())() + source0_ = (test).vector + with _dafny.label("match0"): + if True: + if source0_.is_PositiveEncryptTestVector: + output = Wrappers.Result_Success(EsdkDecryptTestVector_PositiveDecryptTestVector((((test).vector).id).value, 3, ((test).vector).decryptManifestPath, default__.ciphertextPathPathRoot, (default__.plaintextPathRoot) + (((test).vector).plaintextPath), ((test).vector).reproducedEncryptionContext, ((test).vector).decryptDescriptions, ((test).vector).commitmentPolicy, ((test).vector).frameLength, ((test).vector).algorithmSuiteId, ((test).vector).description, DecryptionMethod_OneShot())) + raise _dafny.Break("match0") + if True: + output = Wrappers.Result_Failure(_dafny.Seq("Only postive tests supported")) + pass + d_0_decryptManifestCiphertext_: _dafny.Seq + d_0_decryptManifestCiphertext_ = ((((test).vector).decryptManifestPath) + (default__.ciphertextPathPathRoot)) + ((((test).vector).id).value) + d_1_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out0_: Wrappers.Result + out0_ = default__.WriteVectorsFile(d_0_decryptManifestCiphertext_, (result).ciphertext) + d_1_valueOrError0_ = out0_ + if not(not((d_1_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(439,13): " + _dafny.string_of(d_1_valueOrError0_)) + d_2___v52_: tuple + d_2___v52_ = (d_1_valueOrError0_).Extract() + return output + + @staticmethod + def MplPrintErr(e): + hresult_: tuple = () + _dafny.print(_dafny.string_of(e)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def MplVectorPrintErr(e): + hresult_: tuple = () + _dafny.print(_dafny.string_of(e)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def KeyDescriptionToCmm(keys, keyDescriptions): + output: Wrappers.Result = None + d_0_keyringList_: _dafny.Seq + d_0_keyringList_ = _dafny.Seq([]) + hi0_ = len(keyDescriptions) + for d_1_i_ in range(0, hi0_): + d_2_keyDescription_: AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription + d_2_keyDescription_ = (keyDescriptions)[d_1_i_] + d_3_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorKeyring(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorKeyringInput_TestVectorKeyringInput(d_2_keyDescription_)) + d_3_valueOrError0_ = out0_ + if (d_3_valueOrError0_).IsFailure(): + output = (d_3_valueOrError0_).PropagateFailure() + return output + d_4_keyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_4_keyring_ = (d_3_valueOrError0_).Extract() + d_0_keyringList_ = (d_0_keyringList_) + (_dafny.Seq([d_4_keyring_])) + d_5_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_5_valueOrError1_ = Wrappers.default__.Need((len(d_0_keyringList_)) == (1), AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Failed to create any keyrings"))) + if (d_5_valueOrError1_).IsFailure(): + output = (d_5_valueOrError1_).PropagateFailure() + return output + d_6_valueOrError2_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedMaterialProviders.default__.WrappedMaterialProviders(WrappedMaterialProviders.default__.WrappedDefaultMaterialProvidersConfig()) + d_6_valueOrError2_ = out1_ + if not(not((d_6_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(482,15): " + _dafny.string_of(d_6_valueOrError2_)) + d_7_mpl_: AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient + d_7_mpl_ = (d_6_valueOrError2_).Extract() + d_8_generatorKeyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_8_generatorKeyring_ = (d_0_keyringList_)[0] + d_9_maybeMultiKeyring_: Wrappers.Result + out2_: Wrappers.Result + out2_ = (d_7_mpl_).CreateMultiKeyring(AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput_CreateMultiKeyringInput(Wrappers.Option_Some(d_8_generatorKeyring_), _dafny.Seq((d_0_keyringList_)[1::]))) + d_9_maybeMultiKeyring_ = out2_ + d_10_valueOrError3_: Wrappers.Result = None + def lambda0_(d_11_e_): + return AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_AwsCryptographyMaterialProviders(d_11_e_) + + d_10_valueOrError3_ = (d_9_maybeMultiKeyring_).MapFailure(lambda0_) + if (d_10_valueOrError3_).IsFailure(): + output = (d_10_valueOrError3_).PropagateFailure() + return output + d_12_keyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_12_keyring_ = (d_10_valueOrError3_).Extract() + d_13_maybeCmm_: Wrappers.Result + out3_: Wrappers.Result + out3_ = (d_7_mpl_).CreateDefaultCryptographicMaterialsManager(AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput((d_9_maybeMultiKeyring_).value)) + d_13_maybeCmm_ = out3_ + def lambda1_(d_14_e_): + return AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_AwsCryptographyMaterialProviders(d_14_e_) + + output = (d_13_maybeCmm_).MapFailure(lambda1_) + return output + + @staticmethod + def ReadVectorsFile(location): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out0_: Wrappers.Result + out0_ = FileIO.default__.ReadBytesFromFile(location) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_fileBv_: _dafny.Seq + d_1_fileBv_ = (d_0_valueOrError0_).Extract() + output = Wrappers.Result_Success(JSONHelpers.default__.BvToBytes(d_1_fileBv_)) + return output + + @staticmethod + def WriteVectorsFile(location, bytes): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_bv_: _dafny.Seq + d_0_bv_ = JSONHelpers.default__.BytesBv(bytes) + out0_: Wrappers.Result + out0_ = FileIO.default__.WriteBytesToFile(location, d_0_bv_) + output = out0_ + return output + + @_dafny.classproperty + def ciphertextPathPathRoot(instance): + return _dafny.Seq("ciphertexts/") + @_dafny.classproperty + def plaintextPathRoot(instance): + return _dafny.Seq("plaintexts/") + +class EncryptTest: + @classmethod + def default(cls, ): + return lambda: EncryptTest_EncryptTest(None, None, EsdkEncryptTestVector.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_EncryptTest(self) -> bool: + return isinstance(self, EncryptTest_EncryptTest) + +class EncryptTest_EncryptTest(EncryptTest, NamedTuple('EncryptTest', [('cmm', Any), ('client', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EncryptTest.EncryptTest({_dafny.string_of(self.cmm)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EncryptTest_EncryptTest) and self.cmm == __o.cmm and self.client == __o.client and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + + +class DecryptTest: + @classmethod + def default(cls, ): + return lambda: DecryptTest_DecryptTest(None, None, EsdkDecryptTestVector.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_DecryptTest(self) -> bool: + return isinstance(self, DecryptTest_DecryptTest) + +class DecryptTest_DecryptTest(DecryptTest, NamedTuple('DecryptTest', [('cmm', Any), ('client', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptTest.DecryptTest({_dafny.string_of(self.cmm)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptTest_DecryptTest) and self.cmm == __o.cmm and self.client == __o.client and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + + +class SupportedGenerateManifestVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 4 + def _Is(source__): + d_0_v_: int = source__ + if System_.nat._Is(d_0_v_): + return default__.SupportedGenerateManifestVersion_q(d_0_v_) + return False + +class SupportedEncryptVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 1 + def _Is(source__): + d_1_v_: int = source__ + if System_.nat._Is(d_1_v_): + return default__.SupportedEncryptVersion_q(d_1_v_) + return False + +class EsdkEncryptTestVector: + @classmethod + def default(cls, ): + return lambda: EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option.default()(), SupportedEncryptVersion.default(), _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), _dafny.Seq(""), Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_PositiveEncryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_PositiveEncryptTestVector) + @property + def is_PositiveEncryptNegativeDecryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector) + @property + def is_NegativeEncryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_NegativeEncryptTestVector) + +class EsdkEncryptTestVector_PositiveEncryptTestVector(EsdkEncryptTestVector, NamedTuple('PositiveEncryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('decryptManifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('decryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.PositiveEncryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.decryptManifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_PositiveEncryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.decryptManifestPath == __o.decryptManifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.decryptDescriptions == __o.decryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + +class EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector(EsdkEncryptTestVector, NamedTuple('PositiveEncryptNegativeDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('decryptManifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('decryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('decryptErrorDescription', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.PositiveEncryptNegativeDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.decryptManifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.decryptErrorDescription)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.decryptManifestPath == __o.decryptManifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.decryptDescriptions == __o.decryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.decryptErrorDescription == __o.decryptErrorDescription and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + +class EsdkEncryptTestVector_NegativeEncryptTestVector(EsdkEncryptTestVector, NamedTuple('NegativeEncryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('errorDescription', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.NegativeEncryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.errorDescription)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_NegativeEncryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.errorDescription == __o.errorDescription and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + + +class SupportedDecryptVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 1 + def _Is(source__): + d_2_v_: int = source__ + if System_.nat._Is(d_2_v_): + return default__.SupportedDecryptVersion_q(d_2_v_) + return False + +class EsdkDecryptTestVector: + @classmethod + def default(cls, ): + return lambda: EsdkDecryptTestVector_PositiveDecryptTestVector(_dafny.Seq(""), SupportedDecryptVersion.default(), _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), Wrappers.Option.default()(), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), _dafny.Seq(""), DecryptionMethod.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_PositiveDecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_PositiveDecryptTestVector) + @property + def is_NegativeDecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_NegativeDecryptTestVector) + @property + def is_PositiveV1OrV2DecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector) + +class EsdkDecryptTestVector_PositiveDecryptTestVector(EsdkDecryptTestVector, NamedTuple('PositiveDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('plaintextPath', Any), ('reproducedEncryptionContext', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.PositiveDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_PositiveDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.plaintextPath == __o.plaintextPath and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + +class EsdkDecryptTestVector_NegativeDecryptTestVector(EsdkDecryptTestVector, NamedTuple('NegativeDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('errorDescription', Any), ('reproducedEncryptionContext', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.NegativeDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.errorDescription)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_NegativeDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.errorDescription == __o.errorDescription and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + +class EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(EsdkDecryptTestVector, NamedTuple('PositiveV1OrV2DecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('plaintextPath', Any), ('reproducedEncryptionContext', Any), ('requiredEncryptionContextKeys', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.PositiveV1OrV2DecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.requiredEncryptionContextKeys)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.plaintextPath == __o.plaintextPath and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.requiredEncryptionContextKeys == __o.requiredEncryptionContextKeys and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + + +class DecryptionMethod: + @_dafny.classproperty + def AllSingletonConstructors(cls): + return [DecryptionMethod_StreamingUnsignedOnly(), DecryptionMethod_OneShot()] + @classmethod + def default(cls, ): + return lambda: DecryptionMethod_StreamingUnsignedOnly() + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_StreamingUnsignedOnly(self) -> bool: + return isinstance(self, DecryptionMethod_StreamingUnsignedOnly) + @property + def is_OneShot(self) -> bool: + return isinstance(self, DecryptionMethod_OneShot) + +class DecryptionMethod_StreamingUnsignedOnly(DecryptionMethod, NamedTuple('StreamingUnsignedOnly', [])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptionMethod.StreamingUnsignedOnly' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptionMethod_StreamingUnsignedOnly) + def __hash__(self) -> int: + return super().__hash__() + +class DecryptionMethod_OneShot(DecryptionMethod, NamedTuple('OneShot', [])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptionMethod.OneShot' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptionMethod_OneShot) + def __hash__(self) -> int: + return super().__hash__() + + +class EncryptTestOutput: + @classmethod + def default(cls, ): + return lambda: EncryptTestOutput_EncryptTestOutput(False, Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_EncryptTestOutput(self) -> bool: + return isinstance(self, EncryptTestOutput_EncryptTestOutput) + +class EncryptTestOutput_EncryptTestOutput(EncryptTestOutput, NamedTuple('EncryptTestOutput', [('output', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EncryptTestOutput.EncryptTestOutput({_dafny.string_of(self.output)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EncryptTestOutput_EncryptTestOutput) and self.output == __o.output and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/ParseEsdkJsonManifest.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/ParseEsdkJsonManifest.py new file mode 100644 index 000000000..593892eef --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/ParseEsdkJsonManifest.py @@ -0,0 +1,629 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors + +# Module: ParseEsdkJsonManifest + +class default__: + def __init__(self): + pass + + @staticmethod + def BuildDecryptTestVector(op, version, keys, obj): + hresult_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_i_: int + d_0_i_ = len(obj) + d_1_vectors_: _dafny.Seq + d_1_vectors_ = _dafny.Seq([]) + while (d_0_i_) != (0): + d_0_i_ = (d_0_i_) - (1) + d_2_test_: Wrappers.Result + d_2_test_ = default__.ToDecryptTestVectors(op, version, keys, ((obj)[d_0_i_])[0], ((obj)[d_0_i_])[1]) + if ((d_2_test_).is_Failure) and (((d_2_test_).error) != (default__.negativeTestVectorFound)): + hresult_ = Wrappers.Result_Failure(default__.buildTestVectorError) + return hresult_ + if (d_2_test_).is_Success: + d_1_vectors_ = (_dafny.Seq([(d_2_test_).value])) + (d_1_vectors_) + if ((d_2_test_).is_Failure) and (((d_2_test_).error) == (default__.negativeTestVectorFound)): + d_1_vectors_ = d_1_vectors_ + hresult_ = Wrappers.Result_Success(d_1_vectors_) + return hresult_ + return hresult_ + + @staticmethod + def ToDecryptTestVectors(op, version, keys, name, json): + d_0_valueOrError0_ = Wrappers.default__.Need((json).is_Object, _dafny.Seq("Vector is not an object")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_obj_ = (json).obj + source0_ = version + if True: + if (source0_) == (3): + d_2_valueOrError1_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + return default__.V3ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + if (source0_) == (2): + d_3_valueOrError2_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_3_valueOrError2_).IsFailure(): + return (d_3_valueOrError2_).PropagateFailure() + elif True: + return default__.V2ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + if (source0_) == (1): + d_4_valueOrError3_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_4_valueOrError3_).IsFailure(): + return (d_4_valueOrError3_).PropagateFailure() + elif True: + return default__.V1ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Version not supported\n")) + + @staticmethod + def BuildEncryptTestVector(op, version, keys, obj): + hresult_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_i_: int + d_0_i_ = len(obj) + d_1_vectors_: _dafny.Seq + d_1_vectors_ = _dafny.Seq([]) + while (d_0_i_) != (0): + d_0_i_ = (d_0_i_) - (1) + d_2_test_: Wrappers.Result + d_2_test_ = default__.ToEncryptTestVector(op, version, keys, ((obj)[d_0_i_])[0], ((obj)[d_0_i_])[1]) + if (d_2_test_).is_Failure: + hresult_ = Wrappers.Result_Failure((d_2_test_).error) + return hresult_ + d_1_vectors_ = (_dafny.Seq([(d_2_test_).value])) + (d_1_vectors_) + hresult_ = Wrappers.Result_Success(d_1_vectors_) + return hresult_ + return hresult_ + + @staticmethod + def ToEncryptTestVector(op, version, keys, name, json): + d_0_valueOrError0_ = Wrappers.default__.Need((json).is_Object, _dafny.Seq("EncryptTestVector not an object")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_obj_ = (json).obj + source0_ = version + if True: + if (source0_) == (5): + return default__.V5ToEncryptTestVector(op, keys, name, d_1_obj_, version) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Version not supported")) + + @staticmethod + def V5ToEncryptTestVector(op, keys, name, obj, version): + d_0_scenarioString_ = _dafny.Seq("encryption-scenario") + d_1_valueOrError0_ = JSONHelpers.default__.GetObject(d_0_scenarioString_, obj) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + d_2_scenario_ = (d_1_valueOrError0_).Extract() + d_3_typeString_ = _dafny.Seq("type") + d_4_valueOrError1_ = JSONHelpers.default__.GetString(d_3_typeString_, d_2_scenario_) + if (d_4_valueOrError1_).IsFailure(): + return (d_4_valueOrError1_).PropagateFailure() + elif True: + d_5_typ_ = (d_4_valueOrError1_).Extract() + d_6_valueOrError2_ = JSONHelpers.default__.GetString(default__.plaintextJsonKey, d_2_scenario_) + if (d_6_valueOrError2_).IsFailure(): + return (d_6_valueOrError2_).PropagateFailure() + elif True: + d_7_plaintextLoc_ = (d_6_valueOrError2_).Extract() + d_8_valueOrError3_ = ParseJsonManifests.default__.GetAlgorithmSuiteInfo(d_2_scenario_) + if (d_8_valueOrError3_).IsFailure(): + return (d_8_valueOrError3_).PropagateFailure() + elif True: + d_9_algorithmSuite_ = (d_8_valueOrError3_).Extract() + d_10_valueOrError4_ = Wrappers.default__.Need(((d_9_algorithmSuite_).id).is_ESDK, _dafny.Seq("Unsupported algorithmSuiteId")) + if (d_10_valueOrError4_).IsFailure(): + return (d_10_valueOrError4_).PropagateFailure() + elif True: + d_11_valueOrError5_ = JSONHelpers.default__.GetOptionalPositiveLong(default__.frameSizeJsonKey, d_2_scenario_) + if (d_11_valueOrError5_).IsFailure(): + return (d_11_valueOrError5_).PropagateFailure() + elif True: + d_12_frameLength_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.encryptionContextJsonKey, d_2_scenario_) + if (d_13_valueOrError6_).IsFailure(): + return (d_13_valueOrError6_).PropagateFailure() + elif True: + d_14_encryptionContextStrings_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_ = JSONHelpers.default__.utf8EncodeMap(d_14_encryptionContextStrings_) + if (d_15_valueOrError7_).IsFailure(): + return (d_15_valueOrError7_).PropagateFailure() + elif True: + d_16_encryptionContext_ = (d_15_valueOrError7_).Extract() + d_17_valueOrError8_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.reproducedEncryptionContextJsonKey, d_2_scenario_) + if (d_17_valueOrError8_).IsFailure(): + return (d_17_valueOrError8_).PropagateFailure() + elif True: + d_18_reproducedEncryptionContextString_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_ = JSONHelpers.default__.utf8EncodeMap(d_18_reproducedEncryptionContextString_) + if (d_19_valueOrError9_).IsFailure(): + return (d_19_valueOrError9_).PropagateFailure() + elif True: + d_20_reproducedEncryptionContext_ = (d_19_valueOrError9_).Extract() + d_21_valueOrError10_ = JSONHelpers.default__.GetString(_dafny.Seq("description"), d_2_scenario_) + if (d_21_valueOrError10_).IsFailure(): + return (d_21_valueOrError10_).PropagateFailure() + elif True: + d_22_description_ = (d_21_valueOrError10_).Extract() + source0_ = d_5_typ_ + if True: + if (source0_) == (_dafny.Seq("positive-esdk")): + d_23_valueOrError11_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.encryptKeyDescription, d_2_scenario_) + if (d_23_valueOrError11_).IsFailure(): + return (d_23_valueOrError11_).PropagateFailure() + elif True: + d_24_encryptKeyDescription_ = (d_23_valueOrError11_).Extract() + d_25_valueOrError12_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.decryptKeyDescription, d_2_scenario_) + if (d_25_valueOrError12_).IsFailure(): + return (d_25_valueOrError12_).PropagateFailure() + elif True: + d_26_decryptKeyDescription_ = (d_25_valueOrError12_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_Some(name), version, (op).manifestPath, (op).decryptManifestOutput, d_7_plaintextLoc_, d_24_encryptKeyDescription_, d_26_decryptKeyDescription_, Wrappers.Option_Some(d_16_encryptionContext_), Wrappers.Option_Some(d_20_reproducedEncryptionContext_), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), d_12_frameLength_, Wrappers.Option_Some(d_9_algorithmSuite_), d_22_description_, Wrappers.Option_Some(1))) + if True: + return Wrappers.Result_Failure((_dafny.Seq("Unsupported ESDK TestVector type: ")) + (d_5_typ_)) + + @staticmethod + def V1ToDecryptTestVector(op, keys, name, obj, version): + d_0_valueOrError0_ = JSONHelpers.default__.GetString(_dafny.Seq("plaintext"), obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_plaintextLoc_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_ = JSONHelpers.default__.GetString(_dafny.Seq("ciphertext"), obj) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_3_ciphertextLoc_ = (d_2_valueOrError1_).Extract() + d_4_valueOrError2_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_3_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_1_plaintextLoc_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_4_valueOrError2_).IsFailure(): + return (d_4_valueOrError2_).PropagateFailure() + elif True: + d_5_valueOrError3_ = JSONHelpers.default__.GetArray(_dafny.Seq("master-keys"), obj) + if (d_5_valueOrError3_).IsFailure(): + return (d_5_valueOrError3_).PropagateFailure() + elif True: + d_6_masterKeys_ = (d_5_valueOrError3_).Extract() + d_7_valueOrError4_ = default__.GetKeyDescriptions(d_6_masterKeys_, keys) + if (d_7_valueOrError4_).IsFailure(): + return (d_7_valueOrError4_).PropagateFailure() + elif True: + d_8_keyDescriptions_ = (d_7_valueOrError4_).Extract() + d_9_valueOrError5_ = default__.ToMultiKeyDescription(d_8_keyDescriptions_) + if (d_9_valueOrError5_).IsFailure(): + return (d_9_valueOrError5_).PropagateFailure() + elif True: + d_10_keyDescription_ = (d_9_valueOrError5_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_3_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_1_plaintextLoc_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_None(), Wrappers.Option_None(), d_10_keyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_None(), Wrappers.Option_None(), name, EsdkTestVectors.DecryptionMethod_OneShot())) + + @staticmethod + def V2ToDecryptTestVector(op, keys, name, obj, version): + d_0_valueOrError0_ = JSONHelpers.default__.GetObject(_dafny.Seq("result"), obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_resultLoc_ = (d_0_valueOrError0_).Extract() + d_2_errorLoc_q_ = JSONHelpers.default__.GetObject(_dafny.Seq("error"), d_1_resultLoc_) + if (d_2_errorLoc_q_).is_Success: + return Wrappers.Result_Failure(default__.negativeTestVectorFound) + elif True: + d_3_valueOrError1_ = JSONHelpers.default__.GetObject(_dafny.Seq("output"), d_1_resultLoc_) + if (d_3_valueOrError1_).IsFailure(): + return (d_3_valueOrError1_).PropagateFailure() + elif True: + d_4_outputLoc_ = (d_3_valueOrError1_).Extract() + d_5_valueOrError2_ = JSONHelpers.default__.GetString(_dafny.Seq("plaintext"), d_4_outputLoc_) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_plaintextLoc_ = (d_5_valueOrError2_).Extract() + d_7_valueOrError3_ = JSONHelpers.default__.GetString(_dafny.Seq("ciphertext"), obj) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_ciphertextLoc_ = (d_7_valueOrError3_).Extract() + d_9_valueOrError4_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_8_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_6_plaintextLoc_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_9_valueOrError4_).IsFailure(): + return (d_9_valueOrError4_).PropagateFailure() + elif True: + d_10_valueOrError5_ = JSONHelpers.default__.GetArray(_dafny.Seq("master-keys"), obj) + if (d_10_valueOrError5_).IsFailure(): + return (d_10_valueOrError5_).PropagateFailure() + elif True: + d_11_masterKeys_ = (d_10_valueOrError5_).Extract() + d_12_valueOrError6_ = default__.GetKeyDescriptions(d_11_masterKeys_, keys) + if (d_12_valueOrError6_).IsFailure(): + return (d_12_valueOrError6_).PropagateFailure() + elif True: + d_13_keyDescriptions_ = (d_12_valueOrError6_).Extract() + d_14_valueOrError7_ = default__.ToMultiKeyDescription(d_13_keyDescriptions_) + if (d_14_valueOrError7_).IsFailure(): + return (d_14_valueOrError7_).PropagateFailure() + elif True: + d_15_keyDescription_ = (d_14_valueOrError7_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_8_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_6_plaintextLoc_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_None(), Wrappers.Option_None(), d_15_keyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_None(), Wrappers.Option_None(), name, EsdkTestVectors.DecryptionMethod_OneShot())) + + @staticmethod + def V3ToDecryptTestVector(op, keys, name, obj, version): + d_0_scenarioString_ = _dafny.Seq("decryption-scenario") + d_1_valueOrError0_ = JSONHelpers.default__.GetObject(d_0_scenarioString_, obj) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + d_2_scenario_ = (d_1_valueOrError0_).Extract() + d_3_typeString_ = _dafny.Seq("type") + d_4_valueOrError1_ = JSONHelpers.default__.GetString(d_3_typeString_, d_2_scenario_) + if (d_4_valueOrError1_).IsFailure(): + return (d_4_valueOrError1_).PropagateFailure() + elif True: + d_5_typ_ = (d_4_valueOrError1_).Extract() + d_6_valueOrError2_ = JSONHelpers.default__.GetString(default__.ciphertextJsonKey, d_2_scenario_) + if (d_6_valueOrError2_).IsFailure(): + return (d_6_valueOrError2_).PropagateFailure() + elif True: + d_7_ciphertextLoc_ = (d_6_valueOrError2_).Extract() + d_8_valueOrError3_ = ParseJsonManifests.default__.GetAlgorithmSuiteInfo(d_2_scenario_) + if (d_8_valueOrError3_).IsFailure(): + return (d_8_valueOrError3_).PropagateFailure() + elif True: + d_9_algorithmSuite_ = (d_8_valueOrError3_).Extract() + d_10_valueOrError4_ = Wrappers.default__.Need(((d_9_algorithmSuite_).id).is_ESDK, _dafny.Seq("Unsupported algorithmSuiteId")) + if (d_10_valueOrError4_).IsFailure(): + return (d_10_valueOrError4_).PropagateFailure() + elif True: + d_11_valueOrError5_ = JSONHelpers.default__.GetOptionalPositiveLong(default__.frameSizeJsonKey, d_2_scenario_) + if (d_11_valueOrError5_).IsFailure(): + return (d_11_valueOrError5_).PropagateFailure() + elif True: + d_12_frameLength_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.reproducedEncryptionContextJsonKey, d_2_scenario_) + if (d_13_valueOrError6_).IsFailure(): + return (d_13_valueOrError6_).PropagateFailure() + elif True: + d_14_reproducedEncryptionContextStrings_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_ = JSONHelpers.default__.utf8EncodeMap(d_14_reproducedEncryptionContextStrings_) + if (d_15_valueOrError7_).IsFailure(): + return (d_15_valueOrError7_).PropagateFailure() + elif True: + d_16_reproducedEncryptionContext_ = (d_15_valueOrError7_).Extract() + d_17_valueOrError8_ = JSONHelpers.default__.GetString(_dafny.Seq("description"), d_2_scenario_) + if (d_17_valueOrError8_).IsFailure(): + return (d_17_valueOrError8_).PropagateFailure() + elif True: + d_18_description_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_ = JSONHelpers.default__.GetString(_dafny.Seq("result"), d_2_scenario_) + if (d_19_valueOrError9_).IsFailure(): + return (d_19_valueOrError9_).PropagateFailure() + elif True: + d_20_result_ = (d_19_valueOrError9_).Extract() + d_21_valueOrError10_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_7_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_20_result_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_21_valueOrError10_).IsFailure(): + return (d_21_valueOrError10_).PropagateFailure() + elif True: + source0_ = d_5_typ_ + if True: + if (source0_) == (_dafny.Seq("positive-esdk")): + d_22_valueOrError11_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.decryptKeyDescription, d_2_scenario_) + if (d_22_valueOrError11_).IsFailure(): + return (d_22_valueOrError11_).PropagateFailure() + elif True: + d_23_decryptKeyDescription_ = (d_22_valueOrError11_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveDecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_7_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_20_result_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_Some(d_16_reproducedEncryptionContext_), d_23_decryptKeyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), d_12_frameLength_, Wrappers.Option_Some(d_9_algorithmSuite_), d_18_description_, EsdkTestVectors.DecryptionMethod_OneShot())) + if True: + return Wrappers.Result_Failure((_dafny.Seq("Unsupported ESDK TestVector type: ")) + (d_5_typ_)) + + @staticmethod + def GetKeyDescriptions(keyArray, keys): + if (len(keyArray)) == (0): + return Wrappers.Result_Success(_dafny.Seq([])) + elif True: + d_0_currKey_ = (keyArray)[0] + d_1_valueOrError0_ = Wrappers.default__.Need((d_0_currKey_).is_Object, _dafny.Seq("Not an object")) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + def lambda0_(d_3_e_): + return (d_3_e_).ToString() + + d_2_valueOrError1_ = (JSON_API.default__.Serialize(d_0_currKey_)).MapFailure(lambda0_) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_4_encryptStr_ = (d_2_valueOrError1_).Extract() + d_5_valueOrError2_ = ((keys).GetKeyDescription(AwsCryptographyMaterialProvidersTestVectorKeysTypes.GetKeyDescriptionInput_GetKeyDescriptionInput(d_4_encryptStr_))).MapFailure(ParseJsonManifests.default__.ErrorToString) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_encryptDecryptKeyDescription_ = (d_5_valueOrError2_).Extract() + d_7_valueOrError3_ = default__.GetKeyDescriptions(_dafny.Seq((keyArray)[1::]), keys) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_tail_ = (d_7_valueOrError3_).Extract() + return Wrappers.Result_Success((_dafny.Seq([(d_6_encryptDecryptKeyDescription_).keyDescription])) + (d_8_tail_)) + + @staticmethod + def ToMultiKeyDescription(keyDescriptions): + if (len(keyDescriptions)) == (1): + return Wrappers.Result_Success((keyDescriptions)[0]) + elif True: + d_0_valueOrError0_ = Wrappers.default__.Need((len(keyDescriptions)) > (1), _dafny.Seq("Received invalid key description length")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription_Multi(AwsCryptographyMaterialProvidersTestVectorKeysTypes.MultiKeyring_MultiKeyring(Wrappers.Option_Some((keyDescriptions)[0]), _dafny.Seq((keyDescriptions)[1::])))) + + @staticmethod + def GetPath(key, obj): + d_0_valueOrError0_ = JSONHelpers.default__.GetString(key, obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_path_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_ = Wrappers.default__.Need((default__.FILE__PREPEND) < (d_1_path_), _dafny.Seq("Received Invalid location for plaintext or ciphertext.")) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + return Wrappers.Result_Success(_dafny.Seq((d_1_path_)[len(default__.FILE__PREPEND)::])) + + @staticmethod + def Result_q(key): + return ((key) == (_dafny.Seq("output"))) or ((key) == (_dafny.Seq("error"))) + + @_dafny.classproperty + def ciphertextJsonKey(instance): + return _dafny.Seq("ciphertext") + @_dafny.classproperty + def frameSizeJsonKey(instance): + return _dafny.Seq("frame-size") + @_dafny.classproperty + def reproducedEncryptionContextJsonKey(instance): + return _dafny.Seq("reproduced-encryption-context") + @_dafny.classproperty + def decryptKeyDescription(instance): + return _dafny.Seq("decryptKeyDescription") + @_dafny.classproperty + def FILE__PREPEND(instance): + return _dafny.Seq("file://") + @_dafny.classproperty + def negativeTestVectorFound(instance): + return _dafny.Seq("Negative test vector found; not supported yet.") + @_dafny.classproperty + def buildTestVectorError(instance): + return _dafny.Seq("Error other than negative test vector found thrown") + @_dafny.classproperty + def plaintextJsonKey(instance): + return _dafny.Seq("plaintext") + @_dafny.classproperty + def encryptionContextJsonKey(instance): + return _dafny.Seq("encryption-context") + @_dafny.classproperty + def encryptKeyDescription(instance): + return _dafny.Seq("encryptKeyDescription") + @_dafny.classproperty + def masterKeysJsonKey(instance): + return _dafny.Seq("master-keys") + @_dafny.classproperty + def decryptionMethodJsonKey(instance): + return _dafny.Seq("decryption-method") diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDK.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDK.py new file mode 100644 index 000000000..996054c41 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDK.py @@ -0,0 +1,229 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas + +# Module: WrappedESDK + +class default__: + def __init__(self): + pass + + @staticmethod + def WrappedDefaultAwsEncryptionSdkConfig(): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT()), Wrappers.Option_None(), Wrappers.Option_None()) + + @staticmethod + def WrappedAwsEncryptionSdkConfigWithSuppliedCommitment(commitmentPolicy): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(commitmentPolicy), Wrappers.Option_None(), Wrappers.Option_None()) + + @staticmethod + def WrappedAwsEncryptionSdkConfig(commitmentPolicy, maxEncryptedDataKeys, netV4__0__0__RetryPolicy): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(commitmentPolicy), Wrappers.Option_Some(maxEncryptedDataKeys), Wrappers.Option_Some(netV4__0__0__RetryPolicy)) + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDKMain.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDKMain.py new file mode 100644 index 000000000..155d4caef --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WrappedESDKMain.py @@ -0,0 +1,346 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestManifests as EsdkTestManifests + +# Module: WrappedESDKMain + +class default__: + def __init__(self): + pass + + @staticmethod + def Main2(args): + d_0_vectorOptions_: GetOpt.Options + d_0_vectorOptions_ = GetOpt.Options_Options(_dafny.Seq("test-vectors"), _dafny.Seq("?"), _dafny.Seq([GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("decrypt"), _dafny.Seq("decrypt command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("manifest-path"), _dafny.Seq("relative path to the location of the manifest"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("manifest-name"), _dafny.Seq("name of file that contains the decrypt vectors file"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("test-name"), _dafny.Seq("id of the test to run"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_UnusedOk(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())]))), GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("encrypt"), _dafny.Seq("encrypt command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("manifest-path"), _dafny.Seq("relative path to the location of the manifest"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("decrypt-manifest-path"), _dafny.Seq("relative path to the location where the decrypted manifest will be written to."), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("test-name"), _dafny.Seq("id of the test to run"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_UnusedOk(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())]))), GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("encrypt-manifest"), _dafny.Seq("encryp manifest command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("encrypt-manifest-output"), _dafny.Seq("relative path of where to store the encrypt-manifest produced"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())])))])) + if not((0) < (len(args))): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(40,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + d_1_parsedOptions_q_: Wrappers.Result + d_1_parsedOptions_q_ = GetOpt.default__.GetOptions(d_0_vectorOptions_, args) + if (d_1_parsedOptions_q_).is_Success: + d_2_h_: Wrappers.Option + d_2_h_ = GetOpt.default__.NeedsHelp(d_0_vectorOptions_, (d_1_parsedOptions_q_).value, _dafny.Seq("")) + if (d_2_h_).is_Some: + _dafny.print(_dafny.string_of((d_2_h_).value)) + return + d_3_op_q_: Wrappers.Result + d_3_op_q_ = default__.ParseCommandLineOptions((d_1_parsedOptions_q_).value) + if (d_3_op_q_).is_Success: + d_4_op_: EsdkManifestOptions.ManifestOptions + d_4_op_ = (d_3_op_q_).value + source0_ = d_4_op_ + with _dafny.label("match0"): + if True: + if source0_.is_Decrypt: + d_5_result_: Wrappers.Result + out0_: Wrappers.Result + out0_ = EsdkTestManifests.default__.StartDecryptVectors(d_4_op_) + d_5_result_ = out0_ + if (d_5_result_).is_Failure: + _dafny.print(_dafny.string_of((d_5_result_).error)) + if not((d_5_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(59,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + raise _dafny.Break("match0") + if True: + if source0_.is_Encrypt: + d_6_result_: Wrappers.Result + out1_: Wrappers.Result + out1_ = EsdkTestManifests.default__.StartEncryptVectors(d_4_op_) + d_6_result_ = out1_ + if (d_6_result_).is_Failure: + _dafny.print(_dafny.string_of((d_6_result_).error)) + if not((d_6_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(65,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + raise _dafny.Break("match0") + if True: + d_7_result_: Wrappers.Result + out2_: Wrappers.Result + out2_ = WriteVectors.default__.WriteTestVectors(d_4_op_) + d_7_result_ = out2_ + if (d_7_result_).is_Failure: + _dafny.print(_dafny.string_of((d_7_result_).error)) + if not((d_7_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(71,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + pass + elif True: + _dafny.print(_dafny.string_of(((d_3_op_q_).error) + (_dafny.Seq("\n")))) + _dafny.print(_dafny.string_of(_dafny.Seq("help\n"))) + elif True: + _dafny.print(_dafny.string_of(((d_1_parsedOptions_q_).error) + (_dafny.Seq("\n")))) + + @staticmethod + def ParseCommandLineOptions(parsedOptions): + d_0_valueOrError0_ = Wrappers.default__.Need(((parsedOptions).subcommand).is_Some, _dafny.Seq("Must supply subcommand\n")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + source0_ = (((parsedOptions).subcommand).value).command + if True: + if (source0_) == (_dafny.Seq("decrypt")): + return default__.ParseDecryptCmd((((parsedOptions).subcommand).value).params) + if True: + if (source0_) == (_dafny.Seq("encrypt")): + return default__.ParseEncryptCmd((((parsedOptions).subcommand).value).params) + if True: + if (source0_) == (_dafny.Seq("encrypt-manifest")): + return default__.ParseEncryptManifestCmd((((parsedOptions).subcommand).value).params) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Received unknown subcommand")) + + @staticmethod + def ParseDecryptCmd(params): + d_0_manifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-path")) + d_1_testName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("test-name")) + d_2_manifestFileName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-name")) + d_3_manifestPath_ = ((d_0_manifestPath_q_).value if (d_0_manifestPath_q_).is_Some else _dafny.Seq(".")) + d_4_valueOrError0_ = Wrappers.default__.Need((0) < (len(d_3_manifestPath_)), _dafny.Seq("Invalid manifest path length\n")) + if (d_4_valueOrError0_).IsFailure(): + return (d_4_valueOrError0_).PropagateFailure() + elif True: + d_5_valueOrError1_ = Wrappers.default__.Need((d_2_manifestFileName_q_).is_Some, _dafny.Seq("Must supply manifest file name")) + if (d_5_valueOrError1_).IsFailure(): + return (d_5_valueOrError1_).PropagateFailure() + elif True: + d_6_manifestFileName_ = (d_2_manifestFileName_q_).value + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_Decrypt((d_3_manifestPath_ if (Seq.default__.Last(d_3_manifestPath_)) == ('/') else (d_3_manifestPath_) + (_dafny.Seq("/"))), d_6_manifestFileName_, (d_1_testName_q_ if (d_1_testName_q_).is_Some else Wrappers.Option_None()))) + + @staticmethod + def ParseEncryptCmd(params): + d_0_manifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-path")) + d_1_manifestName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest")) + d_2_decryptManifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("decrypt-manifest-path")) + d_3_testName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("test-name")) + d_4_manifestPath_ = ((d_0_manifestPath_q_).value if (d_0_manifestPath_q_).is_Some else _dafny.Seq(".")) + d_5_manifestName_ = ((d_1_manifestName_q_).value if (d_1_manifestName_q_).is_Some else _dafny.Seq("encrypt-manifest.json")) + d_6_decryptManifestPath_ = ((d_2_decryptManifestPath_q_).value if (d_2_decryptManifestPath_q_).is_Some else _dafny.Seq(".")) + d_7_valueOrError0_ = Wrappers.default__.Need(((0) < (len(d_4_manifestPath_))) and ((0) < (len(d_6_decryptManifestPath_))), _dafny.Seq("Invalid manifest or decrypt manifest path length\n")) + if (d_7_valueOrError0_).IsFailure(): + return (d_7_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_Encrypt((d_4_manifestPath_ if (Seq.default__.Last(d_4_manifestPath_)) == ('/') else (d_4_manifestPath_) + (_dafny.Seq("/"))), d_5_manifestName_, (d_6_decryptManifestPath_ if (Seq.default__.Last(d_6_decryptManifestPath_)) == ('/') else (d_6_decryptManifestPath_) + (_dafny.Seq("/"))), (d_3_testName_q_ if (d_3_testName_q_).is_Some else Wrappers.Option_None()))) + + @staticmethod + def ParseEncryptManifestCmd(params): + d_0_encryptManifestOutput_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("encrypt-manifest-output")) + d_1_encryptManifestOutput_ = ((d_0_encryptManifestOutput_q_).value if (d_0_encryptManifestOutput_q_).is_Some else _dafny.Seq(".")) + d_2_valueOrError0_ = Wrappers.default__.Need((0) < (len(d_1_encryptManifestOutput_)), _dafny.Seq("Invalid encrypt manifest output length")) + if (d_2_valueOrError0_).IsFailure(): + return (d_2_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_EncryptManifest((d_1_encryptManifestOutput_ if (Seq.default__.Last(d_1_encryptManifestOutput_)) == ('/') else (d_1_encryptManifestOutput_) + (_dafny.Seq("/"))), 5)) + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteEsdkJsonManifests.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteEsdkJsonManifests.py new file mode 100644 index 000000000..2588607e0 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteEsdkJsonManifests.py @@ -0,0 +1,369 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc + +# Module: WriteEsdkJsonManifests + +class default__: + def __init__(self): + pass + + @staticmethod + def EncryptionContextKeysToJson(keys): + if (keys).is_Some: + def lambda0_(d_1_bytes_): + def iife0_(_pat_let0_0): + def iife1_(d_2_valueOrError1_): + def iife2_(_pat_let1_0): + def iife3_(d_3_key_): + return Wrappers.Result_Success(JSON_Values.JSON_String(d_3_key_)) + return iife3_(_pat_let1_0) + return ((d_2_valueOrError1_).PropagateFailure() if (d_2_valueOrError1_).IsFailure() else iife2_((d_2_valueOrError1_).Extract())) + return iife1_(_pat_let0_0) + return iife0_(UTF8.default__.Decode(d_1_bytes_)) + + d_0_valueOrError0_ = Seq.default__.MapWithResult(lambda0_, (keys).value) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_4_tmp_ = (d_0_valueOrError0_).Extract() + return Wrappers.Result_Success(_dafny.Seq([(_dafny.Seq("requiredEncryptionContextKeys"), JSON_Values.JSON_Array(d_4_tmp_))])) + elif True: + return Wrappers.Result_Success(_dafny.Seq([])) + + @staticmethod + def EncryptionContextToJson(key, m): + def lambda0_(d_1_a_, d_2_b_): + return (d_1_a_) < (d_2_b_) + + d_0_keys_ = SortedSets.default__.SetToOrderedSequence2((m).keys, lambda0_) + def lambda1_(d_4_m_): + def lambda2_(d_5_k_): + def iife0_(_pat_let2_0): + def iife1_(d_6_valueOrError1_): + def iife2_(_pat_let3_0): + def iife3_(d_7_key_): + def iife4_(_pat_let4_0): + def iife5_(d_8_valueOrError2_): + def iife6_(_pat_let5_0): + def iife7_(d_9_value_): + return Wrappers.Result_Success((d_7_key_, JSON_Values.JSON_String(d_9_value_))) + return iife7_(_pat_let5_0) + return ((d_8_valueOrError2_).PropagateFailure() if (d_8_valueOrError2_).IsFailure() else iife6_((d_8_valueOrError2_).Extract())) + return iife5_(_pat_let4_0) + return iife4_(UTF8.default__.Decode((d_4_m_)[d_5_k_])) + return iife3_(_pat_let3_0) + return ((d_6_valueOrError1_).PropagateFailure() if (d_6_valueOrError1_).IsFailure() else iife2_((d_6_valueOrError1_).Extract())) + return iife1_(_pat_let2_0) + return iife0_(UTF8.default__.Decode(d_5_k_)) + + return lambda2_ + + d_3_valueOrError0_ = Seq.default__.MapWithResult(lambda1_(m), d_0_keys_) + if (d_3_valueOrError0_).IsFailure(): + return (d_3_valueOrError0_).PropagateFailure() + elif True: + d_10_pairsBytes_ = (d_3_valueOrError0_).Extract() + return Wrappers.Result_Success(_dafny.Seq([(key, JSON_Values.JSON_Object(d_10_pairsBytes_))])) + + @staticmethod + def printJson(j): + hresult_: tuple = () + _dafny.print(_dafny.string_of(j)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def EncryptTestVectorToJson(test): + d_0_valueOrError0_ = Wrappers.default__.Need((((test).algorithmSuiteId).is_Some) and (((test).frameLength).is_Some), _dafny.Seq("test is missing algorithmSuite ID, or frameLength")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_id_ = AllAlgorithmSuites.default__.ToHex(((test).algorithmSuiteId).value) + d_2_valueOrError1_ = (default__.EncryptionContextToJson(_dafny.Seq("encryption-context"), ((test).encryptionContext).value) if ((test).encryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("encryption-context"), _dafny.Map({}))) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_3_encryptionContext_ = (d_2_valueOrError1_).Extract() + d_4_valueOrError2_ = Wrappers.default__.Need((len(d_3_encryptionContext_)) == (1), _dafny.Seq("Error parsing encryption context")) + if (d_4_valueOrError2_).IsFailure(): + return (d_4_valueOrError2_).PropagateFailure() + elif True: + d_5_valueOrError3_ = (default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), ((test).reproducedEncryptionContext).value) if ((test).reproducedEncryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), _dafny.Map({}))) + if (d_5_valueOrError3_).IsFailure(): + return (d_5_valueOrError3_).PropagateFailure() + elif True: + d_6_reproducedEncryptionContext_ = (d_5_valueOrError3_).Extract() + d_7_optionalValues_ = (d_3_encryptionContext_) + (d_6_reproducedEncryptionContext_) + source0_ = test + if True: + if source0_.is_PositiveEncryptTestVector: + d_8_valueOrError4_ = KeyDescription.default__.ToJson((test).encryptDescriptions, 3) + if (d_8_valueOrError4_).IsFailure(): + return (d_8_valueOrError4_).PropagateFailure() + elif True: + d_9_encrypt_ = (d_8_valueOrError4_).Extract() + d_10_valueOrError5_ = KeyDescription.default__.ToJson((test).decryptDescriptions, 3) + if (d_10_valueOrError5_).IsFailure(): + return (d_10_valueOrError5_).PropagateFailure() + elif True: + d_11_decrypt_ = (d_10_valueOrError5_).Extract() + d_12_scenario_ = JSON_Values.JSON_Object((_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("positive-esdk"))), (_dafny.Seq("plaintext"), JSON_Values.JSON_String(_dafny.Seq("small"))), (_dafny.Seq("description"), JSON_Values.JSON_String((test).description)), (_dafny.Seq("algorithmSuiteId"), JSON_Values.JSON_String(d_1_id_)), (_dafny.Seq("frame-size"), JSON_Values.JSON_Number(JSON_Values.default__.Int(((test).frameLength).value))), (_dafny.Seq("encryptKeyDescription"), d_9_encrypt_), (_dafny.Seq("decryptKeyDescription"), d_11_decrypt_)])) + (d_7_optionalValues_)) + return Wrappers.Result_Success(JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("encryption-scenario"), d_12_scenario_)]))) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only Positive Tests supported :(")) + + @staticmethod + def OptionalBytes(key, secret): + if (secret).is_Some: + d_0_base64_ = Base64.default__.Encode((secret).value) + return _dafny.Seq([(key, JSON_Values.JSON_String(d_0_base64_))]) + elif True: + return _dafny.Seq([]) + + @staticmethod + def DecryptTestVectorToJson(test): + d_0_valueOrError0_ = Wrappers.default__.Need((((test).algorithmSuiteId).is_Some) and (((test).frameLength).is_Some), _dafny.Seq("test is missing algorithmSuite ID, or frameLength")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_id_ = AllAlgorithmSuites.default__.ToHex(((test).algorithmSuiteId).value) + d_2_description_ = (((test).description) + (_dafny.Seq(" "))) + (d_1_id_) + d_3_valueOrError1_ = (default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), ((test).reproducedEncryptionContext).value) if ((test).reproducedEncryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), _dafny.Map({}))) + if (d_3_valueOrError1_).IsFailure(): + return (d_3_valueOrError1_).PropagateFailure() + elif True: + d_4_reproducedEncryptionContext_ = (d_3_valueOrError1_).Extract() + d_5_valueOrError2_ = Wrappers.default__.Need((len(d_4_reproducedEncryptionContext_)) == (1), _dafny.Seq("Error parsing encryption context")) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_optionalValues_ = d_4_reproducedEncryptionContext_ + source0_ = test + if True: + if source0_.is_PositiveDecryptTestVector: + d_7_valueOrError3_ = KeyDescription.default__.ToJson((test).decryptDescriptions, 3) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_decrypt_ = (d_7_valueOrError3_).Extract() + d_9_scenario_ = JSON_Values.JSON_Object((_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("positive-esdk"))), (_dafny.Seq("ciphertext"), JSON_Values.JSON_String((_dafny.Seq("file://ciphertexts/")) + ((test).id))), (_dafny.Seq("result"), JSON_Values.JSON_String((_dafny.Seq("file://")) + ((test).plaintextPath))), (_dafny.Seq("algorithmSuiteId"), JSON_Values.JSON_String(d_1_id_)), (_dafny.Seq("frame-size"), JSON_Values.JSON_Number(JSON_Values.default__.Int(((test).frameLength).value))), (_dafny.Seq("description"), JSON_Values.JSON_String((test).description)), (_dafny.Seq("decryptKeyDescription"), d_8_decrypt_)])) + (d_6_optionalValues_)) + return Wrappers.Result_Success(JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("decryption-scenario"), d_9_scenario_)]))) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only Positive Tests supported :(")) + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteVectors.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteVectors.py new file mode 100644 index 000000000..ec61a5ff9 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/WriteVectors.py @@ -0,0 +1,369 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests + +# Module: WriteVectors + +class default__: + def __init__(self): + pass + + @staticmethod + def GetCommitmentPolicyString(algorithmSuite): + source0_ = (algorithmSuite).id + if True: + if source0_.is_ESDK: + if ((algorithmSuite).commitment).is_None: + return _dafny.Seq("FORBID_ENCRYPT_ALLOW_DECRYPT") + elif True: + return _dafny.Seq("REQUIRE_ENCRYPT_REQUIRE_DECRYPT") + if True: + return _dafny.Seq("NOT SUPPORTED FOR UNSTRUCTURED ENCRYPTION") + + @staticmethod + def GetCommitmentPolicyType(commitmentPolicy): + if (commitmentPolicy) == (_dafny.Seq("FORBID_ENCRYPT_ALLOW_DECRYPT")): + return AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT()) + elif True: + return AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT()) + + @staticmethod + def WriteTestVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_version_: int + d_0_version_ = (op).version + d_1_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Set)() + d_1_valueOrError0_ = default__.getVersionTests(d_0_version_) + if (d_1_valueOrError0_).IsFailure(): + output = (d_1_valueOrError0_).PropagateFailure() + return output + d_2_allTests_: _dafny.Set + d_2_allTests_ = (d_1_valueOrError0_).Extract() + d_3_tests_: _dafny.Seq + out0_: _dafny.Seq + out0_ = SortedSets.default__.SetToSequence(d_2_allTests_) + d_3_tests_ = out0_ + d_4_sortedTests_: _dafny.Seq + d_4_sortedTests_ = Seq_MergeSort.default__.MergeSortBy(d_3_tests_, default__.DescriptionLessThan) + d_5_testsJSON_: _dafny.Seq + d_5_testsJSON_ = _dafny.Seq([]) + hi0_ = len(d_4_sortedTests_) + for d_6_i_ in range(0, hi0_): + d_7_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_7_valueOrError1_ = Wrappers.default__.Need((True) and ((((d_4_sortedTests_)[d_6_i_]).algorithmSuiteId).is_Some), _dafny.Seq("No algorithm suite defined in test")) + if (d_7_valueOrError1_).IsFailure(): + output = (d_7_valueOrError1_).PropagateFailure() + return output + d_8_id_: _dafny.Seq + d_8_id_ = AllAlgorithmSuites.default__.ToHex((((d_4_sortedTests_)[d_6_i_]).algorithmSuiteId).value) + d_9_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out1_: Wrappers.Result + out1_ = UUID.default__.GenerateUUID() + d_9_valueOrError2_ = out1_ + if not(not((d_9_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(82,18): " + _dafny.string_of(d_9_valueOrError2_)) + d_10_uuid_: _dafny.Seq + d_10_uuid_ = (d_9_valueOrError2_).Extract() + d_11_valueOrError3_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_11_valueOrError3_ = WriteEsdkJsonManifests.default__.EncryptTestVectorToJson((d_4_sortedTests_)[d_6_i_]) + if (d_11_valueOrError3_).IsFailure(): + output = (d_11_valueOrError3_).PropagateFailure() + return output + d_12_test_: JSON_Values.JSON + d_12_test_ = (d_11_valueOrError3_).Extract() + d_5_testsJSON_ = (d_5_testsJSON_) + (_dafny.Seq([(d_10_uuid_, d_12_test_)])) + d_13_manifestJson_: JSON_Values.JSON + d_13_manifestJson_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("awses-encrypt"))), (_dafny.Seq("version"), JSON_Values.JSON_Number(JSON_Values.default__.Int(5)))])) + d_14_plaintexts_: JSON_Values.JSON + d_14_plaintexts_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("small"), JSON_Values.JSON_Number(JSON_Values.default__.Int(10240)))])) + d_15_esdkEncryptManifests_: JSON_Values.JSON + d_15_esdkEncryptManifests_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("manifest"), d_13_manifestJson_), (_dafny.Seq("keys"), JSON_Values.JSON_String(_dafny.Seq("file://keys.json"))), (_dafny.Seq("plaintexts"), d_14_plaintexts_), (_dafny.Seq("tests"), JSON_Values.JSON_Object(d_5_testsJSON_))])) + d_16_valueOrError4_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_16_valueOrError4_ = JSON_API.default__.Serialize(d_15_esdkEncryptManifests_) + if not(not((d_16_valueOrError4_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(102,36): " + _dafny.string_of(d_16_valueOrError4_)) + d_17_esdkEncryptManifestBytes_: _dafny.Seq + d_17_esdkEncryptManifestBytes_ = (d_16_valueOrError4_).Extract() + d_18_esdkEncryptManifestBv_: _dafny.Seq + d_18_esdkEncryptManifestBv_ = JSONHelpers.default__.BytesBv(d_17_esdkEncryptManifestBytes_) + d_19_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out2_: Wrappers.Result + out2_ = FileIO.default__.WriteBytesToFile(((op).encryptManifestOutput) + (_dafny.Seq("encrypt-manifest.json")), d_18_esdkEncryptManifestBv_) + d_19_valueOrError5_ = out2_ + if not(not((d_19_valueOrError5_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(105,13): " + _dafny.string_of(d_19_valueOrError5_)) + d_20___v2_: tuple + d_20___v2_ = (d_19_valueOrError5_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def WriteDecryptManifest(op, keys, tests): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_testsJSON_: _dafny.Seq + d_0_testsJSON_ = _dafny.Seq([]) + hi0_ = len(tests) + for d_1_i_ in range(0, hi0_): + d_2_name_: _dafny.Seq + d_2_name_ = ((tests)[d_1_i_]).id + d_3_valueOrError0_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_3_valueOrError0_ = WriteEsdkJsonManifests.default__.DecryptTestVectorToJson((tests)[d_1_i_]) + if (d_3_valueOrError0_).IsFailure(): + output = (d_3_valueOrError0_).PropagateFailure() + return output + d_4_test_: JSON_Values.JSON + d_4_test_ = (d_3_valueOrError0_).Extract() + d_0_testsJSON_ = (d_0_testsJSON_) + (_dafny.Seq([(d_2_name_, d_4_test_)])) + d_5_manifestJson_: JSON_Values.JSON + d_5_manifestJson_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("awses-decrypt"))), (_dafny.Seq("version"), JSON_Values.JSON_Number(JSON_Values.default__.Int(3)))])) + d_6_esdkDecryptManifest_: JSON_Values.JSON + d_6_esdkDecryptManifest_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("manifest"), d_5_manifestJson_), (_dafny.Seq("client"), JSON_Values.JSON_String(_dafny.Seq("aws-encryption-sdk-dafny"))), (_dafny.Seq("keys"), JSON_Values.JSON_String(_dafny.Seq("file://keys.json"))), (_dafny.Seq("tests"), JSON_Values.JSON_Object(d_0_testsJSON_))])) + d_7_valueOrError1_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_7_valueOrError1_ = JSON_API.default__.Serialize(d_6_esdkDecryptManifest_) + if not(not((d_7_valueOrError1_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(146,36): " + _dafny.string_of(d_7_valueOrError1_)) + d_8_esdkDecryptManifestBytes_: _dafny.Seq + d_8_esdkDecryptManifestBytes_ = (d_7_valueOrError1_).Extract() + d_9_esdkDecryptManifestBv_: _dafny.Seq + d_9_esdkDecryptManifestBv_ = JSONHelpers.default__.BytesBv(d_8_esdkDecryptManifestBytes_) + d_10_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out0_: Wrappers.Result + out0_ = FileIO.default__.WriteBytesToFile(((op).decryptManifestOutput) + (_dafny.Seq("decrypt-manifest.json")), d_9_esdkDecryptManifestBv_) + d_10_valueOrError2_ = out0_ + if not(not((d_10_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(149,13): " + _dafny.string_of(d_10_valueOrError2_)) + d_11___v3_: tuple + d_11___v3_ = (d_10_valueOrError2_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def getVersionTests(version): + source0_ = version + if True: + if (source0_) == (5): + return Wrappers.Result_Success((AllEsdkV4NoReqEc.default__.Tests) | (AllEsdkV4WithReqEc.default__.Tests)) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only version 4 of generate manifest is supported\n")) + + @staticmethod + def DescriptionLessThan(x, y): + return default__.Below((x).description, (y).description) + + @staticmethod + def Below(x, y): + return not ((len(x)) != (0)) or ((((len(y)) != (0)) and (((x)[0]) <= ((y)[0]))) and (not (((x)[0]) == ((y)[0])) or (default__.Below(_dafny.Seq((x)[1::]), _dafny.Seq((y)[1::]))))) + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__main__.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__main__.py new file mode 100644 index 000000000..7303208b4 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__main__.py @@ -0,0 +1,15 @@ +# Dafny program the_program compiled into Python +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny + +try: + dafnyArgs = [_dafny.Seq(a) for a in sys.argv] + module_.default__.Test____Main____(dafnyArgs) +except _dafny.HaltException as e: + _dafny.print("[Program halted] " + e.message + "\n") + sys.exit(1) diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-311.pyc new file mode 100644 index 000000000..5b4e335dd Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-312.pyc new file mode 100644 index 000000000..bafd1fb71 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4NoReqEc.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-311.pyc new file mode 100644 index 000000000..df57a2c56 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-312.pyc new file mode 100644 index 000000000..19114d813 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/AllEsdkV4WithReqEc.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-311.pyc new file mode 100644 index 000000000..fc4ff6f89 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-312.pyc new file mode 100644 index 000000000..737420939 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkManifestOptions.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-311.pyc new file mode 100644 index 000000000..119fa671f Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-312.pyc new file mode 100644 index 000000000..7a8829c5e Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestManifests.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-311.pyc new file mode 100644 index 000000000..c8fc306d6 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-312.pyc new file mode 100644 index 000000000..403143b1b Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/EsdkTestVectors.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-311.pyc new file mode 100644 index 000000000..20eaf580a Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-312.pyc new file mode 100644 index 000000000..624ebe967 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/ParseEsdkJsonManifest.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-311.pyc new file mode 100644 index 000000000..aa32519bf Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-312.pyc new file mode 100644 index 000000000..1eca0316b Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDK.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-311.pyc new file mode 100644 index 000000000..73b69e73d Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-312.pyc new file mode 100644 index 000000000..64be817a1 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WrappedESDKMain.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-311.pyc new file mode 100644 index 000000000..457b24e31 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-312.pyc new file mode 100644 index 000000000..a48b7ba2d Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteEsdkJsonManifests.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-311.pyc new file mode 100644 index 000000000..59d2abe68 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-312.pyc new file mode 100644 index 000000000..b6bf50e62 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/WriteVectors.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-311.pyc new file mode 100644 index 000000000..166cc9872 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-312.pyc new file mode 100644 index 000000000..995322f51 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/__pycache__/module_.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/dafny_src-py.dtr b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/dafny_src-py.dtr new file mode 100644 index 000000000..2e95eed63 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/dafny_src-py.dtr @@ -0,0 +1,35 @@ +file_format_version = "1.0" +dafny_version = "4.9.0.0" +[options_by_module.WrappedAbstractAwsCryptographyEncryptionSdkService] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.WrappedESDK] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.EsdkManifestOptions] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.EsdkTestVectors] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.AllEsdkV4NoReqEc] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.AllEsdkV4WithReqEc] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.WriteEsdkJsonManifests] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.WriteVectors] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.ParseEsdkJsonManifest] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.EsdkTestManifests] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" +[options_by_module.WrappedESDKMain] +legacy-module-names = false +python-module-name = "aws_encryption_sdk_test_vectors.internaldafny.generated" diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/module_.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/module_.py new file mode 100644 index 000000000..0fbd0d7f7 --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/internaldafny/generated/module_.py @@ -0,0 +1,234 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import aws_encryption_sdk_test_vectors.internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestManifests as EsdkTestManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDKMain as WrappedESDKMain + +# Module: module_ + +class default__: + def __init__(self): + pass + + @staticmethod + def Test____Main____(noArgsParameter__): + d_0_success_: bool + d_0_success_ = True + if not(d_0_success_): + raise _dafny.HaltException("(1,0): " + _dafny.string_of(_dafny.Seq("Test failures occurred: see above.\n"))) + diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__init__.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__init__.py new file mode 100644 index 000000000..09be6133b --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__init__.py @@ -0,0 +1,3 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +# Do not modify this file. This file is machine generated, and any changes to it will be overwritten. diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..ad9cf8ce4 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 000000000..239a759b6 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/__init__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-311.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-311.pyc new file mode 100644 index 000000000..7290c627e Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-312.pyc b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-312.pyc new file mode 100644 index 000000000..02debfe14 Binary files /dev/null and b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/__pycache__/shim.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/shim.py b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/shim.py new file mode 100644 index 000000000..586313d2b --- /dev/null +++ b/TestVectors/runtimes/python/src/aws_encryption_sdk_test_vectors/smithygenerated/aws_cryptography_encryptionsdk/shim.py @@ -0,0 +1,66 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +# Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + +from aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes import ( + DecryptInput_DecryptInput as DafnyDecryptInput, + DecryptOutput_DecryptOutput as DafnyDecryptOutput, + EncryptInput_EncryptInput as DafnyEncryptInput, + EncryptOutput_EncryptOutput as DafnyEncryptOutput, +) +import aws_encryption_sdk.internaldafny.generated.module_ +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.dafny_to_smithy +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.errors +from aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.errors import ( + CollectionOfErrors, + OpaqueError, + ServiceError, + _smithy_error_to_dafny_error, +) +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.models +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.smithy_to_dafny +from typing import Any + + +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes +import aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.client as client_impl + + +class ESDKShim( + aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes.IAwsEncryptionSdkClient +): + def __init__(self, _impl: client_impl): + self._impl = _impl + + def Encrypt(self, input): + try: + smithy_client_request: ( + aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.models.EncryptInput + ) = aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.dafny_to_smithy.aws_cryptography_encryptionsdk_EncryptInput( + input + ) + smithy_client_response = self._impl.encrypt(smithy_client_request) + return Wrappers.Result_Success( + aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.smithy_to_dafny.aws_cryptography_encryptionsdk_EncryptOutput( + smithy_client_response + ) + ) + except Exception as e: + return Wrappers.Result_Failure(_smithy_error_to_dafny_error(e)) + + def Decrypt(self, input): + try: + smithy_client_request: ( + aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.models.DecryptInput + ) = aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.dafny_to_smithy.aws_cryptography_encryptionsdk_DecryptInput( + input + ) + smithy_client_response = self._impl.decrypt(smithy_client_request) + return Wrappers.Result_Success( + aws_encryption_sdk.smithygenerated.aws_cryptography_encryptionsdk.smithy_to_dafny.aws_cryptography_encryptionsdk_DecryptOutput( + smithy_client_response + ) + ) + except Exception as e: + return Wrappers.Result_Failure(_smithy_error_to_dafny_error(e)) diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4NoReqEc.py b/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4NoReqEc.py new file mode 100644 index 000000000..472eb97cf --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4NoReqEc.py @@ -0,0 +1,277 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors + +# Module: AllEsdkV4NoReqEc + +class default__: + def __init__(self): + pass + + @_dafny.classproperty + def AllPositiveKeyringTestsNoReqCmmNoKmsRsa(instance): + return ((((((((((_dafny.Set({})) | (AllDefaultCmm.default__.SuccessTestingRequiredEncryptionContextKeysReproducedEncryptionContext)) | (AllHierarchy.default__.Tests)) | (AllKms.default__.Tests)) | (AllKmsMrkAware.default__.Tests)) | (AllKmsMrkAwareDiscovery.default__.Tests)) | (AllRawAES.default__.Tests)) | (AllRawRSA.default__.Tests)) | (AllMulti.default__.Tests)) | (AllRawECDH.default__.Tests)) | (AllKmsEcdh.default__.Tests) + @_dafny.classproperty + def frameSize(instance): + return 512 + @_dafny.classproperty + def AllPostiveKeyringTestsNoDBESuiteNoReqEC(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AllPositiveKeyringTestsNoReqCmmNoKmsRsa).Elements: + d_0_keyringConfig_: TestVectors.EncryptTestVector = compr_0_ + if ((d_0_keyringConfig_) in (default__.AllPositiveKeyringTestsNoReqCmmNoKmsRsa)) and (not((d_0_keyringConfig_).is_NegativeEncryptKeyringVector)): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_keyringConfig_).encryptDescription, (d_0_keyringConfig_).decryptDescription, Wrappers.Option_None(), Wrappers.Option_None(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_keyringConfig_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def AwsKmsRsaTests(instance): + return AllKmsRsa.default__.Tests + @_dafny.classproperty + def esdkAlgorithmSuitesKmsRsa(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_0_ in (AllAlgorithmSuites.default__.AllAlgorithmSuites).Elements: + d_0_suite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_0_ + if AlgorithmSuites.AlgorithmSuite._Is(d_0_suite_): + if (((d_0_suite_) in (AllAlgorithmSuites.default__.AllAlgorithmSuites)) and (not(((d_0_suite_).signature).is_ECDSA))) and (((d_0_suite_).id).is_ESDK): + coll0_ = coll0_.union(_dafny.Set([d_0_suite_])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def AllPositiveKeyringTestsNoDBEKmsRsa(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AwsKmsRsaTests).Elements: + d_0_keyringConfig_: TestVectors.EncryptTestVector = compr_0_ + if ((d_0_keyringConfig_) in (default__.AwsKmsRsaTests)) and (not((d_0_keyringConfig_).is_NegativeEncryptKeyringVector)): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (default__.esdkAlgorithmSuitesKmsRsa).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (default__.esdkAlgorithmSuitesKmsRsa): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_keyringConfig_).encryptDescription, (d_0_keyringConfig_).decryptDescription, Wrappers.Option_None(), Wrappers.Option_None(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_keyringConfig_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def Tests(instance): + return (default__.AllPostiveKeyringTestsNoDBESuiteNoReqEC) | (default__.AllPositiveKeyringTestsNoDBEKmsRsa) diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4WithReqEc.py b/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4WithReqEc.py new file mode 100644 index 000000000..808f917cb --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/AllEsdkV4WithReqEc.py @@ -0,0 +1,246 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc + +# Module: AllEsdkV4WithReqEc + +class default__: + def __init__(self): + pass + + @_dafny.classproperty + def AllPositiveReqEcTests(instance): + return AllRequiredEncryptionContextCmm.default__.SuccessTestingRequiredEncryptionContextKeysReproducedEncryptionContext + @_dafny.classproperty + def frameSize(instance): + return 512 + @_dafny.classproperty + def AllPositiveReqEcEsdkTests(instance): + def iife0_(): + coll0_ = _dafny.Set() + compr_0_: TestVectors.EncryptTestVector + for compr_0_ in (default__.AllPositiveReqEcTests).Elements: + d_0_config_: TestVectors.EncryptTestVector = compr_0_ + if (d_0_config_) in (default__.AllPositiveReqEcTests): + compr_1_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + for compr_1_ in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites).Elements: + d_1_algorithmSuite_: AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = compr_1_ + if (d_1_algorithmSuite_) in (AllAlgorithmSuites.default__.ESDKAlgorithmSuites): + coll0_ = coll0_.union(_dafny.Set([EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_None(), 4, _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), (d_0_config_).encryptDescription, (d_0_config_).decryptDescription, Wrappers.Option_Some((d_0_config_).encryptionContext), (d_0_config_).reproducedEncryptionContext, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_Some(default__.frameSize), Wrappers.Option_Some(d_1_algorithmSuite_), (d_0_config_).name, Wrappers.Option_Some(1))])) + return _dafny.Set(coll0_) + return iife0_() + + @_dafny.classproperty + def Tests(instance): + return default__.AllPositiveReqEcEsdkTests diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/EsdkManifestOptions.py b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkManifestOptions.py new file mode 100644 index 000000000..54972bfb0 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkManifestOptions.py @@ -0,0 +1,266 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK + +# Module: EsdkManifestOptions + + +class ManifestOptions: + @classmethod + def default(cls, ): + return lambda: ManifestOptions_Decrypt(_dafny.Seq(""), _dafny.Seq(""), Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_Decrypt(self) -> bool: + return isinstance(self, ManifestOptions_Decrypt) + @property + def is_Encrypt(self) -> bool: + return isinstance(self, ManifestOptions_Encrypt) + @property + def is_DecryptSingle(self) -> bool: + return isinstance(self, ManifestOptions_DecryptSingle) + @property + def is_EncryptManifest(self) -> bool: + return isinstance(self, ManifestOptions_EncryptManifest) + +class ManifestOptions_Decrypt(ManifestOptions, NamedTuple('Decrypt', [('manifestPath', Any), ('manifestFileName', Any), ('testName', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.Decrypt({_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.manifestFileName)}, {_dafny.string_of(self.testName)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_Decrypt) and self.manifestPath == __o.manifestPath and self.manifestFileName == __o.manifestFileName and self.testName == __o.testName + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_Encrypt(ManifestOptions, NamedTuple('Encrypt', [('manifestPath', Any), ('manifest', Any), ('decryptManifestOutput', Any), ('testName', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.Encrypt({_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.manifest)}, {_dafny.string_of(self.decryptManifestOutput)}, {_dafny.string_of(self.testName)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_Encrypt) and self.manifestPath == __o.manifestPath and self.manifest == __o.manifest and self.decryptManifestOutput == __o.decryptManifestOutput and self.testName == __o.testName + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_DecryptSingle(ManifestOptions, NamedTuple('DecryptSingle', [('keysPath', Any), ('keyDescription', Any), ('base64Bytes', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.DecryptSingle({_dafny.string_of(self.keysPath)}, {_dafny.string_of(self.keyDescription)}, {_dafny.string_of(self.base64Bytes)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_DecryptSingle) and self.keysPath == __o.keysPath and self.keyDescription == __o.keyDescription and self.base64Bytes == __o.base64Bytes + def __hash__(self) -> int: + return super().__hash__() + +class ManifestOptions_EncryptManifest(ManifestOptions, NamedTuple('EncryptManifest', [('encryptManifestOutput', Any), ('version', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkManifestOptions.ManifestOptions.EncryptManifest({_dafny.string_of(self.encryptManifestOutput)}, {_dafny.string_of(self.version)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestOptions_EncryptManifest) and self.encryptManifestOutput == __o.encryptManifestOutput and self.version == __o.version + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestManifests.py b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestManifests.py new file mode 100644 index 000000000..46dbf686f --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestManifests.py @@ -0,0 +1,633 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import .internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import .internaldafny.generated.WriteVectors as WriteVectors +import .internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest + +# Module: EsdkTestManifests + +class default__: + def __init__(self): + pass + + @staticmethod + def StartDecryptVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = default__.GetManifest((op).manifestPath, (op).manifestFileName) + d_0_valueOrError0_ = out0_ + if not(not((d_0_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(40,27): " + _dafny.string_of(d_0_valueOrError0_)) + d_1_decryptManifest_: ManifestData + d_1_decryptManifest_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need((d_1_decryptManifest_).is_DecryptManifest, _dafny.Seq("Not a decrypt manifest")) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_3_valueOrError2_ = ParseEsdkJsonManifest.default__.BuildDecryptTestVector(op, (d_1_decryptManifest_).version, (d_1_decryptManifest_).keys, (d_1_decryptManifest_).jsonTests) + if (d_3_valueOrError2_).IsFailure(): + output = (d_3_valueOrError2_).PropagateFailure() + return output + d_4_decryptVectors_: _dafny.Seq + d_4_decryptVectors_ = (d_3_valueOrError2_).Extract() + out1_: Wrappers.Result + out1_ = default__.TestDecrypts((d_1_decryptManifest_).keys, d_4_decryptVectors_) + output = out1_ + return output + + @staticmethod + def TestDecryptVector_q(v): + return (True) and (((v).decryptionMethod).is_OneShot) + + @staticmethod + def TestDecrypts(keys, vectors): + manifest: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Starting "))) + _dafny.print(_dafny.string_of(len(vectors))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Decrypt Tests =================== \n\n"))) + d_0_hasFailure_: bool + d_0_hasFailure_ = False + d_1_skipped_: int + d_1_skipped_ = 0 + hi0_ = len(vectors) + for d_2_i_ in range(0, hi0_): + d_3_vector_: EsdkTestVectors.EsdkDecryptTestVector + d_3_vector_ = (vectors)[d_2_i_] + if default__.TestDecryptVector_q(d_3_vector_): + d_4_pass_: bool + out0_: bool + out0_ = EsdkTestVectors.default__.TestDecrypt(keys, d_3_vector_) + d_4_pass_ = out0_ + if not(d_4_pass_): + d_0_hasFailure_ = True + elif True: + d_1_skipped_ = (d_1_skipped_) + (1) + _dafny.print(_dafny.string_of(_dafny.Seq("\nSKIP===> "))) + _dafny.print(_dafny.string_of((d_3_vector_).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Completed "))) + _dafny.print(_dafny.string_of(len(vectors))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Decrypt Tests =================== \n\n"))) + if (0) < (d_1_skipped_): + _dafny.print(_dafny.string_of(_dafny.Seq("Skipped: "))) + _dafny.print(_dafny.string_of(d_1_skipped_)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + if not(not(d_0_hasFailure_)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(92,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + manifest = Wrappers.Result_Success(_dafny.Seq([])) + return manifest + + @staticmethod + def StartEncryptVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = default__.GetManifest((op).manifestPath, (op).manifest) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_encryptManifest_: ManifestData + d_1_encryptManifest_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need((d_1_encryptManifest_).is_EncryptManifest, _dafny.Seq("Not a encrypt manifest")) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_3_valueOrError2_ = ParseEsdkJsonManifest.default__.BuildEncryptTestVector(op, (d_1_encryptManifest_).version, (d_1_encryptManifest_).keys, (d_1_encryptManifest_).jsonTests) + if (d_3_valueOrError2_).IsFailure(): + output = (d_3_valueOrError2_).PropagateFailure() + return output + d_4_encryptVectors_: _dafny.Seq + d_4_encryptVectors_ = (d_3_valueOrError2_).Extract() + d_5_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = AtomicPrimitives.default__.AtomicPrimitives(AtomicPrimitives.default__.DefaultCryptoConfig()) + d_5_valueOrError3_ = out1_ + if not(not((d_5_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(114,13): " + _dafny.string_of(d_5_valueOrError3_)) + d_6_p_: AtomicPrimitives.AtomicPrimitivesClient + d_6_p_ = (d_5_valueOrError3_).Extract() + d_7_plaintext_: _dafny.Map + d_7_plaintext_ = _dafny.Map({}) + hi0_ = len((d_1_encryptManifest_).plaintext) + for d_8_i_ in range(0, hi0_): + let_tmp_rhs0_ = ((d_1_encryptManifest_).plaintext)[d_8_i_] + d_9_name_ = let_tmp_rhs0_[0] + d_10_length_ = let_tmp_rhs0_[1] + d_11_valueOrError4_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out2_: Wrappers.Result + out2_ = (d_6_p_).GenerateRandomBytes(AwsCryptographyPrimitivesTypes.GenerateRandomBytesInput_GenerateRandomBytesInput(d_10_length_)) + d_11_valueOrError4_ = out2_ + if not(not((d_11_valueOrError4_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(119,18): " + _dafny.string_of(d_11_valueOrError4_)) + d_12_data_: _dafny.Seq + d_12_data_ = (d_11_valueOrError4_).Extract() + _dafny.print(_dafny.string_of((((op).decryptManifestOutput) + (EsdkTestVectors.default__.plaintextPathRoot)) + (d_9_name_))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n\n"))) + d_13_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out3_: Wrappers.Result + out3_ = EsdkTestVectors.default__.WriteVectorsFile((((op).decryptManifestOutput) + (EsdkTestVectors.default__.plaintextPathRoot)) + (d_9_name_), d_12_data_) + d_13_valueOrError5_ = out3_ + if (d_13_valueOrError5_).IsFailure(): + output = (d_13_valueOrError5_).PropagateFailure() + return output + d_14___v0_: tuple + d_14___v0_ = (d_13_valueOrError5_).Extract() + d_7_plaintext_ = (d_7_plaintext_) | (_dafny.Map({d_9_name_: d_12_data_})) + d_15_encryptTests_q_: Wrappers.Result + out4_: Wrappers.Result + out4_ = default__.ToEncryptTests((d_1_encryptManifest_).keys, d_4_encryptVectors_) + d_15_encryptTests_q_ = out4_ + d_16_valueOrError6_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + def lambda0_(d_17_e_): + def iife0_(_pat_let6_0): + def iife1_(d_18___v1_): + return _dafny.Seq("Cmm failure") + return iife1_(_pat_let6_0) + return iife0_(EsdkTestVectors.default__.MplVectorPrintErr(d_17_e_)) + + d_16_valueOrError6_ = (d_15_encryptTests_q_).MapFailure(lambda0_) + if (d_16_valueOrError6_).IsFailure(): + output = (d_16_valueOrError6_).PropagateFailure() + return output + d_19_encryptTests_: _dafny.Seq + d_19_encryptTests_ = (d_16_valueOrError6_).Extract() + d_20_valueOrError7_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out5_: Wrappers.Result + out5_ = default__.TestEncrypts(d_7_plaintext_, (d_1_encryptManifest_).keys, d_19_encryptTests_) + d_20_valueOrError7_ = out5_ + if (d_20_valueOrError7_).IsFailure(): + output = (d_20_valueOrError7_).PropagateFailure() + return output + d_21_decryptVectors_: _dafny.Seq + d_21_decryptVectors_ = (d_20_valueOrError7_).Extract() + d_22_valueOrError8_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out6_: Wrappers.Result + out6_ = WriteVectors.default__.WriteDecryptManifest(op, (d_1_encryptManifest_).keys, d_21_decryptVectors_) + d_22_valueOrError8_ = out6_ + if (d_22_valueOrError8_).IsFailure(): + output = (d_22_valueOrError8_).PropagateFailure() + return output + d_23___v2_: tuple + d_23___v2_ = (d_22_valueOrError8_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def TestEncryptVector_q(vector): + return (True) and (not (((vector).frameLength).is_Some) or (AwsCryptographyEncryptionSdkTypes.default__.IsValid__FrameLength(((vector).frameLength).value))) + + @staticmethod + def ToEncryptTests(keys, vectors): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_encryptTests_: _dafny.Seq + d_0_encryptTests_ = _dafny.Seq([]) + hi0_ = len(vectors) + for d_1_i_ in range(0, hi0_): + d_2_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = EsdkTestVectors.default__.EncryptVectorToEncryptTest(keys, (vectors)[d_1_i_]) + d_2_valueOrError0_ = out0_ + if (d_2_valueOrError0_).IsFailure(): + output = (d_2_valueOrError0_).PropagateFailure() + return output + d_3_test_: EsdkTestVectors.EncryptTest + d_3_test_ = (d_2_valueOrError0_).Extract() + d_0_encryptTests_ = (d_0_encryptTests_) + (_dafny.Seq([d_3_test_])) + output = Wrappers.Result_Success(d_0_encryptTests_) + return output + return output + + @staticmethod + def TestEncrypts(plaintexts, keys, tests): + manifest: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Starting "))) + _dafny.print(_dafny.string_of(len(tests))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Encrypt Tests =================== \n\n"))) + d_0_hasFailure_: bool + d_0_hasFailure_ = False + d_1_decryptVectors_: _dafny.Seq + d_1_decryptVectors_ = _dafny.Seq([]) + d_2_skipped_: _dafny.Seq + d_2_skipped_ = _dafny.Seq([]) + hi0_ = len(tests) + for d_3_i_ in range(0, hi0_): + d_4_test_: EsdkTestVectors.EncryptTest + d_4_test_ = (tests)[d_3_i_] + d_5_valueOrError0_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_5_valueOrError0_ = Wrappers.default__.Need((((d_4_test_).vector).id).is_Some, _dafny.Seq("Vector is missing uuid")) + if (d_5_valueOrError0_).IsFailure(): + manifest = (d_5_valueOrError0_).PropagateFailure() + return manifest + if default__.TestEncryptVector_q((d_4_test_).vector): + d_6_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_6_valueOrError1_ = Wrappers.default__.Need(((((d_4_test_).vector).algorithmSuiteId).is_Some) and ((((((d_4_test_).vector).algorithmSuiteId).value).id).is_ESDK), _dafny.Seq("Vector is using an algorithm suite other than ESDK")) + if (d_6_valueOrError1_).IsFailure(): + manifest = (d_6_valueOrError1_).PropagateFailure() + return manifest + d_7_valueOrError2_: Wrappers.Result = Wrappers.Result.default(EsdkTestVectors.EncryptTestOutput.default())() + out0_: Wrappers.Result + out0_ = EsdkTestVectors.default__.TestEncrypt(plaintexts, keys, d_4_test_) + d_7_valueOrError2_ = out0_ + if (d_7_valueOrError2_).IsFailure(): + manifest = (d_7_valueOrError2_).PropagateFailure() + return manifest + d_8_pass_: EsdkTestVectors.EncryptTestOutput + d_8_pass_ = (d_7_valueOrError2_).Extract() + if not((d_8_pass_).output): + d_0_hasFailure_ = True + elif ((d_8_pass_).vector).is_Some: + d_1_decryptVectors_ = (d_1_decryptVectors_) + (_dafny.Seq([((d_8_pass_).vector).value])) + elif True: + d_2_skipped_ = (d_2_skipped_) + (_dafny.Seq([((((d_4_test_).vector).id).value) + (_dafny.Seq("\n"))])) + _dafny.print(_dafny.string_of(_dafny.Seq("\nSKIP===> "))) + _dafny.print(_dafny.string_of((((d_4_test_).vector).id).value)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n=================== Completed "))) + _dafny.print(_dafny.string_of(len(tests))) + _dafny.print(_dafny.string_of(_dafny.Seq(" Encrypt Tests =================== \n\n"))) + if not(not(d_0_hasFailure_)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(215,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + manifest = Wrappers.Result_Success(d_1_decryptVectors_) + return manifest + + @staticmethod + def GetManifest(manifestPath, manifestFileName): + manifestData: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out0_: Wrappers.Result + out0_ = FileIO.default__.ReadBytesFromFile((manifestPath) + (manifestFileName)) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + manifestData = (d_0_valueOrError0_).PropagateFailure() + return manifestData + d_1_decryptManifestBv_: _dafny.Seq + d_1_decryptManifestBv_ = (d_0_valueOrError0_).Extract() + d_2_decryptManifestBytes_: _dafny.Seq + d_2_decryptManifestBytes_ = JSONHelpers.default__.BvToBytes(d_1_decryptManifestBv_) + d_3_valueOrError1_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + def lambda0_(d_4_e_): + return (d_4_e_).ToString() + + d_3_valueOrError1_ = (JSON_API.default__.Deserialize(d_2_decryptManifestBytes_)).MapFailure(lambda0_) + if (d_3_valueOrError1_).IsFailure(): + manifestData = (d_3_valueOrError1_).PropagateFailure() + return manifestData + d_5_manifestJson_: JSON_Values.JSON + d_5_manifestJson_ = (d_3_valueOrError1_).Extract() + d_6_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_6_valueOrError2_ = Wrappers.default__.Need((d_5_manifestJson_).is_Object, _dafny.Seq("Not a JSON object")) + if (d_6_valueOrError2_).IsFailure(): + manifestData = (d_6_valueOrError2_).PropagateFailure() + return manifestData + d_7_valueOrError3_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_7_valueOrError3_ = JSONHelpers.default__.GetObject(_dafny.Seq("manifest"), (d_5_manifestJson_).obj) + if (d_7_valueOrError3_).IsFailure(): + manifestData = (d_7_valueOrError3_).PropagateFailure() + return manifestData + d_8_manifest_: _dafny.Seq + d_8_manifest_ = (d_7_valueOrError3_).Extract() + d_9_valueOrError4_: Wrappers.Result = Wrappers.Result.default(System_.nat.default)() + d_9_valueOrError4_ = JSONHelpers.default__.GetNat(_dafny.Seq("version"), d_8_manifest_) + if (d_9_valueOrError4_).IsFailure(): + manifestData = (d_9_valueOrError4_).PropagateFailure() + return manifestData + d_10_version_: int + d_10_version_ = (d_9_valueOrError4_).Extract() + d_11_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_11_valueOrError5_ = JSONHelpers.default__.GetString(_dafny.Seq("type"), d_8_manifest_) + if (d_11_valueOrError5_).IsFailure(): + manifestData = (d_11_valueOrError5_).PropagateFailure() + return manifestData + d_12_typ_: _dafny.Seq + d_12_typ_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_13_valueOrError6_ = JSONHelpers.default__.GetString(_dafny.Seq("keys"), (d_5_manifestJson_).obj) + if (d_13_valueOrError6_).IsFailure(): + manifestData = (d_13_valueOrError6_).PropagateFailure() + return manifestData + d_14_keyManifestUri_: _dafny.Seq + d_14_keyManifestUri_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_15_valueOrError7_ = Wrappers.default__.Need((_dafny.Seq("file://")) < (d_14_keyManifestUri_), _dafny.Seq("Unexpected URI prefix")) + if (d_15_valueOrError7_).IsFailure(): + manifestData = (d_15_valueOrError7_).PropagateFailure() + return manifestData + d_16_keyManifestPath_: _dafny.Seq + d_16_keyManifestPath_ = (manifestPath) + (_dafny.Seq((d_14_keyManifestUri_)[7::])) + d_17_valueOrError8_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = KeyVectors.default__.KeyVectors(AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyVectorsConfig_KeyVectorsConfig(d_16_keyManifestPath_)) + d_17_valueOrError8_ = out1_ + if not(not((d_17_valueOrError8_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestManifests.dfy(263,16): " + _dafny.string_of(d_17_valueOrError8_)) + d_18_keys_: KeyVectors.KeyVectorsClient + d_18_keys_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_19_valueOrError9_ = JSONHelpers.default__.GetObject(_dafny.Seq("tests"), (d_5_manifestJson_).obj) + if (d_19_valueOrError9_).IsFailure(): + manifestData = (d_19_valueOrError9_).PropagateFailure() + return manifestData + d_20_jsonTests_: _dafny.Seq + d_20_jsonTests_ = (d_19_valueOrError9_).Extract() + source0_ = d_12_typ_ + with _dafny.label("match0"): + if True: + if (source0_) == (_dafny.Seq("awses-decrypt")): + d_21_valueOrError10_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_21_valueOrError10_ = Wrappers.default__.Need(EsdkTestVectors.default__.SupportedDecryptVersion_q(d_10_version_), _dafny.Seq("Unsupported manifest version")) + if (d_21_valueOrError10_).IsFailure(): + manifestData = (d_21_valueOrError10_).PropagateFailure() + return manifestData + d_22_valueOrError11_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_22_valueOrError11_ = JSONHelpers.default__.Get(_dafny.Seq("client"), (d_5_manifestJson_).obj) + if (d_22_valueOrError11_).IsFailure(): + manifestData = (d_22_valueOrError11_).PropagateFailure() + return manifestData + d_23_client_: JSON_Values.JSON + d_23_client_ = (d_22_valueOrError11_).Extract() + manifestData = Wrappers.Result_Success(ManifestData_DecryptManifest(d_10_version_, d_18_keys_, d_23_client_, d_20_jsonTests_)) + raise _dafny.Break("match0") + if True: + if (source0_) == (_dafny.Seq("awses-encrypt")): + d_24_valueOrError12_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_24_valueOrError12_ = Wrappers.default__.Need(EsdkTestVectors.default__.SupportedEncryptVersion_q(d_10_version_), _dafny.Seq("Unsupported manifest version")) + if (d_24_valueOrError12_).IsFailure(): + manifestData = (d_24_valueOrError12_).PropagateFailure() + return manifestData + d_25_valueOrError13_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_25_valueOrError13_ = JSONHelpers.default__.GetObject(_dafny.Seq("plaintexts"), (d_5_manifestJson_).obj) + if (d_25_valueOrError13_).IsFailure(): + manifestData = (d_25_valueOrError13_).PropagateFailure() + return manifestData + d_26_plaintextsJson_: _dafny.Seq + d_26_plaintextsJson_ = (d_25_valueOrError13_).Extract() + d_27_valueOrError15_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + def lambda1_(d_28_obj_): + def iife0_(_pat_let7_0): + def iife1_(d_29_valueOrError14_): + return ((d_29_valueOrError14_).PropagateFailure() if (d_29_valueOrError14_).IsFailure() else Wrappers.Result_Success(((d_28_obj_)[0], (((d_28_obj_)[1]).num).n))) + return iife1_(_pat_let7_0) + return iife0_(Wrappers.default__.Need((((d_28_obj_)[1]).is_Number) and (((0) < ((((d_28_obj_)[1]).num).n)) and (((((d_28_obj_)[1]).num).n) <= (BoundedInts.default__.INT32__MAX))), _dafny.Seq("Size is not a natural number."))) + + d_27_valueOrError15_ = Seq.default__.MapWithResult(lambda1_, d_26_plaintextsJson_) + if (d_27_valueOrError15_).IsFailure(): + manifestData = (d_27_valueOrError15_).PropagateFailure() + return manifestData + d_30_plaintextsLength_: _dafny.Seq + d_30_plaintextsLength_ = (d_27_valueOrError15_).Extract() + manifestData = Wrappers.Result_Success(ManifestData_EncryptManifest(d_10_version_, d_18_keys_, d_30_plaintextsLength_, d_20_jsonTests_)) + raise _dafny.Break("match0") + if True: + manifestData = Wrappers.Result_Failure((_dafny.Seq("Unsupported manifest type:")) + (d_12_typ_)) + pass + return manifestData + + +class ManifestData: + @classmethod + def default(cls, ): + return lambda: ManifestData_DecryptManifest(int(0), None, JSON_Values.JSON.default()(), _dafny.Seq({})) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_DecryptManifest(self) -> bool: + return isinstance(self, ManifestData_DecryptManifest) + @property + def is_EncryptManifest(self) -> bool: + return isinstance(self, ManifestData_EncryptManifest) + +class ManifestData_DecryptManifest(ManifestData, NamedTuple('DecryptManifest', [('version', Any), ('keys', Any), ('client', Any), ('jsonTests', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestManifests.ManifestData.DecryptManifest({_dafny.string_of(self.version)}, {_dafny.string_of(self.keys)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.jsonTests)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestData_DecryptManifest) and self.version == __o.version and self.keys == __o.keys and self.client == __o.client and self.jsonTests == __o.jsonTests + def __hash__(self) -> int: + return super().__hash__() + +class ManifestData_EncryptManifest(ManifestData, NamedTuple('EncryptManifest', [('version', Any), ('keys', Any), ('plaintext', Any), ('jsonTests', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestManifests.ManifestData.EncryptManifest({_dafny.string_of(self.version)}, {_dafny.string_of(self.keys)}, {_dafny.string_of(self.plaintext)}, {_dafny.string_of(self.jsonTests)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, ManifestData_EncryptManifest) and self.version == __o.version and self.keys == __o.keys and self.plaintext == __o.plaintext and self.jsonTests == __o.jsonTests + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestVectors.py b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestVectors.py new file mode 100644 index 000000000..4c25e1195 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/EsdkTestVectors.py @@ -0,0 +1,780 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions + +# Module: EsdkTestVectors + +class default__: + def __init__(self): + pass + + @staticmethod + def SupportedGenerateManifestVersion_q(v): + return (False) or ((v) == (4)) + + @staticmethod + def SupportedEncryptVersion_q(v): + return (((v) == (1)) or ((v) == (4))) or ((v) == (5)) + + @staticmethod + def SupportedDecryptVersion_q(v): + return (((v) == (1)) or ((v) == (2))) or ((v) == (3)) + + @staticmethod + def TestDecrypt(keys, vector): + output: bool = False + if ((vector).algorithmSuiteId).is_Some: + d_0_id_: _dafny.Seq + d_0_id_ = AllAlgorithmSuites.default__.ToHex(((vector).algorithmSuiteId).value) + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-DECRYPT===> "))) + _dafny.print(_dafny.string_of((vector).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(d_0_id_)) + _dafny.print(_dafny.string_of(_dafny.Seq(" "))) + _dafny.print(_dafny.string_of((vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + elif True: + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-DECRYPT===> "))) + _dafny.print(_dafny.string_of((vector).id)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of((vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + d_1_test_q_: Wrappers.Result + out0_: Wrappers.Result + out0_ = default__.DecryptVectorToDecryptTest(keys, vector) + d_1_test_q_ = out0_ + if (d_1_test_q_).is_Failure: + _dafny.print(_dafny.string_of((d_1_test_q_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + output = False + return output + d_2_test_: DecryptTest + d_2_test_ = (d_1_test_q_).value + d_3_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out1_: Wrappers.Result + out1_ = default__.ReadVectorsFile((((d_2_test_).vector).manifestPath) + (((d_2_test_).vector).ciphertextPath)) + d_3_valueOrError0_ = out1_ + if not(not((d_3_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(202,22): " + _dafny.string_of(d_3_valueOrError0_)) + d_4_ciphertext_: _dafny.Seq + d_4_ciphertext_ = (d_3_valueOrError0_).Extract() + d_5_plaintext_: _dafny.Seq = _dafny.Seq({}) + if (((d_2_test_).vector).is_PositiveDecryptTestVector) or (((d_2_test_).vector).is_PositiveV1OrV2DecryptTestVector): + d_6_valueOrError1_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out2_: Wrappers.Result + out2_ = default__.ReadVectorsFile((((d_2_test_).vector).manifestPath) + (((d_2_test_).vector).plaintextPath)) + d_6_valueOrError1_ = out2_ + if not(not((d_6_valueOrError1_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(205,19): " + _dafny.string_of(d_6_valueOrError1_)) + d_5_plaintext_ = (d_6_valueOrError1_).Extract() + d_7_input_: AwsCryptographyEncryptionSdkTypes.DecryptInput + d_7_input_ = AwsCryptographyEncryptionSdkTypes.DecryptInput_DecryptInput(d_4_ciphertext_, Wrappers.Option_Some((d_2_test_).cmm), Wrappers.Option_None(), ((d_2_test_).vector).reproducedEncryptionContext) + d_8_result_: Wrappers.Result + out3_: Wrappers.Result + out3_ = ((d_2_test_).client).Decrypt(d_7_input_) + d_8_result_ = out3_ + source0_ = (d_2_test_).vector + with _dafny.label("match0"): + if True: + if source0_.is_PositiveDecryptTestVector: + output = ((d_8_result_).is_Success) and ((((d_8_result_).value).plaintext) == (d_5_plaintext_)) + raise _dafny.Break("match0") + if True: + if source0_.is_NegativeDecryptTestVector: + output = (True) and ((d_8_result_).is_Failure) + raise _dafny.Break("match0") + if True: + output = ((d_8_result_).is_Success) and ((((d_8_result_).value).plaintext) == (d_5_plaintext_)) + pass + if not(output): + if ((((d_2_test_).vector).is_PositiveDecryptTestVector) or (((d_2_test_).vector).is_PositiveV1OrV2DecryptTestVector)) and ((d_8_result_).is_Failure): + _dafny.print(_dafny.string_of((d_8_result_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + if (((d_8_result_).error).is_AwsCryptographyMaterialProviders) and ((((d_8_result_).error).AwsCryptographyMaterialProviders).is_CollectionOfErrors): + _dafny.print(_dafny.string_of(_dafny.Seq("list:"))) + _dafny.print(_dafny.string_of((((d_8_result_).error).AwsCryptographyMaterialProviders).list)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + return output + + @staticmethod + def DecryptVectorToDecryptTest(keys, vector): + output: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_0_valueOrError0_ = Wrappers.default__.Need(not((vector).is_NegativeDecryptTestVector), AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Negative Test Vectors not supported at this time"))) + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_valueOrError1_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorCmm(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorCmmInput_TestVectorCmmInput((vector).decryptDescriptions, AwsCryptographyMaterialProvidersTestVectorKeysTypes.CmmOperation_DECRYPT())) + d_1_valueOrError1_ = out0_ + if (d_1_valueOrError1_).IsFailure(): + output = (d_1_valueOrError1_).PropagateFailure() + return output + d_2_cmm_: AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + d_2_cmm_ = (d_1_valueOrError1_).Extract() + d_3_commitmentPolicy_: AwsCryptographyMaterialProvidersTypes.CommitmentPolicy + if ((vector).algorithmSuiteId).is_Some: + d_3_commitmentPolicy_ = AllAlgorithmSuites.default__.GetCompatibleCommitmentPolicy(((vector).algorithmSuiteId).value) + elif True: + d_3_commitmentPolicy_ = AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT()) + d_4_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_4_valueOrError2_ = Wrappers.default__.Need((d_3_commitmentPolicy_).is_ESDK, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Compatible commitment policy is not for ESDK"))) + if (d_4_valueOrError2_).IsFailure(): + output = (d_4_valueOrError2_).PropagateFailure() + return output + d_5_config_: AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig + d_5_config_ = WrappedESDK.default__.WrappedAwsEncryptionSdkConfigWithSuppliedCommitment((d_3_commitmentPolicy_).ESDK) + d_6_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedESDK.default__.WrappedESDK(d_5_config_) + d_6_valueOrError3_ = out1_ + if not(not((d_6_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(281,18): " + _dafny.string_of(d_6_valueOrError3_)) + d_7_client_: AwsCryptographyEncryptionSdkTypes.IAwsEncryptionSdkClient + d_7_client_ = (d_6_valueOrError3_).Extract() + d_8_test_: DecryptTest + d_8_test_ = DecryptTest_DecryptTest(d_2_cmm_, d_7_client_, vector) + output = Wrappers.Result_Success(d_8_test_) + return output + + @staticmethod + def TestEncrypt(plaintexts, keys, test): + output: Wrappers.Result = Wrappers.Result.default(EncryptTestOutput.default())() + d_0_id_: _dafny.Seq + d_0_id_ = AllAlgorithmSuites.default__.ToHex((((test).vector).algorithmSuiteId).value) + _dafny.print(_dafny.string_of(_dafny.Seq("\nTEST-ENCRYPT===> "))) + _dafny.print(_dafny.string_of((((test).vector).id).value)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(d_0_id_)) + _dafny.print(_dafny.string_of(_dafny.Seq(" "))) + _dafny.print(_dafny.string_of(((test).vector).description)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + d_1_vector_: EsdkEncryptTestVector + d_1_vector_ = (test).vector + if not((((test).vector).plaintextPath) in (plaintexts)): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(324,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + d_2_plaintext_: _dafny.Seq + d_2_plaintext_ = (plaintexts)[((test).vector).plaintextPath] + d_3_frameLength_: Wrappers.Option + d_3_frameLength_ = (d_1_vector_).frameLength + d_4_input_: AwsCryptographyEncryptionSdkTypes.EncryptInput + d_4_input_ = AwsCryptographyEncryptionSdkTypes.EncryptInput_EncryptInput(d_2_plaintext_, ((test).vector).encryptionContext, Wrappers.Option_Some((test).cmm), Wrappers.Option_None(), Wrappers.Option_Some((((((test).vector).algorithmSuiteId).value).id).ESDK), d_3_frameLength_) + d_5_result_: Wrappers.Result + out0_: Wrappers.Result + out0_ = ((test).client).Encrypt(d_4_input_) + d_5_result_ = out0_ + if ((d_5_result_).is_Success) and ((((test).vector).is_PositiveEncryptTestVector) or (((test).vector).is_PositiveEncryptNegativeDecryptTestVector)): + d_6_valueOrError0_: Wrappers.Result = Wrappers.Result.default(EsdkDecryptTestVector.default())() + out1_: Wrappers.Result + out1_ = default__.EncryptTestToDecryptVector(test, (d_5_result_).value) + d_6_valueOrError0_ = out1_ + if (d_6_valueOrError0_).IsFailure(): + output = (d_6_valueOrError0_).PropagateFailure() + return output + d_7_decryptVector_: EsdkDecryptTestVector + d_7_decryptVector_ = (d_6_valueOrError0_).Extract() + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(True, Wrappers.Option_Some(d_7_decryptVector_))) + elif ((d_5_result_).is_Failure) and (((test).vector).is_NegativeEncryptTestVector): + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(True, Wrappers.Option_None())) + elif True: + output = Wrappers.Result_Success(EncryptTestOutput_EncryptTestOutput(False, Wrappers.Option_None())) + if (not(((test).vector).is_NegativeEncryptTestVector)) and ((d_5_result_).is_Failure): + _dafny.print(_dafny.string_of((d_5_result_).error)) + _dafny.print(_dafny.string_of(_dafny.Seq("\nFAILED! <-----------\n"))) + return output + + @staticmethod + def EncryptVectorToEncryptTest(keys, vector): + output: Wrappers.Result = None + d_0_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorCmm(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorCmmInput_TestVectorCmmInput(((vector).encryptDescriptions if (vector).is_PositiveEncryptTestVector else ((vector).encryptDescriptions if (vector).is_PositiveEncryptNegativeDecryptTestVector else (vector).encryptDescriptions)), AwsCryptographyMaterialProvidersTestVectorKeysTypes.CmmOperation_ENCRYPT())) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_cmm_: AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + d_1_cmm_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_2_valueOrError1_ = Wrappers.default__.Need(((vector).algorithmSuiteId).is_Some, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Missing AlgorithmSuiteId in test vector"))) + if (d_2_valueOrError1_).IsFailure(): + output = (d_2_valueOrError1_).PropagateFailure() + return output + d_3_commitmentPolicy_: AwsCryptographyMaterialProvidersTypes.CommitmentPolicy + d_3_commitmentPolicy_ = AllAlgorithmSuites.default__.GetCompatibleCommitmentPolicy(((vector).algorithmSuiteId).value) + d_4_valueOrError2_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_4_valueOrError2_ = Wrappers.default__.Need((d_3_commitmentPolicy_).is_ESDK, AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Compatible commitment policy is not for ESDK"))) + if (d_4_valueOrError2_).IsFailure(): + output = (d_4_valueOrError2_).PropagateFailure() + return output + d_5_config_: AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig + d_5_config_ = WrappedESDK.default__.WrappedAwsEncryptionSdkConfigWithSuppliedCommitment((d_3_commitmentPolicy_).ESDK) + d_6_valueOrError3_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedESDK.default__.WrappedESDK(d_5_config_) + d_6_valueOrError3_ = out1_ + if not(not((d_6_valueOrError3_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(397,18): " + _dafny.string_of(d_6_valueOrError3_)) + d_7_client_: AwsCryptographyEncryptionSdkTypes.IAwsEncryptionSdkClient + d_7_client_ = (d_6_valueOrError3_).Extract() + d_8_test_: EncryptTest + d_8_test_ = EncryptTest_EncryptTest(d_1_cmm_, d_7_client_, vector) + output = Wrappers.Result_Success(d_8_test_) + return output + + @staticmethod + def EncryptTestToDecryptVector(test, result): + output: Wrappers.Result = Wrappers.Result.default(EsdkDecryptTestVector.default())() + source0_ = (test).vector + with _dafny.label("match0"): + if True: + if source0_.is_PositiveEncryptTestVector: + output = Wrappers.Result_Success(EsdkDecryptTestVector_PositiveDecryptTestVector((((test).vector).id).value, 3, ((test).vector).decryptManifestPath, default__.ciphertextPathPathRoot, (default__.plaintextPathRoot) + (((test).vector).plaintextPath), ((test).vector).reproducedEncryptionContext, ((test).vector).decryptDescriptions, ((test).vector).commitmentPolicy, ((test).vector).frameLength, ((test).vector).algorithmSuiteId, ((test).vector).description, DecryptionMethod_OneShot())) + raise _dafny.Break("match0") + if True: + output = Wrappers.Result_Failure(_dafny.Seq("Only postive tests supported")) + pass + d_0_decryptManifestCiphertext_: _dafny.Seq + d_0_decryptManifestCiphertext_ = ((((test).vector).decryptManifestPath) + (default__.ciphertextPathPathRoot)) + ((((test).vector).id).value) + d_1_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out0_: Wrappers.Result + out0_ = default__.WriteVectorsFile(d_0_decryptManifestCiphertext_, (result).ciphertext) + d_1_valueOrError0_ = out0_ + if not(not((d_1_valueOrError0_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(439,13): " + _dafny.string_of(d_1_valueOrError0_)) + d_2___v52_: tuple + d_2___v52_ = (d_1_valueOrError0_).Extract() + return output + + @staticmethod + def MplPrintErr(e): + hresult_: tuple = () + _dafny.print(_dafny.string_of(e)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def MplVectorPrintErr(e): + hresult_: tuple = () + _dafny.print(_dafny.string_of(e)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def KeyDescriptionToCmm(keys, keyDescriptions): + output: Wrappers.Result = None + d_0_keyringList_: _dafny.Seq + d_0_keyringList_ = _dafny.Seq([]) + hi0_ = len(keyDescriptions) + for d_1_i_ in range(0, hi0_): + d_2_keyDescription_: AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription + d_2_keyDescription_ = (keyDescriptions)[d_1_i_] + d_3_valueOrError0_: Wrappers.Result = None + out0_: Wrappers.Result + out0_ = (keys).CreateWrappedTestVectorKeyring(AwsCryptographyMaterialProvidersTestVectorKeysTypes.TestVectorKeyringInput_TestVectorKeyringInput(d_2_keyDescription_)) + d_3_valueOrError0_ = out0_ + if (d_3_valueOrError0_).IsFailure(): + output = (d_3_valueOrError0_).PropagateFailure() + return output + d_4_keyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_4_keyring_ = (d_3_valueOrError0_).Extract() + d_0_keyringList_ = (d_0_keyringList_) + (_dafny.Seq([d_4_keyring_])) + d_5_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_5_valueOrError1_ = Wrappers.default__.Need((len(d_0_keyringList_)) == (1), AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_KeyVectorException(_dafny.Seq("Failed to create any keyrings"))) + if (d_5_valueOrError1_).IsFailure(): + output = (d_5_valueOrError1_).PropagateFailure() + return output + d_6_valueOrError2_: Wrappers.Result = None + out1_: Wrappers.Result + out1_ = WrappedMaterialProviders.default__.WrappedMaterialProviders(WrappedMaterialProviders.default__.WrappedDefaultMaterialProvidersConfig()) + d_6_valueOrError2_ = out1_ + if not(not((d_6_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/EsdkTestVectors.dfy(482,15): " + _dafny.string_of(d_6_valueOrError2_)) + d_7_mpl_: AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient + d_7_mpl_ = (d_6_valueOrError2_).Extract() + d_8_generatorKeyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_8_generatorKeyring_ = (d_0_keyringList_)[0] + d_9_maybeMultiKeyring_: Wrappers.Result + out2_: Wrappers.Result + out2_ = (d_7_mpl_).CreateMultiKeyring(AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput_CreateMultiKeyringInput(Wrappers.Option_Some(d_8_generatorKeyring_), _dafny.Seq((d_0_keyringList_)[1::]))) + d_9_maybeMultiKeyring_ = out2_ + d_10_valueOrError3_: Wrappers.Result = None + def lambda0_(d_11_e_): + return AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_AwsCryptographyMaterialProviders(d_11_e_) + + d_10_valueOrError3_ = (d_9_maybeMultiKeyring_).MapFailure(lambda0_) + if (d_10_valueOrError3_).IsFailure(): + output = (d_10_valueOrError3_).PropagateFailure() + return output + d_12_keyring_: AwsCryptographyMaterialProvidersTypes.IKeyring + d_12_keyring_ = (d_10_valueOrError3_).Extract() + d_13_maybeCmm_: Wrappers.Result + out3_: Wrappers.Result + out3_ = (d_7_mpl_).CreateDefaultCryptographicMaterialsManager(AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput((d_9_maybeMultiKeyring_).value)) + d_13_maybeCmm_ = out3_ + def lambda1_(d_14_e_): + return AwsCryptographyMaterialProvidersTestVectorKeysTypes.Error_AwsCryptographyMaterialProviders(d_14_e_) + + output = (d_13_maybeCmm_).MapFailure(lambda1_) + return output + + @staticmethod + def ReadVectorsFile(location): + output: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out0_: Wrappers.Result + out0_ = FileIO.default__.ReadBytesFromFile(location) + d_0_valueOrError0_ = out0_ + if (d_0_valueOrError0_).IsFailure(): + output = (d_0_valueOrError0_).PropagateFailure() + return output + d_1_fileBv_: _dafny.Seq + d_1_fileBv_ = (d_0_valueOrError0_).Extract() + output = Wrappers.Result_Success(JSONHelpers.default__.BvToBytes(d_1_fileBv_)) + return output + + @staticmethod + def WriteVectorsFile(location, bytes): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_bv_: _dafny.Seq + d_0_bv_ = JSONHelpers.default__.BytesBv(bytes) + out0_: Wrappers.Result + out0_ = FileIO.default__.WriteBytesToFile(location, d_0_bv_) + output = out0_ + return output + + @_dafny.classproperty + def ciphertextPathPathRoot(instance): + return _dafny.Seq("ciphertexts/") + @_dafny.classproperty + def plaintextPathRoot(instance): + return _dafny.Seq("plaintexts/") + +class EncryptTest: + @classmethod + def default(cls, ): + return lambda: EncryptTest_EncryptTest(None, None, EsdkEncryptTestVector.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_EncryptTest(self) -> bool: + return isinstance(self, EncryptTest_EncryptTest) + +class EncryptTest_EncryptTest(EncryptTest, NamedTuple('EncryptTest', [('cmm', Any), ('client', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EncryptTest.EncryptTest({_dafny.string_of(self.cmm)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EncryptTest_EncryptTest) and self.cmm == __o.cmm and self.client == __o.client and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + + +class DecryptTest: + @classmethod + def default(cls, ): + return lambda: DecryptTest_DecryptTest(None, None, EsdkDecryptTestVector.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_DecryptTest(self) -> bool: + return isinstance(self, DecryptTest_DecryptTest) + +class DecryptTest_DecryptTest(DecryptTest, NamedTuple('DecryptTest', [('cmm', Any), ('client', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptTest.DecryptTest({_dafny.string_of(self.cmm)}, {_dafny.string_of(self.client)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptTest_DecryptTest) and self.cmm == __o.cmm and self.client == __o.client and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + + +class SupportedGenerateManifestVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 4 + def _Is(source__): + d_0_v_: int = source__ + if System_.nat._Is(d_0_v_): + return default__.SupportedGenerateManifestVersion_q(d_0_v_) + return False + +class SupportedEncryptVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 1 + def _Is(source__): + d_1_v_: int = source__ + if System_.nat._Is(d_1_v_): + return default__.SupportedEncryptVersion_q(d_1_v_) + return False + +class EsdkEncryptTestVector: + @classmethod + def default(cls, ): + return lambda: EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option.default()(), SupportedEncryptVersion.default(), _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), _dafny.Seq(""), Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_PositiveEncryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_PositiveEncryptTestVector) + @property + def is_PositiveEncryptNegativeDecryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector) + @property + def is_NegativeEncryptTestVector(self) -> bool: + return isinstance(self, EsdkEncryptTestVector_NegativeEncryptTestVector) + +class EsdkEncryptTestVector_PositiveEncryptTestVector(EsdkEncryptTestVector, NamedTuple('PositiveEncryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('decryptManifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('decryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.PositiveEncryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.decryptManifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_PositiveEncryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.decryptManifestPath == __o.decryptManifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.decryptDescriptions == __o.decryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + +class EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector(EsdkEncryptTestVector, NamedTuple('PositiveEncryptNegativeDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('decryptManifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('decryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('decryptErrorDescription', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.PositiveEncryptNegativeDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.decryptManifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.decryptErrorDescription)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_PositiveEncryptNegativeDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.decryptManifestPath == __o.decryptManifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.decryptDescriptions == __o.decryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.decryptErrorDescription == __o.decryptErrorDescription and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + +class EsdkEncryptTestVector_NegativeEncryptTestVector(EsdkEncryptTestVector, NamedTuple('NegativeEncryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('plaintextPath', Any), ('encryptDescriptions', Any), ('encryptionContext', Any), ('reproducedEncryptionContext', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('errorDescription', Any), ('description', Any), ('maxEncryptedDataKeys', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkEncryptTestVector.NegativeEncryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.encryptDescriptions)}, {_dafny.string_of(self.encryptionContext)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.errorDescription)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.maxEncryptedDataKeys)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkEncryptTestVector_NegativeEncryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.plaintextPath == __o.plaintextPath and self.encryptDescriptions == __o.encryptDescriptions and self.encryptionContext == __o.encryptionContext and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.errorDescription == __o.errorDescription and self.description == __o.description and self.maxEncryptedDataKeys == __o.maxEncryptedDataKeys + def __hash__(self) -> int: + return super().__hash__() + + +class SupportedDecryptVersion: + def __init__(self): + pass + + @staticmethod + def default(): + return 1 + def _Is(source__): + d_2_v_: int = source__ + if System_.nat._Is(d_2_v_): + return default__.SupportedDecryptVersion_q(d_2_v_) + return False + +class EsdkDecryptTestVector: + @classmethod + def default(cls, ): + return lambda: EsdkDecryptTestVector_PositiveDecryptTestVector(_dafny.Seq(""), SupportedDecryptVersion.default(), _dafny.Seq(""), _dafny.Seq(""), _dafny.Seq(""), Wrappers.Option.default()(), AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription.default()(), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.default()(), Wrappers.Option.default()(), Wrappers.Option.default()(), _dafny.Seq(""), DecryptionMethod.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_PositiveDecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_PositiveDecryptTestVector) + @property + def is_NegativeDecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_NegativeDecryptTestVector) + @property + def is_PositiveV1OrV2DecryptTestVector(self) -> bool: + return isinstance(self, EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector) + +class EsdkDecryptTestVector_PositiveDecryptTestVector(EsdkDecryptTestVector, NamedTuple('PositiveDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('plaintextPath', Any), ('reproducedEncryptionContext', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.PositiveDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_PositiveDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.plaintextPath == __o.plaintextPath and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + +class EsdkDecryptTestVector_NegativeDecryptTestVector(EsdkDecryptTestVector, NamedTuple('NegativeDecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('errorDescription', Any), ('reproducedEncryptionContext', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.NegativeDecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.errorDescription)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_NegativeDecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.errorDescription == __o.errorDescription and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + +class EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(EsdkDecryptTestVector, NamedTuple('PositiveV1OrV2DecryptTestVector', [('id', Any), ('version', Any), ('manifestPath', Any), ('ciphertextPath', Any), ('plaintextPath', Any), ('reproducedEncryptionContext', Any), ('requiredEncryptionContextKeys', Any), ('decryptDescriptions', Any), ('commitmentPolicy', Any), ('frameLength', Any), ('algorithmSuiteId', Any), ('description', Any), ('decryptionMethod', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EsdkDecryptTestVector.PositiveV1OrV2DecryptTestVector({_dafny.string_of(self.id)}, {_dafny.string_of(self.version)}, {_dafny.string_of(self.manifestPath)}, {_dafny.string_of(self.ciphertextPath)}, {_dafny.string_of(self.plaintextPath)}, {_dafny.string_of(self.reproducedEncryptionContext)}, {_dafny.string_of(self.requiredEncryptionContextKeys)}, {_dafny.string_of(self.decryptDescriptions)}, {_dafny.string_of(self.commitmentPolicy)}, {_dafny.string_of(self.frameLength)}, {_dafny.string_of(self.algorithmSuiteId)}, {_dafny.string_of(self.description)}, {_dafny.string_of(self.decryptionMethod)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector) and self.id == __o.id and self.version == __o.version and self.manifestPath == __o.manifestPath and self.ciphertextPath == __o.ciphertextPath and self.plaintextPath == __o.plaintextPath and self.reproducedEncryptionContext == __o.reproducedEncryptionContext and self.requiredEncryptionContextKeys == __o.requiredEncryptionContextKeys and self.decryptDescriptions == __o.decryptDescriptions and self.commitmentPolicy == __o.commitmentPolicy and self.frameLength == __o.frameLength and self.algorithmSuiteId == __o.algorithmSuiteId and self.description == __o.description and self.decryptionMethod == __o.decryptionMethod + def __hash__(self) -> int: + return super().__hash__() + + +class DecryptionMethod: + @_dafny.classproperty + def AllSingletonConstructors(cls): + return [DecryptionMethod_StreamingUnsignedOnly(), DecryptionMethod_OneShot()] + @classmethod + def default(cls, ): + return lambda: DecryptionMethod_StreamingUnsignedOnly() + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_StreamingUnsignedOnly(self) -> bool: + return isinstance(self, DecryptionMethod_StreamingUnsignedOnly) + @property + def is_OneShot(self) -> bool: + return isinstance(self, DecryptionMethod_OneShot) + +class DecryptionMethod_StreamingUnsignedOnly(DecryptionMethod, NamedTuple('StreamingUnsignedOnly', [])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptionMethod.StreamingUnsignedOnly' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptionMethod_StreamingUnsignedOnly) + def __hash__(self) -> int: + return super().__hash__() + +class DecryptionMethod_OneShot(DecryptionMethod, NamedTuple('OneShot', [])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.DecryptionMethod.OneShot' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, DecryptionMethod_OneShot) + def __hash__(self) -> int: + return super().__hash__() + + +class EncryptTestOutput: + @classmethod + def default(cls, ): + return lambda: EncryptTestOutput_EncryptTestOutput(False, Wrappers.Option.default()()) + def __ne__(self, __o: object) -> bool: + return not self.__eq__(__o) + @property + def is_EncryptTestOutput(self) -> bool: + return isinstance(self, EncryptTestOutput_EncryptTestOutput) + +class EncryptTestOutput_EncryptTestOutput(EncryptTestOutput, NamedTuple('EncryptTestOutput', [('output', Any), ('vector', Any)])): + def __dafnystr__(self) -> str: + return f'EsdkTestVectors.EncryptTestOutput.EncryptTestOutput({_dafny.string_of(self.output)}, {_dafny.string_of(self.vector)})' + def __eq__(self, __o: object) -> bool: + return isinstance(__o, EncryptTestOutput_EncryptTestOutput) and self.output == __o.output and self.vector == __o.vector + def __hash__(self) -> int: + return super().__hash__() + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/ParseEsdkJsonManifest.py b/TestVectors/runtimes/python/src/internaldafny/generated/ParseEsdkJsonManifest.py new file mode 100644 index 000000000..364875e05 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/ParseEsdkJsonManifest.py @@ -0,0 +1,629 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import .internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import .internaldafny.generated.WriteVectors as WriteVectors + +# Module: ParseEsdkJsonManifest + +class default__: + def __init__(self): + pass + + @staticmethod + def BuildDecryptTestVector(op, version, keys, obj): + hresult_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_i_: int + d_0_i_ = len(obj) + d_1_vectors_: _dafny.Seq + d_1_vectors_ = _dafny.Seq([]) + while (d_0_i_) != (0): + d_0_i_ = (d_0_i_) - (1) + d_2_test_: Wrappers.Result + d_2_test_ = default__.ToDecryptTestVectors(op, version, keys, ((obj)[d_0_i_])[0], ((obj)[d_0_i_])[1]) + if ((d_2_test_).is_Failure) and (((d_2_test_).error) != (default__.negativeTestVectorFound)): + hresult_ = Wrappers.Result_Failure(default__.buildTestVectorError) + return hresult_ + if (d_2_test_).is_Success: + d_1_vectors_ = (_dafny.Seq([(d_2_test_).value])) + (d_1_vectors_) + if ((d_2_test_).is_Failure) and (((d_2_test_).error) == (default__.negativeTestVectorFound)): + d_1_vectors_ = d_1_vectors_ + hresult_ = Wrappers.Result_Success(d_1_vectors_) + return hresult_ + return hresult_ + + @staticmethod + def ToDecryptTestVectors(op, version, keys, name, json): + d_0_valueOrError0_ = Wrappers.default__.Need((json).is_Object, _dafny.Seq("Vector is not an object")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_obj_ = (json).obj + source0_ = version + if True: + if (source0_) == (3): + d_2_valueOrError1_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + return default__.V3ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + if (source0_) == (2): + d_3_valueOrError2_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_3_valueOrError2_).IsFailure(): + return (d_3_valueOrError2_).PropagateFailure() + elif True: + return default__.V2ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + if (source0_) == (1): + d_4_valueOrError3_ = Wrappers.default__.Need((op).is_Decrypt, _dafny.Seq("Err parsing manifest expected Decrypt")) + if (d_4_valueOrError3_).IsFailure(): + return (d_4_valueOrError3_).PropagateFailure() + elif True: + return default__.V1ToDecryptTestVector(op, keys, name, d_1_obj_, version) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Version not supported\n")) + + @staticmethod + def BuildEncryptTestVector(op, version, keys, obj): + hresult_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_0_i_: int + d_0_i_ = len(obj) + d_1_vectors_: _dafny.Seq + d_1_vectors_ = _dafny.Seq([]) + while (d_0_i_) != (0): + d_0_i_ = (d_0_i_) - (1) + d_2_test_: Wrappers.Result + d_2_test_ = default__.ToEncryptTestVector(op, version, keys, ((obj)[d_0_i_])[0], ((obj)[d_0_i_])[1]) + if (d_2_test_).is_Failure: + hresult_ = Wrappers.Result_Failure((d_2_test_).error) + return hresult_ + d_1_vectors_ = (_dafny.Seq([(d_2_test_).value])) + (d_1_vectors_) + hresult_ = Wrappers.Result_Success(d_1_vectors_) + return hresult_ + return hresult_ + + @staticmethod + def ToEncryptTestVector(op, version, keys, name, json): + d_0_valueOrError0_ = Wrappers.default__.Need((json).is_Object, _dafny.Seq("EncryptTestVector not an object")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_obj_ = (json).obj + source0_ = version + if True: + if (source0_) == (5): + return default__.V5ToEncryptTestVector(op, keys, name, d_1_obj_, version) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Version not supported")) + + @staticmethod + def V5ToEncryptTestVector(op, keys, name, obj, version): + d_0_scenarioString_ = _dafny.Seq("encryption-scenario") + d_1_valueOrError0_ = JSONHelpers.default__.GetObject(d_0_scenarioString_, obj) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + d_2_scenario_ = (d_1_valueOrError0_).Extract() + d_3_typeString_ = _dafny.Seq("type") + d_4_valueOrError1_ = JSONHelpers.default__.GetString(d_3_typeString_, d_2_scenario_) + if (d_4_valueOrError1_).IsFailure(): + return (d_4_valueOrError1_).PropagateFailure() + elif True: + d_5_typ_ = (d_4_valueOrError1_).Extract() + d_6_valueOrError2_ = JSONHelpers.default__.GetString(default__.plaintextJsonKey, d_2_scenario_) + if (d_6_valueOrError2_).IsFailure(): + return (d_6_valueOrError2_).PropagateFailure() + elif True: + d_7_plaintextLoc_ = (d_6_valueOrError2_).Extract() + d_8_valueOrError3_ = ParseJsonManifests.default__.GetAlgorithmSuiteInfo(d_2_scenario_) + if (d_8_valueOrError3_).IsFailure(): + return (d_8_valueOrError3_).PropagateFailure() + elif True: + d_9_algorithmSuite_ = (d_8_valueOrError3_).Extract() + d_10_valueOrError4_ = Wrappers.default__.Need(((d_9_algorithmSuite_).id).is_ESDK, _dafny.Seq("Unsupported algorithmSuiteId")) + if (d_10_valueOrError4_).IsFailure(): + return (d_10_valueOrError4_).PropagateFailure() + elif True: + d_11_valueOrError5_ = JSONHelpers.default__.GetOptionalPositiveLong(default__.frameSizeJsonKey, d_2_scenario_) + if (d_11_valueOrError5_).IsFailure(): + return (d_11_valueOrError5_).PropagateFailure() + elif True: + d_12_frameLength_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.encryptionContextJsonKey, d_2_scenario_) + if (d_13_valueOrError6_).IsFailure(): + return (d_13_valueOrError6_).PropagateFailure() + elif True: + d_14_encryptionContextStrings_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_ = JSONHelpers.default__.utf8EncodeMap(d_14_encryptionContextStrings_) + if (d_15_valueOrError7_).IsFailure(): + return (d_15_valueOrError7_).PropagateFailure() + elif True: + d_16_encryptionContext_ = (d_15_valueOrError7_).Extract() + d_17_valueOrError8_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.reproducedEncryptionContextJsonKey, d_2_scenario_) + if (d_17_valueOrError8_).IsFailure(): + return (d_17_valueOrError8_).PropagateFailure() + elif True: + d_18_reproducedEncryptionContextString_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_ = JSONHelpers.default__.utf8EncodeMap(d_18_reproducedEncryptionContextString_) + if (d_19_valueOrError9_).IsFailure(): + return (d_19_valueOrError9_).PropagateFailure() + elif True: + d_20_reproducedEncryptionContext_ = (d_19_valueOrError9_).Extract() + d_21_valueOrError10_ = JSONHelpers.default__.GetString(_dafny.Seq("description"), d_2_scenario_) + if (d_21_valueOrError10_).IsFailure(): + return (d_21_valueOrError10_).PropagateFailure() + elif True: + d_22_description_ = (d_21_valueOrError10_).Extract() + source0_ = d_5_typ_ + if True: + if (source0_) == (_dafny.Seq("positive-esdk")): + d_23_valueOrError11_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.encryptKeyDescription, d_2_scenario_) + if (d_23_valueOrError11_).IsFailure(): + return (d_23_valueOrError11_).PropagateFailure() + elif True: + d_24_encryptKeyDescription_ = (d_23_valueOrError11_).Extract() + d_25_valueOrError12_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.decryptKeyDescription, d_2_scenario_) + if (d_25_valueOrError12_).IsFailure(): + return (d_25_valueOrError12_).PropagateFailure() + elif True: + d_26_decryptKeyDescription_ = (d_25_valueOrError12_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkEncryptTestVector_PositiveEncryptTestVector(Wrappers.Option_Some(name), version, (op).manifestPath, (op).decryptManifestOutput, d_7_plaintextLoc_, d_24_encryptKeyDescription_, d_26_decryptKeyDescription_, Wrappers.Option_Some(d_16_encryptionContext_), Wrappers.Option_Some(d_20_reproducedEncryptionContext_), AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), d_12_frameLength_, Wrappers.Option_Some(d_9_algorithmSuite_), d_22_description_, Wrappers.Option_Some(1))) + if True: + return Wrappers.Result_Failure((_dafny.Seq("Unsupported ESDK TestVector type: ")) + (d_5_typ_)) + + @staticmethod + def V1ToDecryptTestVector(op, keys, name, obj, version): + d_0_valueOrError0_ = JSONHelpers.default__.GetString(_dafny.Seq("plaintext"), obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_plaintextLoc_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_ = JSONHelpers.default__.GetString(_dafny.Seq("ciphertext"), obj) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_3_ciphertextLoc_ = (d_2_valueOrError1_).Extract() + d_4_valueOrError2_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_3_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_1_plaintextLoc_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_4_valueOrError2_).IsFailure(): + return (d_4_valueOrError2_).PropagateFailure() + elif True: + d_5_valueOrError3_ = JSONHelpers.default__.GetArray(_dafny.Seq("master-keys"), obj) + if (d_5_valueOrError3_).IsFailure(): + return (d_5_valueOrError3_).PropagateFailure() + elif True: + d_6_masterKeys_ = (d_5_valueOrError3_).Extract() + d_7_valueOrError4_ = default__.GetKeyDescriptions(d_6_masterKeys_, keys) + if (d_7_valueOrError4_).IsFailure(): + return (d_7_valueOrError4_).PropagateFailure() + elif True: + d_8_keyDescriptions_ = (d_7_valueOrError4_).Extract() + d_9_valueOrError5_ = default__.ToMultiKeyDescription(d_8_keyDescriptions_) + if (d_9_valueOrError5_).IsFailure(): + return (d_9_valueOrError5_).PropagateFailure() + elif True: + d_10_keyDescription_ = (d_9_valueOrError5_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_3_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_1_plaintextLoc_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_None(), Wrappers.Option_None(), d_10_keyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_None(), Wrappers.Option_None(), name, EsdkTestVectors.DecryptionMethod_OneShot())) + + @staticmethod + def V2ToDecryptTestVector(op, keys, name, obj, version): + d_0_valueOrError0_ = JSONHelpers.default__.GetObject(_dafny.Seq("result"), obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_resultLoc_ = (d_0_valueOrError0_).Extract() + d_2_errorLoc_q_ = JSONHelpers.default__.GetObject(_dafny.Seq("error"), d_1_resultLoc_) + if (d_2_errorLoc_q_).is_Success: + return Wrappers.Result_Failure(default__.negativeTestVectorFound) + elif True: + d_3_valueOrError1_ = JSONHelpers.default__.GetObject(_dafny.Seq("output"), d_1_resultLoc_) + if (d_3_valueOrError1_).IsFailure(): + return (d_3_valueOrError1_).PropagateFailure() + elif True: + d_4_outputLoc_ = (d_3_valueOrError1_).Extract() + d_5_valueOrError2_ = JSONHelpers.default__.GetString(_dafny.Seq("plaintext"), d_4_outputLoc_) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_plaintextLoc_ = (d_5_valueOrError2_).Extract() + d_7_valueOrError3_ = JSONHelpers.default__.GetString(_dafny.Seq("ciphertext"), obj) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_ciphertextLoc_ = (d_7_valueOrError3_).Extract() + d_9_valueOrError4_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_8_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_6_plaintextLoc_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_9_valueOrError4_).IsFailure(): + return (d_9_valueOrError4_).PropagateFailure() + elif True: + d_10_valueOrError5_ = JSONHelpers.default__.GetArray(_dafny.Seq("master-keys"), obj) + if (d_10_valueOrError5_).IsFailure(): + return (d_10_valueOrError5_).PropagateFailure() + elif True: + d_11_masterKeys_ = (d_10_valueOrError5_).Extract() + d_12_valueOrError6_ = default__.GetKeyDescriptions(d_11_masterKeys_, keys) + if (d_12_valueOrError6_).IsFailure(): + return (d_12_valueOrError6_).PropagateFailure() + elif True: + d_13_keyDescriptions_ = (d_12_valueOrError6_).Extract() + d_14_valueOrError7_ = default__.ToMultiKeyDescription(d_13_keyDescriptions_) + if (d_14_valueOrError7_).IsFailure(): + return (d_14_valueOrError7_).PropagateFailure() + elif True: + d_15_keyDescription_ = (d_14_valueOrError7_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveV1OrV2DecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_8_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_6_plaintextLoc_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_None(), Wrappers.Option_None(), d_15_keyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), Wrappers.Option_None(), Wrappers.Option_None(), name, EsdkTestVectors.DecryptionMethod_OneShot())) + + @staticmethod + def V3ToDecryptTestVector(op, keys, name, obj, version): + d_0_scenarioString_ = _dafny.Seq("decryption-scenario") + d_1_valueOrError0_ = JSONHelpers.default__.GetObject(d_0_scenarioString_, obj) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + d_2_scenario_ = (d_1_valueOrError0_).Extract() + d_3_typeString_ = _dafny.Seq("type") + d_4_valueOrError1_ = JSONHelpers.default__.GetString(d_3_typeString_, d_2_scenario_) + if (d_4_valueOrError1_).IsFailure(): + return (d_4_valueOrError1_).PropagateFailure() + elif True: + d_5_typ_ = (d_4_valueOrError1_).Extract() + d_6_valueOrError2_ = JSONHelpers.default__.GetString(default__.ciphertextJsonKey, d_2_scenario_) + if (d_6_valueOrError2_).IsFailure(): + return (d_6_valueOrError2_).PropagateFailure() + elif True: + d_7_ciphertextLoc_ = (d_6_valueOrError2_).Extract() + d_8_valueOrError3_ = ParseJsonManifests.default__.GetAlgorithmSuiteInfo(d_2_scenario_) + if (d_8_valueOrError3_).IsFailure(): + return (d_8_valueOrError3_).PropagateFailure() + elif True: + d_9_algorithmSuite_ = (d_8_valueOrError3_).Extract() + d_10_valueOrError4_ = Wrappers.default__.Need(((d_9_algorithmSuite_).id).is_ESDK, _dafny.Seq("Unsupported algorithmSuiteId")) + if (d_10_valueOrError4_).IsFailure(): + return (d_10_valueOrError4_).PropagateFailure() + elif True: + d_11_valueOrError5_ = JSONHelpers.default__.GetOptionalPositiveLong(default__.frameSizeJsonKey, d_2_scenario_) + if (d_11_valueOrError5_).IsFailure(): + return (d_11_valueOrError5_).PropagateFailure() + elif True: + d_12_frameLength_ = (d_11_valueOrError5_).Extract() + d_13_valueOrError6_ = JSONHelpers.default__.SmallObjectToStringStringMap(default__.reproducedEncryptionContextJsonKey, d_2_scenario_) + if (d_13_valueOrError6_).IsFailure(): + return (d_13_valueOrError6_).PropagateFailure() + elif True: + d_14_reproducedEncryptionContextStrings_ = (d_13_valueOrError6_).Extract() + d_15_valueOrError7_ = JSONHelpers.default__.utf8EncodeMap(d_14_reproducedEncryptionContextStrings_) + if (d_15_valueOrError7_).IsFailure(): + return (d_15_valueOrError7_).PropagateFailure() + elif True: + d_16_reproducedEncryptionContext_ = (d_15_valueOrError7_).Extract() + d_17_valueOrError8_ = JSONHelpers.default__.GetString(_dafny.Seq("description"), d_2_scenario_) + if (d_17_valueOrError8_).IsFailure(): + return (d_17_valueOrError8_).PropagateFailure() + elif True: + d_18_description_ = (d_17_valueOrError8_).Extract() + d_19_valueOrError9_ = JSONHelpers.default__.GetString(_dafny.Seq("result"), d_2_scenario_) + if (d_19_valueOrError9_).IsFailure(): + return (d_19_valueOrError9_).PropagateFailure() + elif True: + d_20_result_ = (d_19_valueOrError9_).Extract() + d_21_valueOrError10_ = Wrappers.default__.Need(((_dafny.Seq("file://")) < (d_7_ciphertextLoc_)) and ((_dafny.Seq("file://")) < (d_20_result_)), _dafny.Seq("Invalid file prefix in test vector")) + if (d_21_valueOrError10_).IsFailure(): + return (d_21_valueOrError10_).PropagateFailure() + elif True: + source0_ = d_5_typ_ + if True: + if (source0_) == (_dafny.Seq("positive-esdk")): + d_22_valueOrError11_ = ParseJsonManifests.default__.GetKeyDescription(keys, default__.decryptKeyDescription, d_2_scenario_) + if (d_22_valueOrError11_).IsFailure(): + return (d_22_valueOrError11_).PropagateFailure() + elif True: + d_23_decryptKeyDescription_ = (d_22_valueOrError11_).Extract() + return Wrappers.Result_Success(EsdkTestVectors.EsdkDecryptTestVector_PositiveDecryptTestVector(name, version, (op).manifestPath, _dafny.Seq((d_7_ciphertextLoc_)[len(default__.FILE__PREPEND)::]), _dafny.Seq((d_20_result_)[len(default__.FILE__PREPEND)::]), Wrappers.Option_Some(d_16_reproducedEncryptionContext_), d_23_decryptKeyDescription_, AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT(), d_12_frameLength_, Wrappers.Option_Some(d_9_algorithmSuite_), d_18_description_, EsdkTestVectors.DecryptionMethod_OneShot())) + if True: + return Wrappers.Result_Failure((_dafny.Seq("Unsupported ESDK TestVector type: ")) + (d_5_typ_)) + + @staticmethod + def GetKeyDescriptions(keyArray, keys): + if (len(keyArray)) == (0): + return Wrappers.Result_Success(_dafny.Seq([])) + elif True: + d_0_currKey_ = (keyArray)[0] + d_1_valueOrError0_ = Wrappers.default__.Need((d_0_currKey_).is_Object, _dafny.Seq("Not an object")) + if (d_1_valueOrError0_).IsFailure(): + return (d_1_valueOrError0_).PropagateFailure() + elif True: + def lambda0_(d_3_e_): + return (d_3_e_).ToString() + + d_2_valueOrError1_ = (JSON_API.default__.Serialize(d_0_currKey_)).MapFailure(lambda0_) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_4_encryptStr_ = (d_2_valueOrError1_).Extract() + d_5_valueOrError2_ = ((keys).GetKeyDescription(AwsCryptographyMaterialProvidersTestVectorKeysTypes.GetKeyDescriptionInput_GetKeyDescriptionInput(d_4_encryptStr_))).MapFailure(ParseJsonManifests.default__.ErrorToString) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_encryptDecryptKeyDescription_ = (d_5_valueOrError2_).Extract() + d_7_valueOrError3_ = default__.GetKeyDescriptions(_dafny.Seq((keyArray)[1::]), keys) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_tail_ = (d_7_valueOrError3_).Extract() + return Wrappers.Result_Success((_dafny.Seq([(d_6_encryptDecryptKeyDescription_).keyDescription])) + (d_8_tail_)) + + @staticmethod + def ToMultiKeyDescription(keyDescriptions): + if (len(keyDescriptions)) == (1): + return Wrappers.Result_Success((keyDescriptions)[0]) + elif True: + d_0_valueOrError0_ = Wrappers.default__.Need((len(keyDescriptions)) > (1), _dafny.Seq("Received invalid key description length")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(AwsCryptographyMaterialProvidersTestVectorKeysTypes.KeyDescription_Multi(AwsCryptographyMaterialProvidersTestVectorKeysTypes.MultiKeyring_MultiKeyring(Wrappers.Option_Some((keyDescriptions)[0]), _dafny.Seq((keyDescriptions)[1::])))) + + @staticmethod + def GetPath(key, obj): + d_0_valueOrError0_ = JSONHelpers.default__.GetString(key, obj) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_path_ = (d_0_valueOrError0_).Extract() + d_2_valueOrError1_ = Wrappers.default__.Need((default__.FILE__PREPEND) < (d_1_path_), _dafny.Seq("Received Invalid location for plaintext or ciphertext.")) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + return Wrappers.Result_Success(_dafny.Seq((d_1_path_)[len(default__.FILE__PREPEND)::])) + + @staticmethod + def Result_q(key): + return ((key) == (_dafny.Seq("output"))) or ((key) == (_dafny.Seq("error"))) + + @_dafny.classproperty + def ciphertextJsonKey(instance): + return _dafny.Seq("ciphertext") + @_dafny.classproperty + def frameSizeJsonKey(instance): + return _dafny.Seq("frame-size") + @_dafny.classproperty + def reproducedEncryptionContextJsonKey(instance): + return _dafny.Seq("reproduced-encryption-context") + @_dafny.classproperty + def decryptKeyDescription(instance): + return _dafny.Seq("decryptKeyDescription") + @_dafny.classproperty + def FILE__PREPEND(instance): + return _dafny.Seq("file://") + @_dafny.classproperty + def negativeTestVectorFound(instance): + return _dafny.Seq("Negative test vector found; not supported yet.") + @_dafny.classproperty + def buildTestVectorError(instance): + return _dafny.Seq("Error other than negative test vector found thrown") + @_dafny.classproperty + def plaintextJsonKey(instance): + return _dafny.Seq("plaintext") + @_dafny.classproperty + def encryptionContextJsonKey(instance): + return _dafny.Seq("encryption-context") + @_dafny.classproperty + def encryptKeyDescription(instance): + return _dafny.Seq("encryptKeyDescription") + @_dafny.classproperty + def masterKeysJsonKey(instance): + return _dafny.Seq("master-keys") + @_dafny.classproperty + def decryptionMethodJsonKey(instance): + return _dafny.Seq("decryption-method") diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDK.py b/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDK.py new file mode 100644 index 000000000..cb1a2e45b --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDK.py @@ -0,0 +1,229 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas + +# Module: WrappedESDK + +class default__: + def __init__(self): + pass + + @staticmethod + def WrappedDefaultAwsEncryptionSdkConfig(): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT()), Wrappers.Option_None(), Wrappers.Option_None()) + + @staticmethod + def WrappedAwsEncryptionSdkConfigWithSuppliedCommitment(commitmentPolicy): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(commitmentPolicy), Wrappers.Option_None(), Wrappers.Option_None()) + + @staticmethod + def WrappedAwsEncryptionSdkConfig(commitmentPolicy, maxEncryptedDataKeys, netV4__0__0__RetryPolicy): + return AwsCryptographyEncryptionSdkTypes.AwsEncryptionSdkConfig_AwsEncryptionSdkConfig(Wrappers.Option_Some(commitmentPolicy), Wrappers.Option_Some(maxEncryptedDataKeys), Wrappers.Option_Some(netV4__0__0__RetryPolicy)) + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDKMain.py b/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDKMain.py new file mode 100644 index 000000000..98095ea8b --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/WrappedESDKMain.py @@ -0,0 +1,346 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import .internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import .internaldafny.generated.WriteVectors as WriteVectors +import .internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import .internaldafny.generated.EsdkTestManifests as EsdkTestManifests + +# Module: WrappedESDKMain + +class default__: + def __init__(self): + pass + + @staticmethod + def Main2(args): + d_0_vectorOptions_: GetOpt.Options + d_0_vectorOptions_ = GetOpt.Options_Options(_dafny.Seq("test-vectors"), _dafny.Seq("?"), _dafny.Seq([GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("decrypt"), _dafny.Seq("decrypt command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("manifest-path"), _dafny.Seq("relative path to the location of the manifest"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("manifest-name"), _dafny.Seq("name of file that contains the decrypt vectors file"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("test-name"), _dafny.Seq("id of the test to run"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_UnusedOk(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())]))), GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("encrypt"), _dafny.Seq("encrypt command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("manifest-path"), _dafny.Seq("relative path to the location of the manifest"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("decrypt-manifest-path"), _dafny.Seq("relative path to the location where the decrypted manifest will be written to."), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No()), GetOpt.Param_Opt(_dafny.Seq("test-name"), _dafny.Seq("id of the test to run"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_UnusedOk(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())]))), GetOpt.Param_Command(GetOpt.Options_Options(_dafny.Seq("encrypt-manifest"), _dafny.Seq("encryp manifest command for test-vectors"), _dafny.Seq([GetOpt.Param_Opt(_dafny.Seq("encrypt-manifest-output"), _dafny.Seq("relative path of where to store the encrypt-manifest produced"), _dafny.Seq("arg"), GetOpt.default__.NullChar, GetOpt.Unused_Required(), False, GetOpt.Visibility_Normal(), _dafny.Seq([]), _dafny.Seq([]), GetOpt.Tri_No())])))])) + if not((0) < (len(args))): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(40,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + d_1_parsedOptions_q_: Wrappers.Result + d_1_parsedOptions_q_ = GetOpt.default__.GetOptions(d_0_vectorOptions_, args) + if (d_1_parsedOptions_q_).is_Success: + d_2_h_: Wrappers.Option + d_2_h_ = GetOpt.default__.NeedsHelp(d_0_vectorOptions_, (d_1_parsedOptions_q_).value, _dafny.Seq("")) + if (d_2_h_).is_Some: + _dafny.print(_dafny.string_of((d_2_h_).value)) + return + d_3_op_q_: Wrappers.Result + d_3_op_q_ = default__.ParseCommandLineOptions((d_1_parsedOptions_q_).value) + if (d_3_op_q_).is_Success: + d_4_op_: EsdkManifestOptions.ManifestOptions + d_4_op_ = (d_3_op_q_).value + source0_ = d_4_op_ + with _dafny.label("match0"): + if True: + if source0_.is_Decrypt: + d_5_result_: Wrappers.Result + out0_: Wrappers.Result + out0_ = EsdkTestManifests.default__.StartDecryptVectors(d_4_op_) + d_5_result_ = out0_ + if (d_5_result_).is_Failure: + _dafny.print(_dafny.string_of((d_5_result_).error)) + if not((d_5_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(59,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + raise _dafny.Break("match0") + if True: + if source0_.is_Encrypt: + d_6_result_: Wrappers.Result + out1_: Wrappers.Result + out1_ = EsdkTestManifests.default__.StartEncryptVectors(d_4_op_) + d_6_result_ = out1_ + if (d_6_result_).is_Failure: + _dafny.print(_dafny.string_of((d_6_result_).error)) + if not((d_6_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(65,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + raise _dafny.Break("match0") + if True: + d_7_result_: Wrappers.Result + out2_: Wrappers.Result + out2_ = WriteVectors.default__.WriteTestVectors(d_4_op_) + d_7_result_ = out2_ + if (d_7_result_).is_Failure: + _dafny.print(_dafny.string_of((d_7_result_).error)) + if not((d_7_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/src/Index.dfy(71,10): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + pass + elif True: + _dafny.print(_dafny.string_of(((d_3_op_q_).error) + (_dafny.Seq("\n")))) + _dafny.print(_dafny.string_of(_dafny.Seq("help\n"))) + elif True: + _dafny.print(_dafny.string_of(((d_1_parsedOptions_q_).error) + (_dafny.Seq("\n")))) + + @staticmethod + def ParseCommandLineOptions(parsedOptions): + d_0_valueOrError0_ = Wrappers.default__.Need(((parsedOptions).subcommand).is_Some, _dafny.Seq("Must supply subcommand\n")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + source0_ = (((parsedOptions).subcommand).value).command + if True: + if (source0_) == (_dafny.Seq("decrypt")): + return default__.ParseDecryptCmd((((parsedOptions).subcommand).value).params) + if True: + if (source0_) == (_dafny.Seq("encrypt")): + return default__.ParseEncryptCmd((((parsedOptions).subcommand).value).params) + if True: + if (source0_) == (_dafny.Seq("encrypt-manifest")): + return default__.ParseEncryptManifestCmd((((parsedOptions).subcommand).value).params) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Received unknown subcommand")) + + @staticmethod + def ParseDecryptCmd(params): + d_0_manifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-path")) + d_1_testName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("test-name")) + d_2_manifestFileName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-name")) + d_3_manifestPath_ = ((d_0_manifestPath_q_).value if (d_0_manifestPath_q_).is_Some else _dafny.Seq(".")) + d_4_valueOrError0_ = Wrappers.default__.Need((0) < (len(d_3_manifestPath_)), _dafny.Seq("Invalid manifest path length\n")) + if (d_4_valueOrError0_).IsFailure(): + return (d_4_valueOrError0_).PropagateFailure() + elif True: + d_5_valueOrError1_ = Wrappers.default__.Need((d_2_manifestFileName_q_).is_Some, _dafny.Seq("Must supply manifest file name")) + if (d_5_valueOrError1_).IsFailure(): + return (d_5_valueOrError1_).PropagateFailure() + elif True: + d_6_manifestFileName_ = (d_2_manifestFileName_q_).value + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_Decrypt((d_3_manifestPath_ if (Seq.default__.Last(d_3_manifestPath_)) == ('/') else (d_3_manifestPath_) + (_dafny.Seq("/"))), d_6_manifestFileName_, (d_1_testName_q_ if (d_1_testName_q_).is_Some else Wrappers.Option_None()))) + + @staticmethod + def ParseEncryptCmd(params): + d_0_manifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest-path")) + d_1_manifestName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("manifest")) + d_2_decryptManifestPath_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("decrypt-manifest-path")) + d_3_testName_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("test-name")) + d_4_manifestPath_ = ((d_0_manifestPath_q_).value if (d_0_manifestPath_q_).is_Some else _dafny.Seq(".")) + d_5_manifestName_ = ((d_1_manifestName_q_).value if (d_1_manifestName_q_).is_Some else _dafny.Seq("encrypt-manifest.json")) + d_6_decryptManifestPath_ = ((d_2_decryptManifestPath_q_).value if (d_2_decryptManifestPath_q_).is_Some else _dafny.Seq(".")) + d_7_valueOrError0_ = Wrappers.default__.Need(((0) < (len(d_4_manifestPath_))) and ((0) < (len(d_6_decryptManifestPath_))), _dafny.Seq("Invalid manifest or decrypt manifest path length\n")) + if (d_7_valueOrError0_).IsFailure(): + return (d_7_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_Encrypt((d_4_manifestPath_ if (Seq.default__.Last(d_4_manifestPath_)) == ('/') else (d_4_manifestPath_) + (_dafny.Seq("/"))), d_5_manifestName_, (d_6_decryptManifestPath_ if (Seq.default__.Last(d_6_decryptManifestPath_)) == ('/') else (d_6_decryptManifestPath_) + (_dafny.Seq("/"))), (d_3_testName_q_ if (d_3_testName_q_).is_Some else Wrappers.Option_None()))) + + @staticmethod + def ParseEncryptManifestCmd(params): + d_0_encryptManifestOutput_q_ = GetOpt.default__.OptValue(params, _dafny.Seq("encrypt-manifest-output")) + d_1_encryptManifestOutput_ = ((d_0_encryptManifestOutput_q_).value if (d_0_encryptManifestOutput_q_).is_Some else _dafny.Seq(".")) + d_2_valueOrError0_ = Wrappers.default__.Need((0) < (len(d_1_encryptManifestOutput_)), _dafny.Seq("Invalid encrypt manifest output length")) + if (d_2_valueOrError0_).IsFailure(): + return (d_2_valueOrError0_).PropagateFailure() + elif True: + return Wrappers.Result_Success(EsdkManifestOptions.ManifestOptions_EncryptManifest((d_1_encryptManifestOutput_ if (Seq.default__.Last(d_1_encryptManifestOutput_)) == ('/') else (d_1_encryptManifestOutput_) + (_dafny.Seq("/"))), 5)) + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/WriteEsdkJsonManifests.py b/TestVectors/runtimes/python/src/internaldafny/generated/WriteEsdkJsonManifests.py new file mode 100644 index 000000000..6a65a3f66 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/WriteEsdkJsonManifests.py @@ -0,0 +1,369 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc + +# Module: WriteEsdkJsonManifests + +class default__: + def __init__(self): + pass + + @staticmethod + def EncryptionContextKeysToJson(keys): + if (keys).is_Some: + def lambda0_(d_1_bytes_): + def iife0_(_pat_let0_0): + def iife1_(d_2_valueOrError1_): + def iife2_(_pat_let1_0): + def iife3_(d_3_key_): + return Wrappers.Result_Success(JSON_Values.JSON_String(d_3_key_)) + return iife3_(_pat_let1_0) + return ((d_2_valueOrError1_).PropagateFailure() if (d_2_valueOrError1_).IsFailure() else iife2_((d_2_valueOrError1_).Extract())) + return iife1_(_pat_let0_0) + return iife0_(UTF8.default__.Decode(d_1_bytes_)) + + d_0_valueOrError0_ = Seq.default__.MapWithResult(lambda0_, (keys).value) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_4_tmp_ = (d_0_valueOrError0_).Extract() + return Wrappers.Result_Success(_dafny.Seq([(_dafny.Seq("requiredEncryptionContextKeys"), JSON_Values.JSON_Array(d_4_tmp_))])) + elif True: + return Wrappers.Result_Success(_dafny.Seq([])) + + @staticmethod + def EncryptionContextToJson(key, m): + def lambda0_(d_1_a_, d_2_b_): + return (d_1_a_) < (d_2_b_) + + d_0_keys_ = SortedSets.default__.SetToOrderedSequence2((m).keys, lambda0_) + def lambda1_(d_4_m_): + def lambda2_(d_5_k_): + def iife0_(_pat_let2_0): + def iife1_(d_6_valueOrError1_): + def iife2_(_pat_let3_0): + def iife3_(d_7_key_): + def iife4_(_pat_let4_0): + def iife5_(d_8_valueOrError2_): + def iife6_(_pat_let5_0): + def iife7_(d_9_value_): + return Wrappers.Result_Success((d_7_key_, JSON_Values.JSON_String(d_9_value_))) + return iife7_(_pat_let5_0) + return ((d_8_valueOrError2_).PropagateFailure() if (d_8_valueOrError2_).IsFailure() else iife6_((d_8_valueOrError2_).Extract())) + return iife5_(_pat_let4_0) + return iife4_(UTF8.default__.Decode((d_4_m_)[d_5_k_])) + return iife3_(_pat_let3_0) + return ((d_6_valueOrError1_).PropagateFailure() if (d_6_valueOrError1_).IsFailure() else iife2_((d_6_valueOrError1_).Extract())) + return iife1_(_pat_let2_0) + return iife0_(UTF8.default__.Decode(d_5_k_)) + + return lambda2_ + + d_3_valueOrError0_ = Seq.default__.MapWithResult(lambda1_(m), d_0_keys_) + if (d_3_valueOrError0_).IsFailure(): + return (d_3_valueOrError0_).PropagateFailure() + elif True: + d_10_pairsBytes_ = (d_3_valueOrError0_).Extract() + return Wrappers.Result_Success(_dafny.Seq([(key, JSON_Values.JSON_Object(d_10_pairsBytes_))])) + + @staticmethod + def printJson(j): + hresult_: tuple = () + _dafny.print(_dafny.string_of(j)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + hresult_ = () + return hresult_ + return hresult_ + + @staticmethod + def EncryptTestVectorToJson(test): + d_0_valueOrError0_ = Wrappers.default__.Need((((test).algorithmSuiteId).is_Some) and (((test).frameLength).is_Some), _dafny.Seq("test is missing algorithmSuite ID, or frameLength")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_id_ = AllAlgorithmSuites.default__.ToHex(((test).algorithmSuiteId).value) + d_2_valueOrError1_ = (default__.EncryptionContextToJson(_dafny.Seq("encryption-context"), ((test).encryptionContext).value) if ((test).encryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("encryption-context"), _dafny.Map({}))) + if (d_2_valueOrError1_).IsFailure(): + return (d_2_valueOrError1_).PropagateFailure() + elif True: + d_3_encryptionContext_ = (d_2_valueOrError1_).Extract() + d_4_valueOrError2_ = Wrappers.default__.Need((len(d_3_encryptionContext_)) == (1), _dafny.Seq("Error parsing encryption context")) + if (d_4_valueOrError2_).IsFailure(): + return (d_4_valueOrError2_).PropagateFailure() + elif True: + d_5_valueOrError3_ = (default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), ((test).reproducedEncryptionContext).value) if ((test).reproducedEncryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), _dafny.Map({}))) + if (d_5_valueOrError3_).IsFailure(): + return (d_5_valueOrError3_).PropagateFailure() + elif True: + d_6_reproducedEncryptionContext_ = (d_5_valueOrError3_).Extract() + d_7_optionalValues_ = (d_3_encryptionContext_) + (d_6_reproducedEncryptionContext_) + source0_ = test + if True: + if source0_.is_PositiveEncryptTestVector: + d_8_valueOrError4_ = KeyDescription.default__.ToJson((test).encryptDescriptions, 3) + if (d_8_valueOrError4_).IsFailure(): + return (d_8_valueOrError4_).PropagateFailure() + elif True: + d_9_encrypt_ = (d_8_valueOrError4_).Extract() + d_10_valueOrError5_ = KeyDescription.default__.ToJson((test).decryptDescriptions, 3) + if (d_10_valueOrError5_).IsFailure(): + return (d_10_valueOrError5_).PropagateFailure() + elif True: + d_11_decrypt_ = (d_10_valueOrError5_).Extract() + d_12_scenario_ = JSON_Values.JSON_Object((_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("positive-esdk"))), (_dafny.Seq("plaintext"), JSON_Values.JSON_String(_dafny.Seq("small"))), (_dafny.Seq("description"), JSON_Values.JSON_String((test).description)), (_dafny.Seq("algorithmSuiteId"), JSON_Values.JSON_String(d_1_id_)), (_dafny.Seq("frame-size"), JSON_Values.JSON_Number(JSON_Values.default__.Int(((test).frameLength).value))), (_dafny.Seq("encryptKeyDescription"), d_9_encrypt_), (_dafny.Seq("decryptKeyDescription"), d_11_decrypt_)])) + (d_7_optionalValues_)) + return Wrappers.Result_Success(JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("encryption-scenario"), d_12_scenario_)]))) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only Positive Tests supported :(")) + + @staticmethod + def OptionalBytes(key, secret): + if (secret).is_Some: + d_0_base64_ = Base64.default__.Encode((secret).value) + return _dafny.Seq([(key, JSON_Values.JSON_String(d_0_base64_))]) + elif True: + return _dafny.Seq([]) + + @staticmethod + def DecryptTestVectorToJson(test): + d_0_valueOrError0_ = Wrappers.default__.Need((((test).algorithmSuiteId).is_Some) and (((test).frameLength).is_Some), _dafny.Seq("test is missing algorithmSuite ID, or frameLength")) + if (d_0_valueOrError0_).IsFailure(): + return (d_0_valueOrError0_).PropagateFailure() + elif True: + d_1_id_ = AllAlgorithmSuites.default__.ToHex(((test).algorithmSuiteId).value) + d_2_description_ = (((test).description) + (_dafny.Seq(" "))) + (d_1_id_) + d_3_valueOrError1_ = (default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), ((test).reproducedEncryptionContext).value) if ((test).reproducedEncryptionContext).is_Some else default__.EncryptionContextToJson(_dafny.Seq("reproduced-encryption-context"), _dafny.Map({}))) + if (d_3_valueOrError1_).IsFailure(): + return (d_3_valueOrError1_).PropagateFailure() + elif True: + d_4_reproducedEncryptionContext_ = (d_3_valueOrError1_).Extract() + d_5_valueOrError2_ = Wrappers.default__.Need((len(d_4_reproducedEncryptionContext_)) == (1), _dafny.Seq("Error parsing encryption context")) + if (d_5_valueOrError2_).IsFailure(): + return (d_5_valueOrError2_).PropagateFailure() + elif True: + d_6_optionalValues_ = d_4_reproducedEncryptionContext_ + source0_ = test + if True: + if source0_.is_PositiveDecryptTestVector: + d_7_valueOrError3_ = KeyDescription.default__.ToJson((test).decryptDescriptions, 3) + if (d_7_valueOrError3_).IsFailure(): + return (d_7_valueOrError3_).PropagateFailure() + elif True: + d_8_decrypt_ = (d_7_valueOrError3_).Extract() + d_9_scenario_ = JSON_Values.JSON_Object((_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("positive-esdk"))), (_dafny.Seq("ciphertext"), JSON_Values.JSON_String((_dafny.Seq("file://ciphertexts/")) + ((test).id))), (_dafny.Seq("result"), JSON_Values.JSON_String((_dafny.Seq("file://")) + ((test).plaintextPath))), (_dafny.Seq("algorithmSuiteId"), JSON_Values.JSON_String(d_1_id_)), (_dafny.Seq("frame-size"), JSON_Values.JSON_Number(JSON_Values.default__.Int(((test).frameLength).value))), (_dafny.Seq("description"), JSON_Values.JSON_String((test).description)), (_dafny.Seq("decryptKeyDescription"), d_8_decrypt_)])) + (d_6_optionalValues_)) + return Wrappers.Result_Success(JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("decryption-scenario"), d_9_scenario_)]))) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only Positive Tests supported :(")) + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/WriteVectors.py b/TestVectors/runtimes/python/src/internaldafny/generated/WriteVectors.py new file mode 100644 index 000000000..28b22dbb9 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/WriteVectors.py @@ -0,0 +1,369 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import .internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests + +# Module: WriteVectors + +class default__: + def __init__(self): + pass + + @staticmethod + def GetCommitmentPolicyString(algorithmSuite): + source0_ = (algorithmSuite).id + if True: + if source0_.is_ESDK: + if ((algorithmSuite).commitment).is_None: + return _dafny.Seq("FORBID_ENCRYPT_ALLOW_DECRYPT") + elif True: + return _dafny.Seq("REQUIRE_ENCRYPT_REQUIRE_DECRYPT") + if True: + return _dafny.Seq("NOT SUPPORTED FOR UNSTRUCTURED ENCRYPTION") + + @staticmethod + def GetCommitmentPolicyType(commitmentPolicy): + if (commitmentPolicy) == (_dafny.Seq("FORBID_ENCRYPT_ALLOW_DECRYPT")): + return AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT()) + elif True: + return AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT()) + + @staticmethod + def WriteTestVectors(op): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_version_: int + d_0_version_ = (op).version + d_1_valueOrError0_: Wrappers.Result = Wrappers.Result.default(_dafny.Set)() + d_1_valueOrError0_ = default__.getVersionTests(d_0_version_) + if (d_1_valueOrError0_).IsFailure(): + output = (d_1_valueOrError0_).PropagateFailure() + return output + d_2_allTests_: _dafny.Set + d_2_allTests_ = (d_1_valueOrError0_).Extract() + d_3_tests_: _dafny.Seq + out0_: _dafny.Seq + out0_ = SortedSets.default__.SetToSequence(d_2_allTests_) + d_3_tests_ = out0_ + d_4_sortedTests_: _dafny.Seq + d_4_sortedTests_ = Seq_MergeSort.default__.MergeSortBy(d_3_tests_, default__.DescriptionLessThan) + d_5_testsJSON_: _dafny.Seq + d_5_testsJSON_ = _dafny.Seq([]) + hi0_ = len(d_4_sortedTests_) + for d_6_i_ in range(0, hi0_): + d_7_valueOrError1_: Wrappers.Outcome = Wrappers.Outcome.default()() + d_7_valueOrError1_ = Wrappers.default__.Need((True) and ((((d_4_sortedTests_)[d_6_i_]).algorithmSuiteId).is_Some), _dafny.Seq("No algorithm suite defined in test")) + if (d_7_valueOrError1_).IsFailure(): + output = (d_7_valueOrError1_).PropagateFailure() + return output + d_8_id_: _dafny.Seq + d_8_id_ = AllAlgorithmSuites.default__.ToHex((((d_4_sortedTests_)[d_6_i_]).algorithmSuiteId).value) + d_9_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + out1_: Wrappers.Result + out1_ = UUID.default__.GenerateUUID() + d_9_valueOrError2_ = out1_ + if not(not((d_9_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(82,18): " + _dafny.string_of(d_9_valueOrError2_)) + d_10_uuid_: _dafny.Seq + d_10_uuid_ = (d_9_valueOrError2_).Extract() + d_11_valueOrError3_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_11_valueOrError3_ = WriteEsdkJsonManifests.default__.EncryptTestVectorToJson((d_4_sortedTests_)[d_6_i_]) + if (d_11_valueOrError3_).IsFailure(): + output = (d_11_valueOrError3_).PropagateFailure() + return output + d_12_test_: JSON_Values.JSON + d_12_test_ = (d_11_valueOrError3_).Extract() + d_5_testsJSON_ = (d_5_testsJSON_) + (_dafny.Seq([(d_10_uuid_, d_12_test_)])) + d_13_manifestJson_: JSON_Values.JSON + d_13_manifestJson_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("awses-encrypt"))), (_dafny.Seq("version"), JSON_Values.JSON_Number(JSON_Values.default__.Int(5)))])) + d_14_plaintexts_: JSON_Values.JSON + d_14_plaintexts_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("small"), JSON_Values.JSON_Number(JSON_Values.default__.Int(10240)))])) + d_15_esdkEncryptManifests_: JSON_Values.JSON + d_15_esdkEncryptManifests_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("manifest"), d_13_manifestJson_), (_dafny.Seq("keys"), JSON_Values.JSON_String(_dafny.Seq("file://keys.json"))), (_dafny.Seq("plaintexts"), d_14_plaintexts_), (_dafny.Seq("tests"), JSON_Values.JSON_Object(d_5_testsJSON_))])) + d_16_valueOrError4_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_16_valueOrError4_ = JSON_API.default__.Serialize(d_15_esdkEncryptManifests_) + if not(not((d_16_valueOrError4_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(102,36): " + _dafny.string_of(d_16_valueOrError4_)) + d_17_esdkEncryptManifestBytes_: _dafny.Seq + d_17_esdkEncryptManifestBytes_ = (d_16_valueOrError4_).Extract() + d_18_esdkEncryptManifestBv_: _dafny.Seq + d_18_esdkEncryptManifestBv_ = JSONHelpers.default__.BytesBv(d_17_esdkEncryptManifestBytes_) + d_19_valueOrError5_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out2_: Wrappers.Result + out2_ = FileIO.default__.WriteBytesToFile(((op).encryptManifestOutput) + (_dafny.Seq("encrypt-manifest.json")), d_18_esdkEncryptManifestBv_) + d_19_valueOrError5_ = out2_ + if not(not((d_19_valueOrError5_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(105,13): " + _dafny.string_of(d_19_valueOrError5_)) + d_20___v2_: tuple + d_20___v2_ = (d_19_valueOrError5_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def WriteDecryptManifest(op, keys, tests): + output: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + d_0_testsJSON_: _dafny.Seq + d_0_testsJSON_ = _dafny.Seq([]) + hi0_ = len(tests) + for d_1_i_ in range(0, hi0_): + d_2_name_: _dafny.Seq + d_2_name_ = ((tests)[d_1_i_]).id + d_3_valueOrError0_: Wrappers.Result = Wrappers.Result.default(JSON_Values.JSON.default())() + d_3_valueOrError0_ = WriteEsdkJsonManifests.default__.DecryptTestVectorToJson((tests)[d_1_i_]) + if (d_3_valueOrError0_).IsFailure(): + output = (d_3_valueOrError0_).PropagateFailure() + return output + d_4_test_: JSON_Values.JSON + d_4_test_ = (d_3_valueOrError0_).Extract() + d_0_testsJSON_ = (d_0_testsJSON_) + (_dafny.Seq([(d_2_name_, d_4_test_)])) + d_5_manifestJson_: JSON_Values.JSON + d_5_manifestJson_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("type"), JSON_Values.JSON_String(_dafny.Seq("awses-decrypt"))), (_dafny.Seq("version"), JSON_Values.JSON_Number(JSON_Values.default__.Int(3)))])) + d_6_esdkDecryptManifest_: JSON_Values.JSON + d_6_esdkDecryptManifest_ = JSON_Values.JSON_Object(_dafny.Seq([(_dafny.Seq("manifest"), d_5_manifestJson_), (_dafny.Seq("client"), JSON_Values.JSON_String(_dafny.Seq("aws-encryption-sdk-dafny"))), (_dafny.Seq("keys"), JSON_Values.JSON_String(_dafny.Seq("file://keys.json"))), (_dafny.Seq("tests"), JSON_Values.JSON_Object(d_0_testsJSON_))])) + d_7_valueOrError1_: Wrappers.Result = Wrappers.Result.default(_dafny.Seq)() + d_7_valueOrError1_ = JSON_API.default__.Serialize(d_6_esdkDecryptManifest_) + if not(not((d_7_valueOrError1_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(146,36): " + _dafny.string_of(d_7_valueOrError1_)) + d_8_esdkDecryptManifestBytes_: _dafny.Seq + d_8_esdkDecryptManifestBytes_ = (d_7_valueOrError1_).Extract() + d_9_esdkDecryptManifestBv_: _dafny.Seq + d_9_esdkDecryptManifestBv_ = JSONHelpers.default__.BytesBv(d_8_esdkDecryptManifestBytes_) + d_10_valueOrError2_: Wrappers.Result = Wrappers.Result.default(_dafny.defaults.tuple())() + out0_: Wrappers.Result + out0_ = FileIO.default__.WriteBytesToFile(((op).decryptManifestOutput) + (_dafny.Seq("decrypt-manifest.json")), d_9_esdkDecryptManifestBv_) + d_10_valueOrError2_ = out0_ + if not(not((d_10_valueOrError2_).IsFailure())): + raise _dafny.HaltException("dafny/TestVectors/src/WriteVectors.dfy(149,13): " + _dafny.string_of(d_10_valueOrError2_)) + d_11___v3_: tuple + d_11___v3_ = (d_10_valueOrError2_).Extract() + output = Wrappers.Result_Success(()) + return output + + @staticmethod + def getVersionTests(version): + source0_ = version + if True: + if (source0_) == (5): + return Wrappers.Result_Success((AllEsdkV4NoReqEc.default__.Tests) | (AllEsdkV4WithReqEc.default__.Tests)) + if True: + return Wrappers.Result_Failure(_dafny.Seq("Only version 4 of generate manifest is supported\n")) + + @staticmethod + def DescriptionLessThan(x, y): + return default__.Below((x).description, (y).description) + + @staticmethod + def Below(x, y): + return not ((len(x)) != (0)) or ((((len(y)) != (0)) and (((x)[0]) <= ((y)[0]))) and (not (((x)[0]) == ((y)[0])) or (default__.Below(_dafny.Seq((x)[1::]), _dafny.Seq((y)[1::]))))) + diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/__main__.py b/TestVectors/runtimes/python/src/internaldafny/generated/__main__.py new file mode 100644 index 000000000..ac52f84fa --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/__main__.py @@ -0,0 +1,15 @@ +# Dafny program the_program compiled into Python +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny + +try: + dafnyArgs = [_dafny.Seq(a) for a in sys.argv] + module_.default__.Test____Main____(dafnyArgs) +except _dafny.HaltException as e: + _dafny.print("[Program halted] " + e.message + "\n") + sys.exit(1) diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/dafny_src-py.dtr b/TestVectors/runtimes/python/src/internaldafny/generated/dafny_src-py.dtr new file mode 100644 index 000000000..55675106c --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/dafny_src-py.dtr @@ -0,0 +1,35 @@ +file_format_version = "1.0" +dafny_version = "4.9.0.0" +[options_by_module.WrappedAbstractAwsCryptographyEncryptionSdkService] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.WrappedESDK] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.EsdkManifestOptions] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.EsdkTestVectors] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.AllEsdkV4NoReqEc] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.AllEsdkV4WithReqEc] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.WriteEsdkJsonManifests] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.WriteVectors] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.ParseEsdkJsonManifest] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.EsdkTestManifests] +legacy-module-names = false +python-module-name = ".internaldafny.generated" +[options_by_module.WrappedESDKMain] +legacy-module-names = false +python-module-name = ".internaldafny.generated" diff --git a/TestVectors/runtimes/python/src/internaldafny/generated/module_.py b/TestVectors/runtimes/python/src/internaldafny/generated/module_.py new file mode 100644 index 000000000..05f8d1a12 --- /dev/null +++ b/TestVectors/runtimes/python/src/internaldafny/generated/module_.py @@ -0,0 +1,234 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import .internaldafny.generated.module_ as module_ +import _dafny as _dafny +import System_ as System_ +import Wrappers as Wrappers +import BoundedInts as BoundedInts +import StandardLibrary_UInt as StandardLibrary_UInt +import StandardLibrary_Sequence as StandardLibrary_Sequence +import StandardLibrary_String as StandardLibrary_String +import StandardLibrary as StandardLibrary +import UTF8 as UTF8 +import AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import ExternRandom as ExternRandom +import Random as Random +import AESEncryption as AESEncryption +import ExternDigest as ExternDigest +import Digest as Digest +import HMAC as HMAC +import WrappedHMAC as WrappedHMAC +import HKDF as HKDF +import WrappedHKDF as WrappedHKDF +import Signature as Signature +import KdfCtr as KdfCtr +import RSAEncryption as RSAEncryption +import ECDH as ECDH +import AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import AtomicPrimitives as AtomicPrimitives +import ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import Base64 as Base64 +import AlgorithmSuites as AlgorithmSuites +import Materials as Materials +import Keyring as Keyring +import Relations as Relations +import Seq_MergeSort as Seq_MergeSort +import Math as Math +import Seq as Seq +import MultiKeyring as MultiKeyring +import AwsArnParsing as AwsArnParsing +import AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import Actions as Actions +import AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import AwsKmsUtils as AwsKmsUtils +import Constants as Constants +import UUID as UUID +import MaterialWrapping as MaterialWrapping +import SortedSets as SortedSets +import CanonicalEncryptionContext as CanonicalEncryptionContext +import IntermediateKeyWrapping as IntermediateKeyWrapping +import EdkWrapping as EdkWrapping +import ErrorMessages as ErrorMessages +import AwsKmsKeyring as AwsKmsKeyring +import StrictMultiKeyring as StrictMultiKeyring +import AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import Com_Amazonaws_Kms as Com_Amazonaws_Kms +import Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import DiscoveryMultiKeyring as DiscoveryMultiKeyring +import AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import AwsKmsMrkKeyring as AwsKmsMrkKeyring +import MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import DafnyLibraries as DafnyLibraries +import Time as Time +import LocalCMC as LocalCMC +import SynchronizedLocalCMC as SynchronizedLocalCMC +import StormTracker as StormTracker +import StormTrackingCMC as StormTrackingCMC +import CacheConstants as CacheConstants +import AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import AwsKmsRsaKeyring as AwsKmsRsaKeyring +import EcdhEdkWrapping as EcdhEdkWrapping +import RawECDHKeyring as RawECDHKeyring +import AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import RawAESKeyring as RawAESKeyring +import RawRSAKeyring as RawRSAKeyring +import CMM as CMM +import Defaults as Defaults +import Commitment as Commitment +import DefaultCMM as DefaultCMM +import DefaultClientSupplier as DefaultClientSupplier +import Utils as Utils +import RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import MaterialProviders as MaterialProviders +import KeyStoreErrorMessages as KeyStoreErrorMessages +import KmsArn as KmsArn +import Structure as Structure +import KMSKeystoreOperations as KMSKeystoreOperations +import DDBKeystoreOperations as DDBKeystoreOperations +import CreateKeys as CreateKeys +import CreateKeyStoreTable as CreateKeyStoreTable +import GetKeys as GetKeys +import AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import KeyStore as KeyStore +import AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import JSON_Utils_Views_Core as JSON_Utils_Views_Core +import JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import JSON_Utils_Cursors as JSON_Utils_Cursors +import JSON_Utils_Parsers as JSON_Utils_Parsers +import GeneralInternals as GeneralInternals +import MulInternalsNonlinear as MulInternalsNonlinear +import MulInternals as MulInternals +import Mul as Mul +import ModInternalsNonlinear as ModInternalsNonlinear +import DivInternalsNonlinear as DivInternalsNonlinear +import ModInternals as ModInternals +import DivInternals as DivInternals +import DivMod as DivMod +import Power as Power +import Logarithm as Logarithm +import JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import JSON_Utils_Str as JSON_Utils_Str +import JSON_Utils_Seq as JSON_Utils_Seq +import JSON_Utils_Vectors as JSON_Utils_Vectors +import JSON_Errors as JSON_Errors +import JSON_Values as JSON_Values +import Unicode as Unicode +import Functions as Functions +import Utf8EncodingForm as Utf8EncodingForm +import Utf16EncodingForm as Utf16EncodingForm +import UnicodeStrings as UnicodeStrings +import JSON_Spec as JSON_Spec +import JSON_Grammar as JSON_Grammar +import JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import JSON_Serializer as JSON_Serializer +import JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import JSON_Deserializer as JSON_Deserializer +import JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import JSON_ZeroCopy_API as JSON_ZeroCopy_API +import JSON_API as JSON_API +import JSONHelpers as JSONHelpers +import KeyDescription as KeyDescription +import HexStrings as HexStrings +import KeyMaterial as KeyMaterial +import CreateStaticKeyrings as CreateStaticKeyrings +import CreateStaticKeyStores as CreateStaticKeyStores +import KeyringFromKeyDescription as KeyringFromKeyDescription +import CmmFromKeyDescription as CmmFromKeyDescription +import WrappedMaterialProviders as WrappedMaterialProviders +import KeysVectorOperations as KeysVectorOperations +import FileIO as FileIO +import KeyVectors as KeyVectors +import AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import Streams as Streams +import SerializableTypes as SerializableTypes +import SerializeFunctions as SerializeFunctions +import EncryptionContext as EncryptionContext +import HeaderTypes as HeaderTypes +import SharedHeaderFunctions as SharedHeaderFunctions +import EncryptedDataKeys as EncryptedDataKeys +import V1HeaderBody as V1HeaderBody +import V2HeaderBody as V2HeaderBody +import HeaderAuth as HeaderAuth +import Header as Header +import Frames as Frames +import MessageBody as MessageBody +import KeyDerivation as KeyDerivation +import EncryptDecryptHelpers as EncryptDecryptHelpers +import AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import EncryptionSdk as EncryptionSdk +import MplManifestOptions as MplManifestOptions +import GetOpt as GetOpt +import AllAlgorithmSuites as AllAlgorithmSuites +import TestVectors as TestVectors +import AllHierarchy as AllHierarchy +import AllKms as AllKms +import AllKmsMrkAware as AllKmsMrkAware +import AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import AllKmsRsa as AllKmsRsa +import AllKmsEcdh as AllKmsEcdh +import AllRawAES as AllRawAES +import AllRawRSA as AllRawRSA +import AllRawECDH as AllRawECDH +import AllDefaultCmm as AllDefaultCmm +import AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import AllMulti as AllMulti +import WriteJsonManifests as WriteJsonManifests +import CompleteVectors as CompleteVectors +import ParseJsonManifests as ParseJsonManifests +import TestManifests as TestManifests +import WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import AesKdfCtr as AesKdfCtr +import StandardLibraryInterop as StandardLibraryInterop +import Sorting as Sorting +import FloatCompare as FloatCompare +import ConcurrentCall as ConcurrentCall +import Base64Lemmas as Base64Lemmas +import .internaldafny.generated.WrappedESDK as WrappedESDK +import .internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import .internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import .internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import .internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import .internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import .internaldafny.generated.WriteVectors as WriteVectors +import .internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import .internaldafny.generated.EsdkTestManifests as EsdkTestManifests +import .internaldafny.generated.WrappedESDKMain as WrappedESDKMain + +# Module: module_ + +class default__: + def __init__(self): + pass + + @staticmethod + def Test____Main____(noArgsParameter__): + d_0_success_: bool + d_0_success_ = True + if not(d_0_success_): + raise _dafny.HaltException("(1,0): " + _dafny.string_of(_dafny.Seq("Test failures occurred: see above.\n"))) + diff --git a/TestVectors/runtimes/python/test/internaldafny/__init__.py b/TestVectors/runtimes/python/test/internaldafny/__init__.py new file mode 100644 index 000000000..f94fd12a2 --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/__init__.py @@ -0,0 +1,2 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 diff --git a/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..870d04f7c Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 000000000..9400f6007 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/__pycache__/__init__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-311-pytest-7.4.4.pyc b/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-311-pytest-7.4.4.pyc new file mode 100644 index 000000000..578740d28 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-311-pytest-7.4.4.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-312-pytest-7.4.4.pyc b/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-312-pytest-7.4.4.pyc new file mode 100644 index 000000000..15c03764e Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/__pycache__/test_dafny_wrapper.cpython-312-pytest-7.4.4.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/TestWrappedESDKMain_extern.py b/TestVectors/runtimes/python/test/internaldafny/extern/TestWrappedESDKMain_extern.py new file mode 100644 index 000000000..574e31c52 --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/extern/TestWrappedESDKMain_extern.py @@ -0,0 +1,10 @@ +import TestWrappedESDKMain +import _dafny +import os + +class default__(TestWrappedESDKMain.default__): + @staticmethod + def GetTestVectorExecutionDirectory(): + return _dafny.Seq(os.getcwd() + "/../../") + +TestWrappedESDKMain.default__ = default__ \ No newline at end of file diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/__init__.py b/TestVectors/runtimes/python/test/internaldafny/extern/__init__.py new file mode 100644 index 000000000..0e8ddce01 --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/extern/__init__.py @@ -0,0 +1,3 @@ +from . import ( + TestWrappedESDKMain_extern, +) \ No newline at end of file diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-311.pyc new file mode 100644 index 000000000..49d1ed40b Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-312.pyc new file mode 100644 index 000000000..90f591a54 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/TestWrappedESDKMain_extern.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..342e00280 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 000000000..32080c2fb Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/extern/__pycache__/__init__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/TestWrappedESDKMain.py b/TestVectors/runtimes/python/test/internaldafny/generated/TestWrappedESDKMain.py new file mode 100644 index 000000000..84544c27f --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/generated/TestWrappedESDKMain.py @@ -0,0 +1,278 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestManifests as EsdkTestManifests +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDKMain as WrappedESDKMain +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas + +# Module: TestWrappedESDKMain + +class default__: + def __init__(self): + pass + + @staticmethod + def RunManifestTests(): + default__.TestGenerateEncryptManifest() + default__.TestEncryptManifest() + default__.TestDecryptManifest() + + @staticmethod + def TestGenerateEncryptManifest(): + d_0_directory_: _dafny.Seq + out0_: _dafny.Seq + out0_ = default__.GetTestVectorExecutionDirectory() + d_0_directory_ = out0_ + d_1_result_: Wrappers.Result + out1_: Wrappers.Result + out1_ = WriteVectors.default__.WriteTestVectors(EsdkManifestOptions.ManifestOptions_EncryptManifest((d_0_directory_) + (_dafny.Seq("dafny/TestVectors/test/")), 5)) + d_1_result_ = out1_ + if (d_1_result_).is_Failure: + _dafny.print(_dafny.string_of((d_1_result_).error)) + if not((d_1_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/test/RunMain.dfy(38,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + + @staticmethod + def TestEncryptManifest(): + d_0_directory_: _dafny.Seq + out0_: _dafny.Seq + out0_ = default__.GetTestVectorExecutionDirectory() + d_0_directory_ = out0_ + d_1_result_: Wrappers.Result + out1_: Wrappers.Result + out1_ = EsdkTestManifests.default__.StartEncryptVectors(EsdkManifestOptions.ManifestOptions_Encrypt((d_0_directory_) + (_dafny.Seq("dafny/TestVectors/test/")), _dafny.Seq("encrypt-manifest.json"), (d_0_directory_) + (_dafny.Seq("dafny/TestVectors/test/")), Wrappers.Option_None())) + d_1_result_ = out1_ + if (d_1_result_).is_Failure: + _dafny.print(_dafny.string_of((d_1_result_).error)) + if not((d_1_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/test/RunMain.dfy(53,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + + @staticmethod + def TestDecryptManifest(): + d_0_directory_: _dafny.Seq + out0_: _dafny.Seq + out0_ = default__.GetTestVectorExecutionDirectory() + d_0_directory_ = out0_ + d_1_result_: Wrappers.Result + out1_: Wrappers.Result + out1_ = EsdkTestManifests.default__.StartDecryptVectors(EsdkManifestOptions.ManifestOptions_Decrypt((d_0_directory_) + (_dafny.Seq("dafny/TestVectors/test/")), _dafny.Seq("decrypt-manifest.json"), Wrappers.Option_None())) + d_1_result_ = out1_ + if (d_1_result_).is_Failure: + _dafny.print(_dafny.string_of((d_1_result_).error)) + if not((d_1_result_).is_Success): + raise _dafny.HaltException("dafny/TestVectors/test/RunMain.dfy(69,4): " + _dafny.string_of(_dafny.Seq("expectation violation"))) + diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__main__.py b/TestVectors/runtimes/python/test/internaldafny/generated/__main__.py new file mode 100644 index 000000000..55186ebe6 --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/generated/__main__.py @@ -0,0 +1,15 @@ +# Dafny program the_program compiled into Python +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import module_ as module_ +import _dafny as _dafny + +try: + dafnyArgs = [_dafny.Seq(a) for a in sys.argv] + module_.default__.Test____Main____(dafnyArgs) +except _dafny.HaltException as e: + _dafny.print("[Program halted] " + e.message + "\n") + sys.exit(1) diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-311.pyc new file mode 100644 index 000000000..1e9fd17e1 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-312.pyc new file mode 100644 index 000000000..2956f35db Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/TestWrappedESDKMain.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-311.pyc new file mode 100644 index 000000000..6d5985a46 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-312.pyc new file mode 100644 index 000000000..42fea88e8 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/__main__.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-311.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-311.pyc new file mode 100644 index 000000000..2c8b6cd7c Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-311.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-312.pyc b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-312.pyc new file mode 100644 index 000000000..3ef952832 Binary files /dev/null and b/TestVectors/runtimes/python/test/internaldafny/generated/__pycache__/module_.cpython-312.pyc differ diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/dafny_test-py.dtr b/TestVectors/runtimes/python/test/internaldafny/generated/dafny_test-py.dtr new file mode 100644 index 000000000..ede2d6ffa --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/generated/dafny_test-py.dtr @@ -0,0 +1,4 @@ +file_format_version = "1.0" +dafny_version = "4.9.0.0" +[options_by_module.TestWrappedESDKMain] +legacy-module-names = false diff --git a/TestVectors/runtimes/python/test/internaldafny/generated/module_.py b/TestVectors/runtimes/python/test/internaldafny/generated/module_.py new file mode 100644 index 000000000..508814e7a --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/generated/module_.py @@ -0,0 +1,248 @@ +import sys +from typing import Callable, Any, TypeVar, NamedTuple +from math import floor +from itertools import count + +import module_ as module_ +import _dafny as _dafny +import System_ as System_ +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers +import smithy_dafny_standard_library.internaldafny.generated.BoundedInts as BoundedInts +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_UInt as StandardLibrary_UInt +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_Sequence as StandardLibrary_Sequence +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary_String as StandardLibrary_String +import smithy_dafny_standard_library.internaldafny.generated.StandardLibrary as StandardLibrary +import smithy_dafny_standard_library.internaldafny.generated.UTF8 as UTF8 +import aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes as ComAmazonawsDynamodbTypes +import aws_cryptography_internal_kms.internaldafny.generated.ComAmazonawsKmsTypes as ComAmazonawsKmsTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreTypes as AwsCryptographyKeyStoreTypes +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesTypes as AwsCryptographyPrimitivesTypes +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersTypes as AwsCryptographyMaterialProvidersTypes +import aws_encryption_sdk.internaldafny.generated.AwsCryptographyEncryptionSdkTypes as AwsCryptographyEncryptionSdkTypes +import aws_cryptography_primitives.internaldafny.generated.ExternRandom as ExternRandom +import aws_cryptography_primitives.internaldafny.generated.Random as Random +import aws_cryptography_primitives.internaldafny.generated.AESEncryption as AESEncryption +import aws_cryptography_primitives.internaldafny.generated.ExternDigest as ExternDigest +import aws_cryptography_primitives.internaldafny.generated.Digest as Digest +import aws_cryptography_primitives.internaldafny.generated.HMAC as HMAC +import aws_cryptography_primitives.internaldafny.generated.WrappedHMAC as WrappedHMAC +import aws_cryptography_primitives.internaldafny.generated.HKDF as HKDF +import aws_cryptography_primitives.internaldafny.generated.WrappedHKDF as WrappedHKDF +import aws_cryptography_primitives.internaldafny.generated.Signature as Signature +import aws_cryptography_primitives.internaldafny.generated.KdfCtr as KdfCtr +import aws_cryptography_primitives.internaldafny.generated.RSAEncryption as RSAEncryption +import aws_cryptography_primitives.internaldafny.generated.ECDH as ECDH +import aws_cryptography_primitives.internaldafny.generated.AwsCryptographyPrimitivesOperations as AwsCryptographyPrimitivesOperations +import aws_cryptography_primitives.internaldafny.generated.AtomicPrimitives as AtomicPrimitives +import smithy_dafny_standard_library.internaldafny.generated.Base64 as Base64 +import aws_cryptographic_material_providers.internaldafny.generated.AlgorithmSuites as AlgorithmSuites +import aws_cryptographic_material_providers.internaldafny.generated.Materials as Materials +import aws_cryptographic_material_providers.internaldafny.generated.Keyring as Keyring +import smithy_dafny_standard_library.internaldafny.generated.Relations as Relations +import smithy_dafny_standard_library.internaldafny.generated.Seq_MergeSort as Seq_MergeSort +import smithy_dafny_standard_library.internaldafny.generated.Math as Math +import smithy_dafny_standard_library.internaldafny.generated.Seq as Seq +import aws_cryptographic_material_providers.internaldafny.generated.MultiKeyring as MultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsArnParsing as AwsArnParsing +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkAreUnique as AwsKmsMrkAreUnique +import smithy_dafny_standard_library.internaldafny.generated.Actions as Actions +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkMatchForDecrypt as AwsKmsMrkMatchForDecrypt +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsUtils as AwsKmsUtils +import aws_cryptographic_material_providers.internaldafny.generated.Constants as Constants +import smithy_dafny_standard_library.internaldafny.generated.UUID as UUID +import aws_cryptographic_material_providers.internaldafny.generated.MaterialWrapping as MaterialWrapping +import smithy_dafny_standard_library.internaldafny.generated.SortedSets as SortedSets +import aws_cryptographic_material_providers.internaldafny.generated.CanonicalEncryptionContext as CanonicalEncryptionContext +import aws_cryptographic_material_providers.internaldafny.generated.IntermediateKeyWrapping as IntermediateKeyWrapping +import aws_cryptographic_material_providers.internaldafny.generated.EdkWrapping as EdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.ErrorMessages as ErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsKeyring as AwsKmsKeyring +import aws_cryptographic_material_providers.internaldafny.generated.StrictMultiKeyring as StrictMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsDiscoveryKeyring as AwsKmsDiscoveryKeyring +import aws_cryptography_internal_kms.internaldafny.generated.Com_Amazonaws_Kms as Com_Amazonaws_Kms +import aws_cryptography_internal_dynamodb.internaldafny.generated.Com_Amazonaws_Dynamodb as Com_Amazonaws_Dynamodb +import aws_cryptographic_material_providers.internaldafny.generated.DiscoveryMultiKeyring as DiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkDiscoveryKeyring as AwsKmsMrkDiscoveryKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareDiscoveryMultiKeyring as MrkAwareDiscoveryMultiKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsMrkKeyring as AwsKmsMrkKeyring +import aws_cryptographic_material_providers.internaldafny.generated.MrkAwareStrictMultiKeyring as MrkAwareStrictMultiKeyring +import smithy_dafny_standard_library.internaldafny.generated.DafnyLibraries as DafnyLibraries +import smithy_dafny_standard_library.internaldafny.generated.Time as Time +import aws_cryptographic_material_providers.internaldafny.generated.LocalCMC as LocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.SynchronizedLocalCMC as SynchronizedLocalCMC +import aws_cryptographic_material_providers.internaldafny.generated.StormTracker as StormTracker +import aws_cryptographic_material_providers.internaldafny.generated.StormTrackingCMC as StormTrackingCMC +import aws_cryptographic_material_providers.internaldafny.generated.CacheConstants as CacheConstants +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsHierarchicalKeyring as AwsKmsHierarchicalKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsRsaKeyring as AwsKmsRsaKeyring +import aws_cryptographic_material_providers.internaldafny.generated.EcdhEdkWrapping as EcdhEdkWrapping +import aws_cryptographic_material_providers.internaldafny.generated.RawECDHKeyring as RawECDHKeyring +import aws_cryptographic_material_providers.internaldafny.generated.AwsKmsEcdhKeyring as AwsKmsEcdhKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawAESKeyring as RawAESKeyring +import aws_cryptographic_material_providers.internaldafny.generated.RawRSAKeyring as RawRSAKeyring +import aws_cryptographic_material_providers.internaldafny.generated.CMM as CMM +import aws_cryptographic_material_providers.internaldafny.generated.Defaults as Defaults +import aws_cryptographic_material_providers.internaldafny.generated.Commitment as Commitment +import aws_cryptographic_material_providers.internaldafny.generated.DefaultCMM as DefaultCMM +import aws_cryptographic_material_providers.internaldafny.generated.DefaultClientSupplier as DefaultClientSupplier +import aws_cryptographic_material_providers.internaldafny.generated.Utils as Utils +import aws_cryptographic_material_providers.internaldafny.generated.RequiredEncryptionContextCMM as RequiredEncryptionContextCMM +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyMaterialProvidersOperations as AwsCryptographyMaterialProvidersOperations +import aws_cryptographic_material_providers.internaldafny.generated.MaterialProviders as MaterialProviders +import smithy_dafny_standard_library.internaldafny.generated.Streams as Streams +import aws_encryption_sdk.internaldafny.generated.SerializableTypes as SerializableTypes +import aws_encryption_sdk.internaldafny.generated.SerializeFunctions as SerializeFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptionContext as EncryptionContext +import aws_encryption_sdk.internaldafny.generated.HeaderTypes as HeaderTypes +import aws_encryption_sdk.internaldafny.generated.SharedHeaderFunctions as SharedHeaderFunctions +import aws_encryption_sdk.internaldafny.generated.EncryptedDataKeys as EncryptedDataKeys +import aws_encryption_sdk.internaldafny.generated.V1HeaderBody as V1HeaderBody +import aws_encryption_sdk.internaldafny.generated.V2HeaderBody as V2HeaderBody +import aws_encryption_sdk.internaldafny.generated.HeaderAuth as HeaderAuth +import aws_encryption_sdk.internaldafny.generated.Header as Header +import aws_encryption_sdk.internaldafny.generated.Frames as Frames +import aws_encryption_sdk.internaldafny.generated.MessageBody as MessageBody +import aws_encryption_sdk.internaldafny.generated.KeyDerivation as KeyDerivation +import aws_encryption_sdk.internaldafny.generated.EncryptDecryptHelpers as EncryptDecryptHelpers +import aws_encryption_sdk.internaldafny.generated.AwsEncryptionSdkOperations as AwsEncryptionSdkOperations +import aws_encryption_sdk.internaldafny.generated.EncryptionSdk as EncryptionSdk +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDK as WrappedESDK +import smithy_dafny_standard_library.internaldafny.generated.HexStrings as HexStrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllAlgorithmSuites as AllAlgorithmSuites +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProviders as WrappedMaterialProviders +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AwsCryptographyMaterialProvidersTestVectorKeysTypes as AwsCryptographyMaterialProvidersTestVectorKeysTypes +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Core as JSON_Utils_Views_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Views_Writers as JSON_Utils_Views_Writers +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Core as JSON_Utils_Lexers_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Lexers_Strings as JSON_Utils_Lexers_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Cursors as JSON_Utils_Cursors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Parsers as JSON_Utils_Parsers +import smithy_dafny_standard_library.internaldafny.generated.GeneralInternals as GeneralInternals +import smithy_dafny_standard_library.internaldafny.generated.MulInternalsNonlinear as MulInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.MulInternals as MulInternals +import smithy_dafny_standard_library.internaldafny.generated.Mul as Mul +import smithy_dafny_standard_library.internaldafny.generated.ModInternalsNonlinear as ModInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.DivInternalsNonlinear as DivInternalsNonlinear +import smithy_dafny_standard_library.internaldafny.generated.ModInternals as ModInternals +import smithy_dafny_standard_library.internaldafny.generated.DivInternals as DivInternals +import smithy_dafny_standard_library.internaldafny.generated.DivMod as DivMod +import smithy_dafny_standard_library.internaldafny.generated.Power as Power +import smithy_dafny_standard_library.internaldafny.generated.Logarithm as Logarithm +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrConversion as JSON_Utils_Str_CharStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str_CharStrEscaping as JSON_Utils_Str_CharStrEscaping +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Str as JSON_Utils_Str +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Seq as JSON_Utils_Seq +import smithy_dafny_standard_library.internaldafny.generated.JSON_Utils_Vectors as JSON_Utils_Vectors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Errors as JSON_Errors +import smithy_dafny_standard_library.internaldafny.generated.JSON_Values as JSON_Values +import smithy_dafny_standard_library.internaldafny.generated.Unicode as Unicode +import smithy_dafny_standard_library.internaldafny.generated.Functions as Functions +import smithy_dafny_standard_library.internaldafny.generated.Utf8EncodingForm as Utf8EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.Utf16EncodingForm as Utf16EncodingForm +import smithy_dafny_standard_library.internaldafny.generated.UnicodeStrings as UnicodeStrings +import smithy_dafny_standard_library.internaldafny.generated.JSON_Spec as JSON_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_Grammar as JSON_Grammar +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer_ByteStrConversion as JSON_Serializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Serializer as JSON_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_Uint16StrConversion as JSON_Deserializer_Uint16StrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer_ByteStrConversion as JSON_Deserializer_ByteStrConversion +import smithy_dafny_standard_library.internaldafny.generated.JSON_Deserializer as JSON_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_Spec as JSON_ConcreteSyntax_Spec +import smithy_dafny_standard_library.internaldafny.generated.JSON_ConcreteSyntax_SpecProperties as JSON_ConcreteSyntax_SpecProperties +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Serializer as JSON_ZeroCopy_Serializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Core as JSON_ZeroCopy_Deserializer_Core +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Strings as JSON_ZeroCopy_Deserializer_Strings +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Numbers as JSON_ZeroCopy_Deserializer_Numbers +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ObjectParams as JSON_ZeroCopy_Deserializer_ObjectParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Objects as JSON_ZeroCopy_Deserializer_Objects +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_ArrayParams as JSON_ZeroCopy_Deserializer_ArrayParams +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Arrays as JSON_ZeroCopy_Deserializer_Arrays +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Constants as JSON_ZeroCopy_Deserializer_Constants +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_Values as JSON_ZeroCopy_Deserializer_Values +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer_API as JSON_ZeroCopy_Deserializer_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_Deserializer as JSON_ZeroCopy_Deserializer +import smithy_dafny_standard_library.internaldafny.generated.JSON_ZeroCopy_API as JSON_ZeroCopy_API +import smithy_dafny_standard_library.internaldafny.generated.JSON_API as JSON_API +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.JSONHelpers as JSONHelpers +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyDescription as KeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyMaterial as KeyMaterial +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyrings as CreateStaticKeyrings +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CreateStaticKeyStores as CreateStaticKeyStores +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyringFromKeyDescription as KeyringFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CmmFromKeyDescription as CmmFromKeyDescription +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeysVectorOperations as KeysVectorOperations +import smithy_dafny_standard_library.internaldafny.generated.FileIO as FileIO +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.KeyVectors as KeyVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestVectors as TestVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllHierarchy as AllHierarchy +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKms as AllKms +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAware as AllKmsMrkAware +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsMrkAwareDiscovery as AllKmsMrkAwareDiscovery +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsRsa as AllKmsRsa +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllKmsEcdh as AllKmsEcdh +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawAES as AllRawAES +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawRSA as AllRawRSA +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRawECDH as AllRawECDH +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllDefaultCmm as AllDefaultCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllRequiredEncryptionContextCmm as AllRequiredEncryptionContextCmm +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.AllMulti as AllMulti +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.MplManifestOptions as MplManifestOptions +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WriteJsonManifests as WriteJsonManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.CompleteVectors as CompleteVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkManifestOptions as EsdkManifestOptions +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestVectors as EsdkTestVectors +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4NoReqEc as AllEsdkV4NoReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.AllEsdkV4WithReqEc as AllEsdkV4WithReqEc +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteEsdkJsonManifests as WriteEsdkJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.WriteVectors as WriteVectors +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.ParseJsonManifests as ParseJsonManifests +import aws_encryption_sdk_test_vectors.internaldafny.generated.ParseEsdkJsonManifest as ParseEsdkJsonManifest +import aws_encryption_sdk_test_vectors.internaldafny.generated.EsdkTestManifests as EsdkTestManifests +import smithy_dafny_standard_library.internaldafny.generated.GetOpt as GetOpt +import aws_encryption_sdk_test_vectors.internaldafny.generated.WrappedESDKMain as WrappedESDKMain +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.TestManifests as TestManifests +import aws_cryptography_materialproviders_test_vectors.internaldafny.generated.WrappedMaterialProvidersMain as WrappedMaterialProvidersMain +import aws_cryptography_primitives.internaldafny.generated.AesKdfCtr as AesKdfCtr +import aws_cryptographic_material_providers.internaldafny.generated.KeyStoreErrorMessages as KeyStoreErrorMessages +import aws_cryptographic_material_providers.internaldafny.generated.KmsArn as KmsArn +import aws_cryptographic_material_providers.internaldafny.generated.Structure as Structure +import aws_cryptographic_material_providers.internaldafny.generated.KMSKeystoreOperations as KMSKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.DDBKeystoreOperations as DDBKeystoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeys as CreateKeys +import aws_cryptographic_material_providers.internaldafny.generated.CreateKeyStoreTable as CreateKeyStoreTable +import aws_cryptographic_material_providers.internaldafny.generated.GetKeys as GetKeys +import aws_cryptographic_material_providers.internaldafny.generated.AwsCryptographyKeyStoreOperations as AwsCryptographyKeyStoreOperations +import aws_cryptographic_material_providers.internaldafny.generated.KeyStore as KeyStore +import smithy_dafny_standard_library.internaldafny.generated.StandardLibraryInterop as StandardLibraryInterop +import smithy_dafny_standard_library.internaldafny.generated.Sorting as Sorting +import smithy_dafny_standard_library.internaldafny.generated.FloatCompare as FloatCompare +import smithy_dafny_standard_library.internaldafny.generated.ConcurrentCall as ConcurrentCall +import smithy_dafny_standard_library.internaldafny.generated.Base64Lemmas as Base64Lemmas +import TestWrappedESDKMain as TestWrappedESDKMain + +# Module: module_ + +class default__: + def __init__(self): + pass + + @staticmethod + def Test____Main____(noArgsParameter__): + d_0_success_: bool + d_0_success_ = True + _dafny.print(_dafny.string_of(_dafny.Seq("TestWrappedESDKMain.RunManifestTests: "))) + try: + if True: + TestWrappedESDKMain.default__.RunManifestTests() + if True: + _dafny.print(_dafny.string_of(_dafny.Seq("PASSED\n"))) + except _dafny.HaltException as e: + d_1_haltMessage_ = e.message + if True: + _dafny.print(_dafny.string_of(_dafny.Seq("FAILED\n "))) + _dafny.print(_dafny.string_of(d_1_haltMessage_)) + _dafny.print(_dafny.string_of(_dafny.Seq("\n"))) + d_0_success_ = False + if not(d_0_success_): + raise _dafny.HaltException("(1,0): " + _dafny.string_of(_dafny.Seq("Test failures occurred: see above.\n"))) + diff --git a/TestVectors/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestVectors/runtimes/python/test/internaldafny/test_dafny_wrapper.py new file mode 100644 index 000000000..2a70bb22c --- /dev/null +++ b/TestVectors/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -0,0 +1,22 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +""" +Wrapper file for executing Dafny tests from pytest. +This allows us to import modules required by Dafny-generated tests +before executing Dafny-generated tests. +pytest will find and execute the `test_dafny` method below, +which will execute the `internaldafny_test_executor.py` file in the `dafny` directory. +""" + +import sys + +internaldafny_dir = '/'.join(__file__.split("/")[:-1]) + +sys.path.append(internaldafny_dir + "/extern") +sys.path.append(internaldafny_dir + "/generated") + +from . import extern + +def test_dafny(): + from .generated import __main__ diff --git a/TestVectors/runtimes/python/tox.ini b/TestVectors/runtimes/python/tox.ini new file mode 100644 index 000000000..4406ea808 --- /dev/null +++ b/TestVectors/runtimes/python/tox.ini @@ -0,0 +1,26 @@ +[tox] +isolated_build = True +envlist = + py{311,312} + +[testenv] +skip_install = true +allowlist_externals = poetry +passenv = AWS_* +commands_pre = + poetry lock + poetry install +commands = + poetry run pytest -s -v test/ + +[testenv:cli] +skip_install = true +allowlist_externals = poetry +passenv = AWS_* +setenv = VIRTUALENV_DOWNLOAD=0 + PIP_DISABLE_PIP_VERSION_CHECK=1 +commands_pre = + poetry lock + poetry install --with test +commands = + poetry run python src/aws_cryptography_materialproviders_test_vectors/internaldafny/generated {posargs} \ No newline at end of file