From 4508ab84bd6017e7db6f353d2195b93ac30761c9 Mon Sep 17 00:00:00 2001 From: Shubham Chaturvedi Date: Tue, 14 Jan 2025 16:16:10 -0800 Subject: [PATCH] feat(mpl): Go release v0.0.1 (#1211) Co-authored-by: Shubham Chaturvedi Co-authored-by: seebees --- .../go/mpl/AlgorithmSuites/AlgorithmSuites.go | 471 + .../go/mpl/AwsArnParsing/AwsArnParsing.go | 1135 ++ .../AwsCryptographyKeyStoreOperations.go | 586 + .../AwsCryptographyKeyStoreTypes.go | 2713 ++++ ...CryptographyMaterialProvidersOperations.go | 1786 +++ .../AwsCryptographyMaterialProvidersTypes.go | 11427 ++++++++++++++++ .../AwsKmsDiscoveryKeyring.go | 808 ++ .../AwsKmsEcdhKeyring/AwsKmsEcdhKeyring.go | 1185 ++ .../AwsKmsHierarchicalKeyring.go | 2230 +++ .../go/mpl/AwsKmsKeyring/AwsKmsKeyring.go | 1372 ++ .../AwsKmsMrkAreUnique/AwsKmsMrkAreUnique.go | 274 + .../AwsKmsMrkDiscoveryKeyring.go | 711 + .../mpl/AwsKmsMrkKeyring/AwsKmsMrkKeyring.go | 608 + .../AwsKmsMrkMatchForDecrypt.go | 184 + .../mpl/AwsKmsRsaKeyring/AwsKmsRsaKeyring.go | 1390 ++ releases/go/mpl/AwsKmsUtils/AwsKmsUtils.go | 525 + releases/go/mpl/CHANGELOG.md | 5 + releases/go/mpl/CMM/CMM.go | 298 + .../go/mpl/CacheConstants/CacheConstants.go | 246 + .../CanonicalEncryptionContext.go | 249 + releases/go/mpl/Commitment/Commitment.go | 268 + releases/go/mpl/Constants/Constants.go | 441 + .../CreateKeyStoreTable.go | 270 + releases/go/mpl/CreateKeys/CreateKeys.go | 358 + .../DDBKeystoreOperations.go | 534 + releases/go/mpl/DefaultCMM/DefaultCMM.go | 484 + .../DefaultClientSupplier.go | 299 + releases/go/mpl/Defaults/Defaults.go | 269 + .../DiscoveryMultiKeyring.go | 267 + .../go/mpl/EcdhEdkWrapping/EcdhEdkWrapping.go | 1100 ++ releases/go/mpl/EdkWrapping/EdkWrapping.go | 617 + .../go/mpl/ErrorMessages/ErrorMessages.go | 337 + releases/go/mpl/GetKeys/GetKeys.go | 352 + .../IntermediateKeyWrapping.go | 1174 ++ .../KMSKeystoreOperations.go | 426 + releases/go/mpl/KeyStore/KeyStore.go | 502 + .../KeyStoreErrorMessages.go | 191 + releases/go/mpl/Keyring/Keyring.go | 173 + releases/go/mpl/KmsArn/KmsArn.go | 194 + releases/go/mpl/LICENSE | 175 + releases/go/mpl/LocalCMC/LocalCMC.go | 894 ++ .../MaterialProviders/MaterialProviders.go | 630 + .../mpl/MaterialWrapping/MaterialWrapping.go | 856 ++ releases/go/mpl/Materials/Materials.go | 640 + .../MrkAwareDiscoveryMultiKeyring.go | 271 + .../MrkAwareStrictMultiKeyring.go | 400 + releases/go/mpl/MultiKeyring/MultiKeyring.go | 446 + releases/go/mpl/README.md | 49 + .../go/mpl/RawAESKeyring/RawAESKeyring.go | 1172 ++ .../go/mpl/RawECDHKeyring/RawECDHKeyring.go | 1306 ++ .../go/mpl/RawRSAKeyring/RawRSAKeyring.go | 1093 ++ .../RequiredEncryptionContextCMM.go | 470 + releases/go/mpl/StormTracker/StormTracker.go | 729 + .../mpl/StormTrackingCMC/StormTrackingCMC.go | 232 + releases/go/mpl/StormTrackingCMC/externs.go | 86 + .../StrictMultiKeyring/StrictMultiKeyring.go | 381 + releases/go/mpl/Structure/Structure.go | 602 + .../SynchronizedLocalCMC.go | 185 + .../go/mpl/SynchronizedLocalCMC/externs.go | 63 + releases/go/mpl/Utils/Utils.go | 282 + .../api_client.go | 164 + .../to_dafny.go | 612 + .../to_native.go | 763 ++ .../errors.go | 17 + .../types.go | 436 + .../unmodelled_errors.go | 26 + .../BranchKeyIdSupplier.go | 25 + .../BranchKeyIdSupplierNativeWrapper.go | 23 + .../ClientSupplier.go | 27 + .../ClientSupplierNativeWrapper.go | 23 + .../CryptographicMaterialsCache.go | 58 + ...ryptographicMaterialsCacheNativeWrapper.go | 51 + .../CryptographicMaterialsManager.go | 38 + ...ptographicMaterialsManagerNativeWrapper.go | 32 + .../Keyring.go | 38 + .../KeyringNativeWrapper.go | 32 + .../api_client.go | 653 + .../to_dafny.go | 3227 +++++ .../to_native.go | 3607 +++++ .../enums.go | 127 + .../errors.go | 117 + .../types.go | 2357 ++++ .../unmodelled_errors.go | 26 + releases/go/mpl/go.mod | 34 + releases/go/mpl/go.sum | 56 + 85 files changed, 59990 insertions(+) create mode 100644 releases/go/mpl/AlgorithmSuites/AlgorithmSuites.go create mode 100644 releases/go/mpl/AwsArnParsing/AwsArnParsing.go create mode 100644 releases/go/mpl/AwsCryptographyKeyStoreOperations/AwsCryptographyKeyStoreOperations.go create mode 100644 releases/go/mpl/AwsCryptographyKeyStoreTypes/AwsCryptographyKeyStoreTypes.go create mode 100644 releases/go/mpl/AwsCryptographyMaterialProvidersOperations/AwsCryptographyMaterialProvidersOperations.go create mode 100644 releases/go/mpl/AwsCryptographyMaterialProvidersTypes/AwsCryptographyMaterialProvidersTypes.go create mode 100644 releases/go/mpl/AwsKmsDiscoveryKeyring/AwsKmsDiscoveryKeyring.go create mode 100644 releases/go/mpl/AwsKmsEcdhKeyring/AwsKmsEcdhKeyring.go create mode 100644 releases/go/mpl/AwsKmsHierarchicalKeyring/AwsKmsHierarchicalKeyring.go create mode 100644 releases/go/mpl/AwsKmsKeyring/AwsKmsKeyring.go create mode 100644 releases/go/mpl/AwsKmsMrkAreUnique/AwsKmsMrkAreUnique.go create mode 100644 releases/go/mpl/AwsKmsMrkDiscoveryKeyring/AwsKmsMrkDiscoveryKeyring.go create mode 100644 releases/go/mpl/AwsKmsMrkKeyring/AwsKmsMrkKeyring.go create mode 100644 releases/go/mpl/AwsKmsMrkMatchForDecrypt/AwsKmsMrkMatchForDecrypt.go create mode 100644 releases/go/mpl/AwsKmsRsaKeyring/AwsKmsRsaKeyring.go create mode 100644 releases/go/mpl/AwsKmsUtils/AwsKmsUtils.go create mode 100644 releases/go/mpl/CHANGELOG.md create mode 100644 releases/go/mpl/CMM/CMM.go create mode 100644 releases/go/mpl/CacheConstants/CacheConstants.go create mode 100644 releases/go/mpl/CanonicalEncryptionContext/CanonicalEncryptionContext.go create mode 100644 releases/go/mpl/Commitment/Commitment.go create mode 100644 releases/go/mpl/Constants/Constants.go create mode 100644 releases/go/mpl/CreateKeyStoreTable/CreateKeyStoreTable.go create mode 100644 releases/go/mpl/CreateKeys/CreateKeys.go create mode 100644 releases/go/mpl/DDBKeystoreOperations/DDBKeystoreOperations.go create mode 100644 releases/go/mpl/DefaultCMM/DefaultCMM.go create mode 100644 releases/go/mpl/DefaultClientSupplier/DefaultClientSupplier.go create mode 100644 releases/go/mpl/Defaults/Defaults.go create mode 100644 releases/go/mpl/DiscoveryMultiKeyring/DiscoveryMultiKeyring.go create mode 100644 releases/go/mpl/EcdhEdkWrapping/EcdhEdkWrapping.go create mode 100644 releases/go/mpl/EdkWrapping/EdkWrapping.go create mode 100644 releases/go/mpl/ErrorMessages/ErrorMessages.go create mode 100644 releases/go/mpl/GetKeys/GetKeys.go create mode 100644 releases/go/mpl/IntermediateKeyWrapping/IntermediateKeyWrapping.go create mode 100644 releases/go/mpl/KMSKeystoreOperations/KMSKeystoreOperations.go create mode 100644 releases/go/mpl/KeyStore/KeyStore.go create mode 100644 releases/go/mpl/KeyStoreErrorMessages/KeyStoreErrorMessages.go create mode 100644 releases/go/mpl/Keyring/Keyring.go create mode 100644 releases/go/mpl/KmsArn/KmsArn.go create mode 100644 releases/go/mpl/LICENSE create mode 100644 releases/go/mpl/LocalCMC/LocalCMC.go create mode 100644 releases/go/mpl/MaterialProviders/MaterialProviders.go create mode 100644 releases/go/mpl/MaterialWrapping/MaterialWrapping.go create mode 100644 releases/go/mpl/Materials/Materials.go create mode 100644 releases/go/mpl/MrkAwareDiscoveryMultiKeyring/MrkAwareDiscoveryMultiKeyring.go create mode 100644 releases/go/mpl/MrkAwareStrictMultiKeyring/MrkAwareStrictMultiKeyring.go create mode 100644 releases/go/mpl/MultiKeyring/MultiKeyring.go create mode 100644 releases/go/mpl/README.md create mode 100644 releases/go/mpl/RawAESKeyring/RawAESKeyring.go create mode 100644 releases/go/mpl/RawECDHKeyring/RawECDHKeyring.go create mode 100644 releases/go/mpl/RawRSAKeyring/RawRSAKeyring.go create mode 100644 releases/go/mpl/RequiredEncryptionContextCMM/RequiredEncryptionContextCMM.go create mode 100644 releases/go/mpl/StormTracker/StormTracker.go create mode 100644 releases/go/mpl/StormTrackingCMC/StormTrackingCMC.go create mode 100644 releases/go/mpl/StormTrackingCMC/externs.go create mode 100644 releases/go/mpl/StrictMultiKeyring/StrictMultiKeyring.go create mode 100644 releases/go/mpl/Structure/Structure.go create mode 100644 releases/go/mpl/SynchronizedLocalCMC/SynchronizedLocalCMC.go create mode 100644 releases/go/mpl/SynchronizedLocalCMC/externs.go create mode 100644 releases/go/mpl/Utils/Utils.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygenerated/api_client.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygenerated/to_dafny.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygenerated/to_native.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/errors.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/types.go create mode 100644 releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/unmodelled_errors.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplier.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplierNativeWrapper.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplier.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplierNativeWrapper.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCache.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCacheNativeWrapper.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManager.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManagerNativeWrapper.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/Keyring.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/KeyringNativeWrapper.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/api_client.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_dafny.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_native.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/enums.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/errors.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/types.go create mode 100644 releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/unmodelled_errors.go create mode 100644 releases/go/mpl/go.mod create mode 100644 releases/go/mpl/go.sum diff --git a/releases/go/mpl/AlgorithmSuites/AlgorithmSuites.go b/releases/go/mpl/AlgorithmSuites/AlgorithmSuites.go new file mode 100644 index 000000000..811030d55 --- /dev/null +++ b/releases/go/mpl/AlgorithmSuites/AlgorithmSuites.go @@ -0,0 +1,471 @@ +// Package AlgorithmSuites +// Dafny module AlgorithmSuites compiled into Go + +package AlgorithmSuites + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AlgorithmSuites.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) SupportedESDKEncrypt_q(e m_AwsCryptographyMaterialProvidersTypes.Encrypt) bool { + return (((true) && ((((((e).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32))) || ((((e).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(24)))) || ((((e).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(16))))) && ((((e).Dtor_AES__GCM()).Dtor_tagLength()) == (int32(16)))) && ((((e).Dtor_AES__GCM()).Dtor_ivLength()) == (int32(12))) +} +func (_static *CompanionStruct_Default___) SupportedDBEEncrypt_q(e m_AwsCryptographyMaterialProvidersTypes.Encrypt) bool { + return (((true) && ((((e).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && ((((e).Dtor_AES__GCM()).Dtor_tagLength()) == (int32(16)))) && ((((e).Dtor_AES__GCM()).Dtor_ivLength()) == (int32(12))) +} +func (_static *CompanionStruct_Default___) SupportedDBEEDKWrapping_q(p m_AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm) bool { + return (((((((p).Is_IntermediateKeyWrapping()) && (true)) && ((((((p).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && ((((((p).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_tagLength()) == (int32(16)))) && ((((((p).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_ivLength()) == (int32(12)))) && ((((p).Dtor_IntermediateKeyWrapping()).Dtor_macKeyKdf()).Is_HKDF())) && ((((p).Dtor_IntermediateKeyWrapping()).Dtor_keyEncryptionKeyKdf()).Is_HKDF()) +} +func (_static *CompanionStruct_Default___) KeyDerivationAlgorithm_q(kdf m_AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm) bool { + return (!((true) && ((kdf).Is_HKDF())) || (((((kdf).Dtor_HKDF()).Dtor_inputKeyLength()) == (((kdf).Dtor_HKDF()).Dtor_outputKeyLength())) && (!((((kdf).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_())) || ((((kdf).Dtor_HKDF()).Dtor_inputKeyLength()) == (int32(32)))))) && (!((kdf).Is_None())) +} +func (_static *CompanionStruct_Default___) CommitmentDerivationAlgorithm_q(kdf m_AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm) bool { + return (!((true) && ((kdf).Is_HKDF())) || (((((((kdf).Dtor_HKDF()).Dtor_hmac()).Is_SHA__512()) && ((((kdf).Dtor_HKDF()).Dtor_saltLength()) == (int32(32)))) && ((((kdf).Dtor_HKDF()).Dtor_inputKeyLength()) == (int32(32)))) && ((((kdf).Dtor_HKDF()).Dtor_outputKeyLength()) == (int32(32))))) && (!((kdf).Is_IDENTITY())) +} +func (_static *CompanionStruct_Default___) EdkWrappingAlgorithm_q(alg m_AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm) bool { + return ((((((alg).Is_IntermediateKeyWrapping()) && ((((alg).Dtor_IntermediateKeyWrapping()).Dtor_keyEncryptionKeyKdf()).Is_HKDF())) && ((((alg).Dtor_IntermediateKeyWrapping()).Dtor_macKeyKdf()).Is_HKDF())) && (true)) && ((((((alg).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) || ((alg).Is_DIRECT__KEY__WRAPPING()) +} +func (_static *CompanionStruct_Default___) AlgorithmSuiteInfo_q(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return ((((((((Companion_Default___.KeyDerivationAlgorithm_q((a).Dtor_kdf())) && (Companion_Default___.CommitmentDerivationAlgorithm_q((a).Dtor_commitment()))) && (Companion_Default___.EdkWrappingAlgorithm_q((a).Dtor_edkWrapping()))) && (!(((a).Dtor_kdf()).Is_HKDF()) || ((true) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_outputKeyLength()) == ((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()))))) && (!(((a).Dtor_signature()).Is_ECDSA()) || (((a).Dtor_kdf()).Is_HKDF()))) && (!(((a).Dtor_commitment()).Is_HKDF()) || ((((((a).Dtor_commitment()).Dtor_HKDF()).Dtor_saltLength()) == (int32(32))) && (((a).Dtor_commitment()).Equals((a).Dtor_kdf()))))) && (!(((a).Dtor_edkWrapping()).Is_IntermediateKeyWrapping()) || (((((a).Dtor_kdf()).Is_HKDF()) && (((((a).Dtor_edkWrapping()).Dtor_IntermediateKeyWrapping()).Dtor_keyEncryptionKeyKdf()).Equals((a).Dtor_kdf()))) && (((((a).Dtor_edkWrapping()).Dtor_IntermediateKeyWrapping()).Dtor_macKeyKdf()).Equals((a).Dtor_kdf()))))) && (!((((a).Dtor_kdf()).Is_HKDF()) && (((a).Dtor_commitment()).Is_None())) || (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_saltLength()) == (int32(0))))) && (!(!(((a).Dtor_symmetricSignature()).Is_None())) || ((true) && (((a).Dtor_edkWrapping()).Is_IntermediateKeyWrapping()))) +} +func (_static *CompanionStruct_Default___) ESDKAlgorithmSuite_q(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return ((Companion_Default___.AlgorithmSuiteInfo_q(a)) && (Companion_Default___.SupportedESDKEncrypt_q((a).Dtor_encrypt()))) && (func() bool { + var _source0 m_AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId = ((a).Dtor_id()).Dtor_ESDK() + _ = _source0 + { + if _source0.Is_ALG__AES__128__GCM__IV12__TAG16__NO__KDF() { + return ((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(0), uint8(20)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(16)))) && (((a).Dtor_kdf()).Is_IDENTITY())) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__192__GCM__IV12__TAG16__NO__KDF() { + return ((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(0), uint8(70)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(24)))) && (((a).Dtor_kdf()).Is_IDENTITY())) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__256__GCM__IV12__TAG16__NO__KDF() { + return ((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(0), uint8(120)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_IDENTITY())) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256() { + return (((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(1), uint8(20)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(16)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_()))) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256() { + return (((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(1), uint8(70)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(24)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_()))) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256() { + return (((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(1), uint8(120)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_()))) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256() { + return ((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(2), uint8(20)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(16)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_()))) && (((a).Dtor_signature()).Is_ECDSA())) && (((((a).Dtor_signature()).Dtor_ECDSA()).Dtor_curve()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P256_()))) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() { + return ((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(3), uint8(70)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(24)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()))) && (((a).Dtor_signature()).Is_ECDSA())) && (((((a).Dtor_signature()).Dtor_ECDSA()).Dtor_curve()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_()))) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() { + return ((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(3), uint8(120)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()))) && (((a).Dtor_signature()).Is_ECDSA())) && (((((a).Dtor_signature()).Dtor_ECDSA()).Dtor_curve()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_()))) && (((a).Dtor_commitment()).Is_None())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + if _source0.Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY() { + return (((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(4), uint8(120)))) && (((a).Dtor_messageVersion()) == (int32(2)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_()))) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_HKDF())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + } + { + return ((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(5), uint8(120)))) && (((a).Dtor_messageVersion()) == (int32(2)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_()))) && (((a).Dtor_signature()).Is_ECDSA())) && (((((a).Dtor_signature()).Dtor_ECDSA()).Dtor_curve()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_()))) && (((a).Dtor_commitment()).Is_HKDF())) && (((a).Dtor_symmetricSignature()).Is_None())) && (((a).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) + } + }()) +} +func (_static *CompanionStruct_Default___) DBEAlgorithmSuite_q(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return (((Companion_Default___.AlgorithmSuiteInfo_q(a)) && (Companion_Default___.SupportedDBEEncrypt_q((a).Dtor_encrypt()))) && (Companion_Default___.SupportedDBEEDKWrapping_q((a).Dtor_edkWrapping()))) && (func() bool { + var _source0 m_AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId = ((a).Dtor_id()).Dtor_DBE() + _ = _source0 + { + if _source0.Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384() { + return ((((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(103), uint8(0)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_()))) && (((a).Dtor_signature()).Is_None())) && (((a).Dtor_commitment()).Is_HKDF())) && (((a).Dtor_symmetricSignature()).Is_HMAC())) && ((((a).Dtor_symmetricSignature()).Dtor_HMAC()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()))) && (((a).Dtor_edkWrapping()).Is_IntermediateKeyWrapping())) && (true)) && (((((((a).Dtor_edkWrapping()).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32))) + } + } + { + return (((((((((((((_dafny.Companion_Sequence_.Equal((a).Dtor_binaryId(), _dafny.SeqOf(uint8(103), uint8(1)))) && (((a).Dtor_messageVersion()) == (int32(1)))) && (true)) && (((((a).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32)))) && (((a).Dtor_kdf()).Is_HKDF())) && (((((a).Dtor_kdf()).Dtor_HKDF()).Dtor_hmac()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_()))) && (((a).Dtor_signature()).Is_ECDSA())) && (((((a).Dtor_signature()).Dtor_ECDSA()).Dtor_curve()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_()))) && (((a).Dtor_commitment()).Is_HKDF())) && (((a).Dtor_symmetricSignature()).Is_HMAC())) && ((((a).Dtor_symmetricSignature()).Dtor_HMAC()).Equals(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()))) && (((a).Dtor_edkWrapping()).Is_IntermediateKeyWrapping())) && (true)) && (((((((a).Dtor_edkWrapping()).Dtor_IntermediateKeyWrapping()).Dtor_pdkEncryptAlgorithm()).Dtor_AES__GCM()).Dtor_keyLength()) == (int32(32))) + } + }()) +} +func (_static *CompanionStruct_Default___) AlgorithmSuite_q(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + var _source0 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId = (a).Dtor_id() + _ = _source0 + { + if _source0.Is_ESDK() { + return Companion_Default___.ESDKAlgorithmSuite_q(a) + } + } + { + return Companion_Default___.DBEAlgorithmSuite_q(a) + } +} +func (_static *CompanionStruct_Default___) HKDF__SHA__256(keyLength int32) m_AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_HKDF_(m_AwsCryptographyMaterialProvidersTypes.Companion_HKDF_.Create_HKDF_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_(), int32(0), keyLength, keyLength)) +} +func (_static *CompanionStruct_Default___) HKDF__SHA__384(keyLength int32) m_AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_HKDF_(m_AwsCryptographyMaterialProvidersTypes.Companion_HKDF_.Create_HKDF_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_(), int32(0), keyLength, keyLength)) +} +func (_static *CompanionStruct_Default___) HKDF__SHA__512(keyLength int32) m_AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_HKDF_(m_AwsCryptographyMaterialProvidersTypes.Companion_HKDF_.Create_HKDF_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__512_(), int32(32), keyLength, keyLength)) +} +func (_static *CompanionStruct_Default___) GetSuite(id m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId) m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + var _source0 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId = id + _ = _source0 + { + if _source0.Is_ESDK() { + var _0_e m_AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId_ESDK).ESDK + _ = _0_e + return Companion_Default___.GetESDKSuite(_0_e) + } + } + { + var _1_e m_AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId_DBE).DBE + _ = _1_e + return Companion_Default___.GetDBESuite(_1_e) + } +} +func (_static *CompanionStruct_Default___) GetDBESuite(id m_AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId) m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return (Companion_Default___.SupportedDBEAlgorithmSuites()).Get(id).(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) +} +func (_static *CompanionStruct_Default___) GetESDKSuite(id m_AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId) m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return (Companion_Default___.SupportedESDKAlgorithmSuites()).Get(id).(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) +} +func (_static *CompanionStruct_Default___) GetEncryptKeyLength(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) int32 { + var _source0 m_AwsCryptographyMaterialProvidersTypes.Encrypt = (a).Dtor_encrypt() + _ = _source0 + { + var _0_e m_AwsCryptographyPrimitivesTypes.AES__GCM = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.Encrypt_AES__GCM).AES__GCM + _ = _0_e + return (_0_e).Dtor_keyLength() + } +} +func (_static *CompanionStruct_Default___) GetEncryptTagLength(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) int32 { + var _source0 m_AwsCryptographyMaterialProvidersTypes.Encrypt = (a).Dtor_encrypt() + _ = _source0 + { + var _0_e m_AwsCryptographyPrimitivesTypes.AES__GCM = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.Encrypt_AES__GCM).AES__GCM + _ = _0_e + return (_0_e).Dtor_tagLength() + } +} +func (_static *CompanionStruct_Default___) GetEncryptIvLength(a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) int32 { + var _source0 m_AwsCryptographyMaterialProvidersTypes.Encrypt = (a).Dtor_encrypt() + _ = _source0 + { + var _0_e m_AwsCryptographyPrimitivesTypes.AES__GCM = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.Encrypt_AES__GCM).AES__GCM + _ = _0_e + return (_0_e).Dtor_ivLength() + } +} +func (_static *CompanionStruct_Default___) GetAlgorithmSuiteInfo(binaryId_q _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((Companion_Default___.AlgorithmSuiteInfoByBinaryId()).Contains(binaryId_q), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid BinaryId"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_((Companion_Default___.AlgorithmSuiteInfoByBinaryId()).Get(binaryId_q).(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo)) + } +} +func (_static *CompanionStruct_Default___) Bits128() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) TagLen() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) IvLen() int32 { + return int32(12) +} +func (_static *CompanionStruct_Default___) AES__128__GCM__IV12__TAG16() m_AwsCryptographyMaterialProvidersTypes.Encrypt { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Encrypt_.Create_AES__GCM_(m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(Companion_Default___.Bits128(), Companion_Default___.TagLen(), Companion_Default___.IvLen())) +} +func (_static *CompanionStruct_Default___) Bits192() int32 { + return int32(24) +} +func (_static *CompanionStruct_Default___) AES__192__GCM__IV12__TAG16() m_AwsCryptographyMaterialProvidersTypes.Encrypt { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Encrypt_.Create_AES__GCM_(m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(Companion_Default___.Bits192(), Companion_Default___.TagLen(), Companion_Default___.IvLen())) +} +func (_static *CompanionStruct_Default___) Bits256() int32 { + return int32(32) +} +func (_static *CompanionStruct_Default___) AES__256__GCM__IV12__TAG16() m_AwsCryptographyMaterialProvidersTypes.Encrypt { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Encrypt_.Create_AES__GCM_(m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(Companion_Default___.Bits256(), Companion_Default___.TagLen(), Companion_Default___.IvLen())) +} +func (_static *CompanionStruct_Default___) EDK__INTERMEDIATE__WRAPPING__AES__GCM__256__HKDF__SHA__512() m_AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm { + return m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_IntermediateKeyWrapping_(m_AwsCryptographyMaterialProvidersTypes.Companion_IntermediateKeyWrapping_.Create_IntermediateKeyWrapping_(Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.AES__256__GCM__IV12__TAG16())) +} +func (_static *CompanionStruct_Default___) DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_DBE_(m_AwsCryptographyMaterialProvidersTypes.Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384_()), _dafny.SeqOf(uint8(103), uint8(0)), int32(1), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_HMAC_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()), Companion_Default___.EDK__INTERMEDIATE__WRAPPING__AES__GCM__256__HKDF__SHA__512()) +} +func (_static *CompanionStruct_Default___) DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_DBE_(m_AwsCryptographyMaterialProvidersTypes.Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384_()), _dafny.SeqOf(uint8(103), uint8(1)), int32(1), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_ECDSA_(m_AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_())), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_HMAC_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_()), Companion_Default___.EDK__INTERMEDIATE__WRAPPING__AES__GCM__256__HKDF__SHA__512()) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__128__GCM__IV12__TAG16__NO__KDF() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__NO__KDF_()), _dafny.SeqOf(uint8(0), uint8(20)), int32(1), Companion_Default___.AES__128__GCM__IV12__TAG16(), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_IDENTITY_(m_AwsCryptographyMaterialProvidersTypes.Companion_IDENTITY_.Create_IDENTITY_()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__192__GCM__IV12__TAG16__NO__KDF() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__NO__KDF_()), _dafny.SeqOf(uint8(0), uint8(70)), int32(1), Companion_Default___.AES__192__GCM__IV12__TAG16(), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_IDENTITY_(m_AwsCryptographyMaterialProvidersTypes.Companion_IDENTITY_.Create_IDENTITY_()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__256__GCM__IV12__TAG16__NO__KDF() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__NO__KDF_()), _dafny.SeqOf(uint8(0), uint8(120)), int32(1), Companion_Default___.AES__256__GCM__IV12__TAG16(), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_IDENTITY_(m_AwsCryptographyMaterialProvidersTypes.Companion_IDENTITY_.Create_IDENTITY_()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256_()), _dafny.SeqOf(uint8(1), uint8(20)), int32(1), Companion_Default___.AES__128__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__256(Companion_Default___.Bits128()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256_()), _dafny.SeqOf(uint8(1), uint8(70)), int32(1), Companion_Default___.AES__192__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__256(Companion_Default___.Bits192()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256_()), _dafny.SeqOf(uint8(1), uint8(120)), int32(1), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__256(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256_()), _dafny.SeqOf(uint8(2), uint8(20)), int32(1), Companion_Default___.AES__128__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__256(Companion_Default___.Bits128()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_ECDSA_(m_AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P256_())), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_()), _dafny.SeqOf(uint8(3), uint8(70)), int32(1), Companion_Default___.AES__192__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__384(Companion_Default___.Bits192()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_ECDSA_(m_AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_())), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_()), _dafny.SeqOf(uint8(3), uint8(120)), int32(1), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__384(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_DerivationAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_ECDSA_(m_AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_())), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY_()), _dafny.SeqOf(uint8(4), uint8(120)), int32(2), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384_()), _dafny.SeqOf(uint8(5), uint8(120)), int32(2), Companion_Default___.AES__256__GCM__IV12__TAG16(), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), Companion_Default___.HKDF__SHA__512(Companion_Default___.Bits256()), m_AwsCryptographyMaterialProvidersTypes.Companion_SignatureAlgorithm_.Create_ECDSA_(m_AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Create_ECDSA__P384_())), m_AwsCryptographyMaterialProvidersTypes.Companion_SymmetricSignatureAlgorithm_.Create_None_(m_AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()), m_AwsCryptographyMaterialProvidersTypes.Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(m_AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_())) +} +func (_static *CompanionStruct_Default___) SupportedESDKAlgorithmSuites() _dafny.Map { + return _dafny.NewMapBuilder().ToMap().UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__NO__KDF_(), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__NO__KDF_(), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__NO__KDF_(), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256_(), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256_(), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256_(), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256_(), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_(), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_(), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY_(), Companion_Default___.ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384_(), Companion_Default___.ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384()) +} +func (_static *CompanionStruct_Default___) SupportedDBEAlgorithmSuites() _dafny.Map { + return _dafny.NewMapBuilder().ToMap().UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384_(), Companion_Default___.DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384()).UpdateUnsafe(m_AwsCryptographyMaterialProvidersTypes.Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384_(), Companion_Default___.DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384()) +} +func (_static *CompanionStruct_Default___) AlgorithmSuiteInfoByBinaryId() _dafny.Map { + return _dafny.NewMapBuilder().ToMap().UpdateUnsafe(_dafny.SeqOf(uint8(0), uint8(20)), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(_dafny.SeqOf(uint8(0), uint8(70)), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(_dafny.SeqOf(uint8(0), uint8(120)), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__NO__KDF()).UpdateUnsafe(_dafny.SeqOf(uint8(1), uint8(20)), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(_dafny.SeqOf(uint8(1), uint8(70)), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(_dafny.SeqOf(uint8(1), uint8(120)), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256()).UpdateUnsafe(_dafny.SeqOf(uint8(2), uint8(20)), Companion_Default___.ESDK__ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256()).UpdateUnsafe(_dafny.SeqOf(uint8(3), uint8(70)), Companion_Default___.ESDK__ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384()).UpdateUnsafe(_dafny.SeqOf(uint8(3), uint8(120)), Companion_Default___.ESDK__ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384()).UpdateUnsafe(_dafny.SeqOf(uint8(4), uint8(120)), Companion_Default___.ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY()).UpdateUnsafe(_dafny.SeqOf(uint8(5), uint8(120)), Companion_Default___.ESDK__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384()).UpdateUnsafe(_dafny.SeqOf(uint8(103), uint8(0)), Companion_Default___.DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384()).UpdateUnsafe(_dafny.SeqOf(uint8(103), uint8(1)), Companion_Default___.DBE__ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384()) +} + +// End of class Default__ + +// Definition of class AlgorithmSuite +type AlgorithmSuite struct { +} + +func New_AlgorithmSuite_() *AlgorithmSuite { + _this := AlgorithmSuite{} + + return &_this +} + +type CompanionStruct_AlgorithmSuite_ struct { +} + +var Companion_AlgorithmSuite_ = CompanionStruct_AlgorithmSuite_{} + +func (*AlgorithmSuite) String() string { + return "AlgorithmSuites.AlgorithmSuite" +} + +// End of class AlgorithmSuite + +func Type_AlgorithmSuite_() _dafny.TypeDescriptor { + return type_AlgorithmSuite_{} +} + +type type_AlgorithmSuite_ struct { +} + +func (_this type_AlgorithmSuite_) Default() interface{} { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Default() +} + +func (_this type_AlgorithmSuite_) String() string { + return "AlgorithmSuites.AlgorithmSuite" +} +func (_this *CompanionStruct_AlgorithmSuite_) Is_(__source m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + var _0_a m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = (__source) + _ = _0_a + return Companion_Default___.AlgorithmSuite_q(_0_a) +} diff --git a/releases/go/mpl/AwsArnParsing/AwsArnParsing.go b/releases/go/mpl/AwsArnParsing/AwsArnParsing.go new file mode 100644 index 000000000..51002acf1 --- /dev/null +++ b/releases/go/mpl/AwsArnParsing/AwsArnParsing.go @@ -0,0 +1,1135 @@ +// Package AwsArnParsing +// Dafny module AwsArnParsing compiled into Go + +package AwsArnParsing + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsArnParsing.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ValidAwsKmsResource(resource AwsResource) bool { + return ((resource).Valid()) && ((_dafny.Companion_Sequence_.Equal((resource).Dtor_resourceType(), _dafny.SeqOfString("key"))) || (_dafny.Companion_Sequence_.Equal((resource).Dtor_resourceType(), _dafny.SeqOfString("alias")))) +} +func (_static *CompanionStruct_Default___) ValidAwsKmsArn(arn AwsArn) bool { + return (((arn).Valid()) && (_dafny.Companion_Sequence_.Equal((arn).Dtor_service(), _dafny.SeqOfString("kms")))) && (Companion_Default___.ValidAwsKmsResource((arn).Dtor_resource())) +} +func (_static *CompanionStruct_Default___) ParseAwsKmsRawResources(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_info _dafny.Sequence = m_StandardLibrary.Companion_Default___.Split(identifier, _dafny.Char('/')) + _ = _0_info + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(!_dafny.Companion_Sequence_.Equal((_0_info).Select(0).(_dafny.Sequence), _dafny.SeqOfString("key")), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed raw key id: "), identifier)) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else if (_dafny.IntOfUint32((_0_info).Cardinality())).Cmp(_dafny.One) == 0 { + return Companion_Default___.ParseAwsKmsResources(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("key/"), identifier)) + } else { + return Companion_Default___.ParseAwsKmsResources(identifier) + } +} +func (_static *CompanionStruct_Default___) ParseAwsKmsResources(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_info _dafny.Sequence = m_StandardLibrary.Companion_Default___.Split(identifier, _dafny.Char('/')) + _ = _0_info + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_0_info).Cardinality())).Cmp(_dafny.One) > 0, _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed resource: "), identifier)) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_resourceType _dafny.Sequence = (_0_info).Select(0).(_dafny.Sequence) + _ = _2_resourceType + var _3_value _dafny.Sequence = m_StandardLibrary.Companion_Default___.Join((_0_info).Drop(1), _dafny.SeqOfString("/")) + _ = _3_value + var _4_resource AwsResource = Companion_AwsResource_.Create_AwsResource_(_2_resourceType, _3_value) + _ = _4_resource + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidAwsKmsResource(_4_resource), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed resource: "), identifier)) + _ = _5_valueOrError1 + if (_5_valueOrError1).IsFailure() { + return (_5_valueOrError1).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_4_resource) + } + } +} +func (_static *CompanionStruct_Default___) ValidAmazonDynamodbResource(resource AwsResource) bool { + return ((resource).Valid()) && (_dafny.Companion_Sequence_.Equal((resource).Dtor_resourceType(), _dafny.SeqOfString("table"))) +} +func (_static *CompanionStruct_Default___) ValidAmazonDynamodbArn(arn AwsArn) bool { + return (((arn).Valid()) && (_dafny.Companion_Sequence_.Equal((arn).Dtor_service(), _dafny.SeqOfString("dynamodb")))) && (Companion_Default___.ValidAmazonDynamodbResource((arn).Dtor_resource())) +} +func (_static *CompanionStruct_Default___) ParseAmazonDynamodbResources(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_info m_Wrappers.Option = m_StandardLibrary.Companion_Default___.SplitOnce_q(identifier, _dafny.Char('/')) + _ = _0_info + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_0_info).Is_Some(), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed resource: "), identifier)) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_resourceType _dafny.Sequence = (*((_0_info).Dtor_value().(_dafny.Tuple)).IndexInt(0)).(_dafny.Sequence) + _ = _2_resourceType + var _3_value _dafny.Sequence = (*((_0_info).Dtor_value().(_dafny.Tuple)).IndexInt(1)).(_dafny.Sequence) + _ = _3_value + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__TableName(_3_value), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Table Name invalid: "), identifier)) + _ = _4_valueOrError1 + if (_4_valueOrError1).IsFailure() { + return (_4_valueOrError1).PropagateFailure() + } else { + var _5_resource AwsResource = Companion_AwsResource_.Create_AwsResource_(_2_resourceType, _3_value) + _ = _5_resource + var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidAmazonDynamodbResource(_5_resource), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed resource: "), identifier)) + _ = _6_valueOrError2 + if (_6_valueOrError2).IsFailure() { + return (_6_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_5_resource) + } + } + } +} +func (_static *CompanionStruct_Default___) ParseAwsKmsArn(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_components _dafny.Sequence = m_StandardLibrary.Companion_Default___.Split(identifier, _dafny.Char(':')) + _ = _0_components + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt64(6)).Cmp(_dafny.IntOfUint32((_0_components).Cardinality())) == 0, _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed arn: "), identifier)) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_valueOrError1 m_Wrappers.Result = Companion_Default___.ParseAwsKmsResources((_0_components).Select(5).(_dafny.Sequence)) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_resource AwsResource = (_2_valueOrError1).Extract().(AwsResource) + _ = _3_resource + var _4_arn AwsArn = Companion_AwsArn_.Create_AwsArn_((_0_components).Select(0).(_dafny.Sequence), (_0_components).Select(1).(_dafny.Sequence), (_0_components).Select(2).(_dafny.Sequence), (_0_components).Select(3).(_dafny.Sequence), (_0_components).Select(4).(_dafny.Sequence), _3_resource) + _ = _4_arn + var _5_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidAwsKmsArn(_4_arn), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed Arn:"), identifier)) + _ = _5_valueOrError2 + if (_5_valueOrError2).IsFailure() { + return (_5_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_4_arn) + } + } + } +} +func (_static *CompanionStruct_Default___) ParseAmazonDynamodbTableArn(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_components _dafny.Sequence = m_StandardLibrary.Companion_Default___.Split(identifier, _dafny.Char(':')) + _ = _0_components + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt64(6)).Cmp(_dafny.IntOfUint32((_0_components).Cardinality())) == 0, _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed arn: "), identifier)) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_valueOrError1 m_Wrappers.Result = Companion_Default___.ParseAmazonDynamodbResources((_0_components).Select(5).(_dafny.Sequence)) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_resource AwsResource = (_2_valueOrError1).Extract().(AwsResource) + _ = _3_resource + var _4_arn AwsArn = Companion_AwsArn_.Create_AwsArn_((_0_components).Select(0).(_dafny.Sequence), (_0_components).Select(1).(_dafny.Sequence), (_0_components).Select(2).(_dafny.Sequence), (_0_components).Select(3).(_dafny.Sequence), (_0_components).Select(4).(_dafny.Sequence), _3_resource) + _ = _4_arn + var _5_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidAmazonDynamodbArn(_4_arn), _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Malformed Arn:"), identifier)) + _ = _5_valueOrError2 + if (_5_valueOrError2).IsFailure() { + return (_5_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_4_arn) + } + } + } +} +func (_static *CompanionStruct_Default___) ParseAwsKmsIdentifier(identifier _dafny.Sequence) m_Wrappers.Result { + if _dafny.Companion_Sequence_.IsPrefixOf(_dafny.SeqOfString("arn:"), identifier) { + var _0_valueOrError0 m_Wrappers.Result = Companion_Default___.ParseAwsKmsArn(identifier) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_arn AwsArn = (_0_valueOrError0).Extract().(AwsArn) + _ = _1_arn + return m_Wrappers.Companion_Result_.Create_Success_(Companion_AwsKmsIdentifier_.Create_AwsKmsArnIdentifier_(_1_arn)) + } + } else { + var _2_valueOrError1 m_Wrappers.Result = Companion_Default___.ParseAwsKmsRawResources(identifier) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_r AwsResource = (_2_valueOrError1).Extract().(AwsResource) + _ = _3_r + return m_Wrappers.Companion_Result_.Create_Success_(Companion_AwsKmsIdentifier_.Create_AwsKmsRawResourceIdentifier_(_3_r)) + } + } +} +func (_static *CompanionStruct_Default___) ParseAmazonDynamodbTableName(identifier _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = Companion_Default___.ParseAmazonDynamodbTableArn(identifier) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_arn AwsArn = (_0_valueOrError0).Extract().(AwsArn) + _ = _1_arn + var _2_tableArn AmazonDynamodbTableName = Companion_AmazonDynamodbTableName_.Create_AmazonDynamodbTableArn_(_1_arn) + _ = _2_tableArn + var _3_tableName _dafny.Sequence = (_2_tableArn).GetTableName() + _ = _3_tableName + return m_Wrappers.Companion_Result_.Create_Success_(_3_tableName) + } +} +func (_static *CompanionStruct_Default___) IsMultiRegionAwsKmsArn(arn AwsArn) bool { + return Companion_Default___.IsMultiRegionAwsKmsResource((arn).Dtor_resource()) +} +func (_static *CompanionStruct_Default___) IsMultiRegionAwsKmsIdentifier(identifier AwsKmsIdentifier) bool { + var _source0 AwsKmsIdentifier = identifier + _ = _source0 + { + if _source0.Is_AwsKmsArnIdentifier() { + var _0_arn AwsArn = _source0.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _0_arn + return Companion_Default___.IsMultiRegionAwsKmsArn(_0_arn) + } + } + { + var _1_r AwsResource = _source0.Get_().(AwsKmsIdentifier_AwsKmsRawResourceIdentifier).R + _ = _1_r + return Companion_Default___.IsMultiRegionAwsKmsResource(_1_r) + } +} +func (_static *CompanionStruct_Default___) IsMultiRegionAwsKmsResource(resource AwsResource) bool { + return (_dafny.Companion_Sequence_.Equal((resource).Dtor_resourceType(), _dafny.SeqOfString("key"))) && (_dafny.Companion_Sequence_.IsPrefixOf(_dafny.SeqOfString("mrk-"), (resource).Dtor_value())) +} +func (_static *CompanionStruct_Default___) GetRegion(identifier AwsKmsIdentifier) m_Wrappers.Option { + var _source0 AwsKmsIdentifier = identifier + _ = _source0 + { + if _source0.Is_AwsKmsArnIdentifier() { + var _0_a AwsArn = _source0.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _0_a + return m_Wrappers.Companion_Option_.Create_Some_((_0_a).Dtor_region()) + } + } + { + return m_Wrappers.Companion_Option_.Create_None_() + } +} +func (_static *CompanionStruct_Default___) IsAwsKmsIdentifierString(s _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.IsASCIIString(s), _dafny.SeqOfString("Not a valid ASCII string.")) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((s).Cardinality())).Sign() == 1) && ((_dafny.IntOfUint32((s).Cardinality())).Cmp(Companion_Default___.MAX__AWS__KMS__IDENTIFIER__LENGTH()) <= 0), _dafny.SeqOfString("Identifier exceeds maximum length.")) + _ = _1_valueOrError1 + if (_1_valueOrError1).IsFailure() { + return (_1_valueOrError1).PropagateFailure() + } else { + return Companion_Default___.ParseAwsKmsIdentifier(s) + } + } +} +func (_static *CompanionStruct_Default___) Error(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} +func (_static *CompanionStruct_Default___) ValidateDdbTableArn(tableArn _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = (Companion_Default___.ParseAmazonDynamodbTableName(tableArn)).MapFailure(func(coer0 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg0 interface{}) interface{} { + return coer0(arg0.(_dafny.Sequence)) + } + }(Companion_Default___.Error)) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1___v1 _dafny.Sequence = (_0_valueOrError0).Extract().(_dafny.Sequence) + _ = _1___v1 + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.IsASCIIString(tableArn), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Table Arn is not ASCII"))) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__TableName((Companion_Default___.ParseAmazonDynamodbTableName(tableArn)).Dtor_value().(_dafny.Sequence)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Table Name is too long"))) + _ = _3_valueOrError2 + if (_3_valueOrError2).IsFailure() { + return (_3_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } + } + } +} +func (_static *CompanionStruct_Default___) MAX__AWS__KMS__IDENTIFIER__LENGTH() _dafny.Int { + return _dafny.IntOfInt64(2048) +} + +// End of class Default__ + +// Definition of datatype AwsResource +type AwsResource struct { + Data_AwsResource_ +} + +func (_this AwsResource) Get_() Data_AwsResource_ { + return _this.Data_AwsResource_ +} + +type Data_AwsResource_ interface { + isAwsResource() +} + +type CompanionStruct_AwsResource_ struct { +} + +var Companion_AwsResource_ = CompanionStruct_AwsResource_{} + +type AwsResource_AwsResource struct { + ResourceType _dafny.Sequence + Value _dafny.Sequence +} + +func (AwsResource_AwsResource) isAwsResource() {} + +func (CompanionStruct_AwsResource_) Create_AwsResource_(ResourceType _dafny.Sequence, Value _dafny.Sequence) AwsResource { + return AwsResource{AwsResource_AwsResource{ResourceType, Value}} +} + +func (_this AwsResource) Is_AwsResource() bool { + _, ok := _this.Get_().(AwsResource_AwsResource) + return ok +} + +func (CompanionStruct_AwsResource_) Default() AwsResource { + return Companion_AwsResource_.Create_AwsResource_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString()) +} + +func (_this AwsResource) Dtor_resourceType() _dafny.Sequence { + return _this.Get_().(AwsResource_AwsResource).ResourceType +} + +func (_this AwsResource) Dtor_value() _dafny.Sequence { + return _this.Get_().(AwsResource_AwsResource).Value +} + +func (_this AwsResource) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AwsResource_AwsResource: + { + return "AwsArnParsing.AwsResource.AwsResource" + "(" + _dafny.String(data.ResourceType) + ", " + _dafny.String(data.Value) + ")" + } + default: + { + return "" + } + } +} + +func (_this AwsResource) Equals(other AwsResource) bool { + switch data1 := _this.Get_().(type) { + case AwsResource_AwsResource: + { + data2, ok := other.Get_().(AwsResource_AwsResource) + return ok && data1.ResourceType.Equals(data2.ResourceType) && data1.Value.Equals(data2.Value) + } + default: + { + return false // unexpected + } + } +} + +func (_this AwsResource) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AwsResource) + return ok && _this.Equals(typed) +} + +func Type_AwsResource_() _dafny.TypeDescriptor { + return type_AwsResource_{} +} + +type type_AwsResource_ struct { +} + +func (_this type_AwsResource_) Default() interface{} { + return Companion_AwsResource_.Default() +} + +func (_this type_AwsResource_) String() string { + return "AwsArnParsing.AwsResource" +} +func (_this AwsResource) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AwsResource{} + +func (_this AwsResource) Valid() bool { + { + return (true) && ((_dafny.IntOfUint32(((_this).Dtor_value()).Cardinality())).Sign() == 1) + } +} +func (_this AwsResource) ToString() _dafny.Sequence { + { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_this).Dtor_resourceType(), _dafny.SeqOfString("/")), (_this).Dtor_value()) + } +} + +// End of datatype AwsResource + +// Definition of datatype AwsArn +type AwsArn struct { + Data_AwsArn_ +} + +func (_this AwsArn) Get_() Data_AwsArn_ { + return _this.Data_AwsArn_ +} + +type Data_AwsArn_ interface { + isAwsArn() +} + +type CompanionStruct_AwsArn_ struct { +} + +var Companion_AwsArn_ = CompanionStruct_AwsArn_{} + +type AwsArn_AwsArn struct { + ArnLiteral _dafny.Sequence + Partition _dafny.Sequence + Service _dafny.Sequence + Region _dafny.Sequence + Account _dafny.Sequence + Resource AwsResource +} + +func (AwsArn_AwsArn) isAwsArn() {} + +func (CompanionStruct_AwsArn_) Create_AwsArn_(ArnLiteral _dafny.Sequence, Partition _dafny.Sequence, Service _dafny.Sequence, Region _dafny.Sequence, Account _dafny.Sequence, Resource AwsResource) AwsArn { + return AwsArn{AwsArn_AwsArn{ArnLiteral, Partition, Service, Region, Account, Resource}} +} + +func (_this AwsArn) Is_AwsArn() bool { + _, ok := _this.Get_().(AwsArn_AwsArn) + return ok +} + +func (CompanionStruct_AwsArn_) Default() AwsArn { + return Companion_AwsArn_.Create_AwsArn_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), Companion_AwsResource_.Default()) +} + +func (_this AwsArn) Dtor_arnLiteral() _dafny.Sequence { + return _this.Get_().(AwsArn_AwsArn).ArnLiteral +} + +func (_this AwsArn) Dtor_partition() _dafny.Sequence { + return _this.Get_().(AwsArn_AwsArn).Partition +} + +func (_this AwsArn) Dtor_service() _dafny.Sequence { + return _this.Get_().(AwsArn_AwsArn).Service +} + +func (_this AwsArn) Dtor_region() _dafny.Sequence { + return _this.Get_().(AwsArn_AwsArn).Region +} + +func (_this AwsArn) Dtor_account() _dafny.Sequence { + return _this.Get_().(AwsArn_AwsArn).Account +} + +func (_this AwsArn) Dtor_resource() AwsResource { + return _this.Get_().(AwsArn_AwsArn).Resource +} + +func (_this AwsArn) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AwsArn_AwsArn: + { + return "AwsArnParsing.AwsArn.AwsArn" + "(" + _dafny.String(data.ArnLiteral) + ", " + _dafny.String(data.Partition) + ", " + _dafny.String(data.Service) + ", " + _dafny.String(data.Region) + ", " + _dafny.String(data.Account) + ", " + _dafny.String(data.Resource) + ")" + } + default: + { + return "" + } + } +} + +func (_this AwsArn) Equals(other AwsArn) bool { + switch data1 := _this.Get_().(type) { + case AwsArn_AwsArn: + { + data2, ok := other.Get_().(AwsArn_AwsArn) + return ok && data1.ArnLiteral.Equals(data2.ArnLiteral) && data1.Partition.Equals(data2.Partition) && data1.Service.Equals(data2.Service) && data1.Region.Equals(data2.Region) && data1.Account.Equals(data2.Account) && data1.Resource.Equals(data2.Resource) + } + default: + { + return false // unexpected + } + } +} + +func (_this AwsArn) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AwsArn) + return ok && _this.Equals(typed) +} + +func Type_AwsArn_() _dafny.TypeDescriptor { + return type_AwsArn_{} +} + +type type_AwsArn_ struct { +} + +func (_this type_AwsArn_) Default() interface{} { + return Companion_AwsArn_.Default() +} + +func (_this type_AwsArn_) String() string { + return "AwsArnParsing.AwsArn" +} +func (_this AwsArn) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AwsArn{} + +func (_this AwsArn) Valid() bool { + { + return (((((_dafny.Companion_Sequence_.Equal((_this).Dtor_arnLiteral(), _dafny.SeqOfString("arn"))) && ((_dafny.IntOfUint32(((_this).Dtor_partition()).Cardinality())).Sign() == 1)) && ((_dafny.IntOfUint32(((_this).Dtor_service()).Cardinality())).Sign() == 1)) && ((_dafny.IntOfUint32(((_this).Dtor_region()).Cardinality())).Sign() == 1)) && ((_dafny.IntOfUint32(((_this).Dtor_account()).Cardinality())).Sign() == 1)) && (((_this).Dtor_resource()).Valid()) + } +} +func (_this AwsArn) ToString() _dafny.Sequence { + { + return (_this).ToArnString(m_Wrappers.Companion_Option_.Create_None_()) + } +} +func (_this AwsArn) ToArnString(customRegion m_Wrappers.Option) _dafny.Sequence { + { + goto TAIL_CALL_START + TAIL_CALL_START: + var _source0 m_Wrappers.Option = customRegion + _ = _source0 + { + if _source0.Is_None() { + var _in0 AwsArn = _this + _ = _in0 + var _in1 m_Wrappers.Option = m_Wrappers.Companion_Option_.Create_Some_((_this).Dtor_region()) + _ = _in1 + _this = _in0 + + customRegion = _in1 + goto TAIL_CALL_START + } + } + { + var _0_customRegion _dafny.Sequence = _source0.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _0_customRegion + return m_StandardLibrary.Companion_Default___.Join(_dafny.SeqOf((_this).Dtor_arnLiteral(), (_this).Dtor_partition(), (_this).Dtor_service(), _0_customRegion, (_this).Dtor_account(), ((_this).Dtor_resource()).ToString()), _dafny.SeqOfString(":")) + } + } +} + +// End of datatype AwsArn + +// Definition of class AwsKmsArn +type AwsKmsArn struct { +} + +func New_AwsKmsArn_() *AwsKmsArn { + _this := AwsKmsArn{} + + return &_this +} + +type CompanionStruct_AwsKmsArn_ struct { +} + +var Companion_AwsKmsArn_ = CompanionStruct_AwsKmsArn_{} + +func (*AwsKmsArn) String() string { + return "AwsArnParsing.AwsKmsArn" +} + +// End of class AwsKmsArn + +func Type_AwsKmsArn_() _dafny.TypeDescriptor { + return type_AwsKmsArn_{} +} + +type type_AwsKmsArn_ struct { +} + +func (_this type_AwsKmsArn_) Default() interface{} { + return Companion_AwsArn_.Default() +} + +func (_this type_AwsKmsArn_) String() string { + return "AwsArnParsing.AwsKmsArn" +} +func (_this *CompanionStruct_AwsKmsArn_) Is_(__source AwsArn) bool { + var _1_a AwsArn = (__source) + _ = _1_a + return Companion_Default___.ValidAwsKmsArn(_1_a) +} + +// Definition of class AwsKmsResource +type AwsKmsResource struct { +} + +func New_AwsKmsResource_() *AwsKmsResource { + _this := AwsKmsResource{} + + return &_this +} + +type CompanionStruct_AwsKmsResource_ struct { +} + +var Companion_AwsKmsResource_ = CompanionStruct_AwsKmsResource_{} + +func (*AwsKmsResource) String() string { + return "AwsArnParsing.AwsKmsResource" +} + +// End of class AwsKmsResource + +func Type_AwsKmsResource_() _dafny.TypeDescriptor { + return type_AwsKmsResource_{} +} + +type type_AwsKmsResource_ struct { +} + +func (_this type_AwsKmsResource_) Default() interface{} { + return Companion_AwsResource_.Default() +} + +func (_this type_AwsKmsResource_) String() string { + return "AwsArnParsing.AwsKmsResource" +} +func (_this *CompanionStruct_AwsKmsResource_) Is_(__source AwsResource) bool { + var _2_r AwsResource = (__source) + _ = _2_r + return Companion_Default___.ValidAwsKmsResource(_2_r) +} + +// Definition of datatype AwsKmsIdentifier +type AwsKmsIdentifier struct { + Data_AwsKmsIdentifier_ +} + +func (_this AwsKmsIdentifier) Get_() Data_AwsKmsIdentifier_ { + return _this.Data_AwsKmsIdentifier_ +} + +type Data_AwsKmsIdentifier_ interface { + isAwsKmsIdentifier() +} + +type CompanionStruct_AwsKmsIdentifier_ struct { +} + +var Companion_AwsKmsIdentifier_ = CompanionStruct_AwsKmsIdentifier_{} + +type AwsKmsIdentifier_AwsKmsArnIdentifier struct { + A AwsArn +} + +func (AwsKmsIdentifier_AwsKmsArnIdentifier) isAwsKmsIdentifier() {} + +func (CompanionStruct_AwsKmsIdentifier_) Create_AwsKmsArnIdentifier_(A AwsArn) AwsKmsIdentifier { + return AwsKmsIdentifier{AwsKmsIdentifier_AwsKmsArnIdentifier{A}} +} + +func (_this AwsKmsIdentifier) Is_AwsKmsArnIdentifier() bool { + _, ok := _this.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier) + return ok +} + +type AwsKmsIdentifier_AwsKmsRawResourceIdentifier struct { + R AwsResource +} + +func (AwsKmsIdentifier_AwsKmsRawResourceIdentifier) isAwsKmsIdentifier() {} + +func (CompanionStruct_AwsKmsIdentifier_) Create_AwsKmsRawResourceIdentifier_(R AwsResource) AwsKmsIdentifier { + return AwsKmsIdentifier{AwsKmsIdentifier_AwsKmsRawResourceIdentifier{R}} +} + +func (_this AwsKmsIdentifier) Is_AwsKmsRawResourceIdentifier() bool { + _, ok := _this.Get_().(AwsKmsIdentifier_AwsKmsRawResourceIdentifier) + return ok +} + +func (CompanionStruct_AwsKmsIdentifier_) Default() AwsKmsIdentifier { + return Companion_AwsKmsIdentifier_.Create_AwsKmsArnIdentifier_(Companion_AwsArn_.Default()) +} + +func (_this AwsKmsIdentifier) Dtor_a() AwsArn { + return _this.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier).A +} + +func (_this AwsKmsIdentifier) Dtor_r() AwsResource { + return _this.Get_().(AwsKmsIdentifier_AwsKmsRawResourceIdentifier).R +} + +func (_this AwsKmsIdentifier) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AwsKmsIdentifier_AwsKmsArnIdentifier: + { + return "AwsArnParsing.AwsKmsIdentifier.AwsKmsArnIdentifier" + "(" + _dafny.String(data.A) + ")" + } + case AwsKmsIdentifier_AwsKmsRawResourceIdentifier: + { + return "AwsArnParsing.AwsKmsIdentifier.AwsKmsRawResourceIdentifier" + "(" + _dafny.String(data.R) + ")" + } + default: + { + return "" + } + } +} + +func (_this AwsKmsIdentifier) Equals(other AwsKmsIdentifier) bool { + switch data1 := _this.Get_().(type) { + case AwsKmsIdentifier_AwsKmsArnIdentifier: + { + data2, ok := other.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier) + return ok && data1.A.Equals(data2.A) + } + case AwsKmsIdentifier_AwsKmsRawResourceIdentifier: + { + data2, ok := other.Get_().(AwsKmsIdentifier_AwsKmsRawResourceIdentifier) + return ok && data1.R.Equals(data2.R) + } + default: + { + return false // unexpected + } + } +} + +func (_this AwsKmsIdentifier) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AwsKmsIdentifier) + return ok && _this.Equals(typed) +} + +func Type_AwsKmsIdentifier_() _dafny.TypeDescriptor { + return type_AwsKmsIdentifier_{} +} + +type type_AwsKmsIdentifier_ struct { +} + +func (_this type_AwsKmsIdentifier_) Default() interface{} { + return Companion_AwsKmsIdentifier_.Default() +} + +func (_this type_AwsKmsIdentifier_) String() string { + return "AwsArnParsing.AwsKmsIdentifier" +} +func (_this AwsKmsIdentifier) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AwsKmsIdentifier{} + +func (_this AwsKmsIdentifier) ToString() _dafny.Sequence { + { + var _source0 AwsKmsIdentifier = _this + _ = _source0 + { + if _source0.Is_AwsKmsArnIdentifier() { + var _0_a AwsArn = _source0.Get_().(AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _0_a + return (_0_a).ToString() + } + } + { + var _1_r AwsResource = _source0.Get_().(AwsKmsIdentifier_AwsKmsRawResourceIdentifier).R + _ = _1_r + return (_1_r).ToString() + } + } +} + +// End of datatype AwsKmsIdentifier + +// Definition of class AmazonDynamodbTableArn +type AmazonDynamodbTableArn struct { +} + +func New_AmazonDynamodbTableArn_() *AmazonDynamodbTableArn { + _this := AmazonDynamodbTableArn{} + + return &_this +} + +type CompanionStruct_AmazonDynamodbTableArn_ struct { +} + +var Companion_AmazonDynamodbTableArn_ = CompanionStruct_AmazonDynamodbTableArn_{} + +func (*AmazonDynamodbTableArn) String() string { + return "AwsArnParsing.AmazonDynamodbTableArn" +} + +// End of class AmazonDynamodbTableArn + +func Type_AmazonDynamodbTableArn_() _dafny.TypeDescriptor { + return type_AmazonDynamodbTableArn_{} +} + +type type_AmazonDynamodbTableArn_ struct { +} + +func (_this type_AmazonDynamodbTableArn_) Default() interface{} { + return Companion_AwsArn_.Default() +} + +func (_this type_AmazonDynamodbTableArn_) String() string { + return "AwsArnParsing.AmazonDynamodbTableArn" +} +func (_this *CompanionStruct_AmazonDynamodbTableArn_) Is_(__source AwsArn) bool { + var _2_a AwsArn = (__source) + _ = _2_a + return Companion_Default___.ValidAmazonDynamodbArn(_2_a) +} + +// Definition of class AmazonDynamodbResource +type AmazonDynamodbResource struct { +} + +func New_AmazonDynamodbResource_() *AmazonDynamodbResource { + _this := AmazonDynamodbResource{} + + return &_this +} + +type CompanionStruct_AmazonDynamodbResource_ struct { +} + +var Companion_AmazonDynamodbResource_ = CompanionStruct_AmazonDynamodbResource_{} + +func (*AmazonDynamodbResource) String() string { + return "AwsArnParsing.AmazonDynamodbResource" +} + +// End of class AmazonDynamodbResource + +func Type_AmazonDynamodbResource_() _dafny.TypeDescriptor { + return type_AmazonDynamodbResource_{} +} + +type type_AmazonDynamodbResource_ struct { +} + +func (_this type_AmazonDynamodbResource_) Default() interface{} { + return Companion_AwsResource_.Default() +} + +func (_this type_AmazonDynamodbResource_) String() string { + return "AwsArnParsing.AmazonDynamodbResource" +} +func (_this *CompanionStruct_AmazonDynamodbResource_) Is_(__source AwsResource) bool { + var _3_r AwsResource = (__source) + _ = _3_r + return Companion_Default___.ValidAmazonDynamodbResource(_3_r) +} + +// Definition of datatype AmazonDynamodbTableName +type AmazonDynamodbTableName struct { + Data_AmazonDynamodbTableName_ +} + +func (_this AmazonDynamodbTableName) Get_() Data_AmazonDynamodbTableName_ { + return _this.Data_AmazonDynamodbTableName_ +} + +type Data_AmazonDynamodbTableName_ interface { + isAmazonDynamodbTableName() +} + +type CompanionStruct_AmazonDynamodbTableName_ struct { +} + +var Companion_AmazonDynamodbTableName_ = CompanionStruct_AmazonDynamodbTableName_{} + +type AmazonDynamodbTableName_AmazonDynamodbTableArn struct { + A AwsArn +} + +func (AmazonDynamodbTableName_AmazonDynamodbTableArn) isAmazonDynamodbTableName() {} + +func (CompanionStruct_AmazonDynamodbTableName_) Create_AmazonDynamodbTableArn_(A AwsArn) AmazonDynamodbTableName { + return AmazonDynamodbTableName{AmazonDynamodbTableName_AmazonDynamodbTableArn{A}} +} + +func (_this AmazonDynamodbTableName) Is_AmazonDynamodbTableArn() bool { + _, ok := _this.Get_().(AmazonDynamodbTableName_AmazonDynamodbTableArn) + return ok +} + +func (CompanionStruct_AmazonDynamodbTableName_) Default() AmazonDynamodbTableName { + return Companion_AmazonDynamodbTableName_.Create_AmazonDynamodbTableArn_(Companion_AwsArn_.Default()) +} + +func (_this AmazonDynamodbTableName) Dtor_a() AwsArn { + return _this.Get_().(AmazonDynamodbTableName_AmazonDynamodbTableArn).A +} + +func (_this AmazonDynamodbTableName) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AmazonDynamodbTableName_AmazonDynamodbTableArn: + { + return "AwsArnParsing.AmazonDynamodbTableName.AmazonDynamodbTableArn" + "(" + _dafny.String(data.A) + ")" + } + default: + { + return "" + } + } +} + +func (_this AmazonDynamodbTableName) Equals(other AmazonDynamodbTableName) bool { + switch data1 := _this.Get_().(type) { + case AmazonDynamodbTableName_AmazonDynamodbTableArn: + { + data2, ok := other.Get_().(AmazonDynamodbTableName_AmazonDynamodbTableArn) + return ok && data1.A.Equals(data2.A) + } + default: + { + return false // unexpected + } + } +} + +func (_this AmazonDynamodbTableName) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AmazonDynamodbTableName) + return ok && _this.Equals(typed) +} + +func Type_AmazonDynamodbTableName_() _dafny.TypeDescriptor { + return type_AmazonDynamodbTableName_{} +} + +type type_AmazonDynamodbTableName_ struct { +} + +func (_this type_AmazonDynamodbTableName_) Default() interface{} { + return Companion_AmazonDynamodbTableName_.Default() +} + +func (_this type_AmazonDynamodbTableName_) String() string { + return "AwsArnParsing.AmazonDynamodbTableName" +} +func (_this AmazonDynamodbTableName) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AmazonDynamodbTableName{} + +func (_this AmazonDynamodbTableName) GetTableName() _dafny.Sequence { + { + var _source0 AmazonDynamodbTableName = _this + _ = _source0 + { + var _0_a AwsArn = _source0.Get_().(AmazonDynamodbTableName_AmazonDynamodbTableArn).A + _ = _0_a + return ((_0_a).Dtor_resource()).Dtor_value() + } + } +} + +// End of datatype AmazonDynamodbTableName + +// Definition of class AwsKmsIdentifierString +type AwsKmsIdentifierString struct { +} + +func New_AwsKmsIdentifierString_() *AwsKmsIdentifierString { + _this := AwsKmsIdentifierString{} + + return &_this +} + +type CompanionStruct_AwsKmsIdentifierString_ struct { +} + +var Companion_AwsKmsIdentifierString_ = CompanionStruct_AwsKmsIdentifierString_{} + +func (*AwsKmsIdentifierString) String() string { + return "AwsArnParsing.AwsKmsIdentifierString" +} + +// End of class AwsKmsIdentifierString + +func Type_AwsKmsIdentifierString_() _dafny.TypeDescriptor { + return type_AwsKmsIdentifierString_{} +} + +type type_AwsKmsIdentifierString_ struct { +} + +func (_this type_AwsKmsIdentifierString_) Default() interface{} { + return _dafny.EmptySeq.SetString() +} + +func (_this type_AwsKmsIdentifierString_) String() string { + return "AwsArnParsing.AwsKmsIdentifierString" +} +func (_this *CompanionStruct_AwsKmsIdentifierString_) Is_(__source _dafny.Sequence) bool { + var _1_s _dafny.Sequence = (__source) + _ = _1_s + return (Companion_Default___.IsAwsKmsIdentifierString(_1_s)).Is_Success() +} diff --git a/releases/go/mpl/AwsCryptographyKeyStoreOperations/AwsCryptographyKeyStoreOperations.go b/releases/go/mpl/AwsCryptographyKeyStoreOperations/AwsCryptographyKeyStoreOperations.go new file mode 100644 index 000000000..d2fe0fa41 --- /dev/null +++ b/releases/go/mpl/AwsCryptographyKeyStoreOperations/AwsCryptographyKeyStoreOperations.go @@ -0,0 +1,586 @@ +// Package AwsCryptographyKeyStoreOperations +// Dafny module AwsCryptographyKeyStoreOperations compiled into Go + +package AwsCryptographyKeyStoreOperations + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m__Time "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Time_" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UUID "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UUID" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsCryptographyKeyStoreOperations.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) GetKeyStoreInfo(config Config) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_GetKeyStoreInfoOutput_.Create_GetKeyStoreInfoOutput_((config).Dtor_id(), (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_grantTokens(), (config).Dtor_kmsConfiguration())) + return output +} +func (_static *CompanionStruct_Default___) CreateKeyStore(config Config, input m_AwsCryptographyKeyStoreTypes.CreateKeyStoreInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_CreateKeyStoreTable.Companion_Default___.CreateKeyStoreTable((config).Dtor_ddbTableName(), (config).Dtor_ddbClient()) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_ddbTableArn _dafny.Sequence + _ = _1_ddbTableArn + _1_ddbTableArn = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_tableName m_Wrappers.Result + _ = _2_tableName + _2_tableName = m_AwsArnParsing.Companion_Default___.ParseAmazonDynamodbTableName(_1_ddbTableArn) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(((_2_tableName).Is_Success()) && (_dafny.Companion_Sequence_.Equal((_2_tableName).Dtor_value().(_dafny.Sequence), (config).Dtor_ddbTableName())), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Configured DDB Table Name does not match parsed Table Name from DDB Table Arn."))) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_CreateKeyStoreOutput_.Create_CreateKeyStoreOutput_(_1_ddbTableArn)) + return output +} +func (_static *CompanionStruct_Default___) CreateKey(config Config, input m_AwsCryptographyKeyStoreTypes.CreateKeyInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_CreateKeyOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(!(((input).Dtor_branchKeyIdentifier()).Is_Some()) || ((((input).Dtor_encryptionContext()).Is_Some()) && (((((input).Dtor_encryptionContext()).Dtor_value().(_dafny.Map)).Cardinality()).Sign() == 1)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.CUSTOM__BRANCH__KEY__ID__NEED__EC())) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.HasKeyId((config).Dtor_kmsConfiguration()), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.DISCOVERY__CREATE__KEY__NOT__SUPPORTED())) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_branchKeyIdentifier _dafny.Sequence = _dafny.EmptySeq.SetString() + _ = _2_branchKeyIdentifier + if ((input).Dtor_branchKeyIdentifier()).Is_None() { + var _3_maybeBranchKeyId m_Wrappers.Result + _ = _3_maybeBranchKeyId + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_UUID.GenerateUUID() + _3_maybeBranchKeyId = _out0 + var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _4_valueOrError2 + _4_valueOrError2 = (_3_maybeBranchKeyId).MapFailure(func(coer19 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg19 interface{}) interface{} { + return coer19(arg19.(_dafny.Sequence)) + } + }(func(_5_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_5_e) + })) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + _2_branchKeyIdentifier = (_4_valueOrError2).Extract().(_dafny.Sequence) + } else { + var _6_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError3 + _6_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((((input).Dtor_branchKeyIdentifier()).Dtor_value().(_dafny.Sequence)).Cardinality())).Sign() == 1, m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Custom branch key id can not be an empty string."))) + if (_6_valueOrError3).IsFailure() { + output = (_6_valueOrError3).PropagateFailure() + return output + } + _2_branchKeyIdentifier = ((input).Dtor_branchKeyIdentifier()).Dtor_value().(_dafny.Sequence) + } + var _7_timestamp_q m_Wrappers.Result + _ = _7_timestamp_q + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m__Time.GetCurrentTimeStamp() + _7_timestamp_q = _out1 + var _8_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _8_valueOrError4 + _8_valueOrError4 = (_7_timestamp_q).MapFailure(func(coer20 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg20 interface{}) interface{} { + return coer20(arg20.(_dafny.Sequence)) + } + }(func(_9_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_9_e) + })) + if (_8_valueOrError4).IsFailure() { + output = (_8_valueOrError4).PropagateFailure() + return output + } + var _10_timestamp _dafny.Sequence + _ = _10_timestamp + _10_timestamp = (_8_valueOrError4).Extract().(_dafny.Sequence) + var _11_maybeBranchKeyVersion m_Wrappers.Result + _ = _11_maybeBranchKeyVersion + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_UUID.GenerateUUID() + _11_maybeBranchKeyVersion = _out2 + var _12_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _12_valueOrError5 + _12_valueOrError5 = (_11_maybeBranchKeyVersion).MapFailure(func(coer21 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg21 interface{}) interface{} { + return coer21(arg21.(_dafny.Sequence)) + } + }(func(_13_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_13_e) + })) + if (_12_valueOrError5).IsFailure() { + output = (_12_valueOrError5).PropagateFailure() + return output + } + var _14_branchKeyVersion _dafny.Sequence + _ = _14_branchKeyVersion + _14_branchKeyVersion = (_12_valueOrError5).Extract().(_dafny.Sequence) + var _15_unwrapEncryptionContext _dafny.Map + _ = _15_unwrapEncryptionContext + _15_unwrapEncryptionContext = ((input).Dtor_encryptionContext()).UnwrapOr(_dafny.NewMapBuilder().ToMap()).(_dafny.Map) + var _16_encodedEncryptionContext _dafny.Set + _ = _16_encodedEncryptionContext + _16_encodedEncryptionContext = func() _dafny.Set { + var _coll0 = _dafny.NewBuilder() + _ = _coll0 + for _iter7 := _dafny.Iterate((_15_unwrapEncryptionContext).Keys().Elements()); ; { + _compr_0, _ok7 := _iter7() + if !_ok7 { + break + } + var _17_k _dafny.Sequence + _17_k = interface{}(_compr_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_17_k) { + if (_15_unwrapEncryptionContext).Contains(_17_k) { + _coll0.Add(_dafny.TupleOf(m_UTF8.Decode(_17_k), m_UTF8.Decode((_15_unwrapEncryptionContext).Get(_17_k).(_dafny.Sequence)), _17_k)) + } + } + } + return _coll0.ToSet() + }() + var _18_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _18_valueOrError6 + _18_valueOrError6 = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier((_16_encodedEncryptionContext).Elements(), true, func(_forall_var_0 _dafny.Tuple) bool { + var _19_i _dafny.Tuple + _19_i = interface{}(_forall_var_0).(_dafny.Tuple) + return !((_16_encodedEncryptionContext).Contains(_19_i)) || ((((((*(_19_i).IndexInt(0)).(m_Wrappers.Result)).Is_Success()) && (((*(_19_i).IndexInt(1)).(m_Wrappers.Result)).Is_Success())) && (m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__AttributeName(_dafny.Companion_Sequence_.Concatenate(m_Structure.Companion_Default___.ENCRYPTION__CONTEXT__PREFIX(), ((*(_19_i).IndexInt(0)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence))))) && (func(_pat_let1_0 m_Wrappers.Result) bool { + return func(_20_encoded m_Wrappers.Result) bool { + return ((_20_encoded).Is_Success()) && (_dafny.Companion_Sequence_.Equal((*(_19_i).IndexInt(2)).(_dafny.Sequence), (_20_encoded).Dtor_value().(_dafny.Sequence))) + }(_pat_let1_0) + }(m_UTF8.Encode(((*(_19_i).IndexInt(0)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence))))) + }), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.UTF8__ENCODING__ENCRYPTION__CONTEXT__ERROR())) + if (_18_valueOrError6).IsFailure() { + output = (_18_valueOrError6).PropagateFailure() + return output + } + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_CreateKeys.Companion_Default___.CreateBranchAndBeaconKeys(_2_branchKeyIdentifier, func() _dafny.Map { + var _coll1 = _dafny.NewMapBuilder() + _ = _coll1 + for _iter8 := _dafny.Iterate((_16_encodedEncryptionContext).Elements()); ; { + _compr_1, _ok8 := _iter8() + if !_ok8 { + break + } + var _21_i _dafny.Tuple + _21_i = interface{}(_compr_1).(_dafny.Tuple) + if (_16_encodedEncryptionContext).Contains(_21_i) { + _coll1.Add(((*(_21_i).IndexInt(0)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence), ((*(_21_i).IndexInt(1)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence)) + } + } + return _coll1.ToMap() + }(), _10_timestamp, _14_branchKeyVersion, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (config).Dtor_grantTokens(), (config).Dtor_kmsClient(), (config).Dtor_ddbClient()) + output = _out3 + return output +} +func (_static *CompanionStruct_Default___) VersionKey(config Config, input m_AwsCryptographyKeyStoreTypes.VersionKeyInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_VersionKeyOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.HasKeyId((config).Dtor_kmsConfiguration()), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.DISCOVERY__VERSION__KEY__NOT__SUPPORTED())) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32(((input).Dtor_branchKeyIdentifier()).Cardinality())).Sign() == 1, m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.BRANCH__KEY__ID__NEEDED())) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_timestamp_q m_Wrappers.Result + _ = _2_timestamp_q + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m__Time.GetCurrentTimeStamp() + _2_timestamp_q = _out0 + var _3_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _3_valueOrError2 + _3_valueOrError2 = (_2_timestamp_q).MapFailure(func(coer22 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg22 interface{}) interface{} { + return coer22(arg22.(_dafny.Sequence)) + } + }(func(_4_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_4_e) + })) + if (_3_valueOrError2).IsFailure() { + output = (_3_valueOrError2).PropagateFailure() + return output + } + var _5_timestamp _dafny.Sequence + _ = _5_timestamp + _5_timestamp = (_3_valueOrError2).Extract().(_dafny.Sequence) + var _6_maybeBranchKeyVersion m_Wrappers.Result + _ = _6_maybeBranchKeyVersion + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_UUID.GenerateUUID() + _6_maybeBranchKeyVersion = _out1 + var _7_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _7_valueOrError3 + _7_valueOrError3 = (_6_maybeBranchKeyVersion).MapFailure(func(coer23 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg23 interface{}) interface{} { + return coer23(arg23.(_dafny.Sequence)) + } + }(func(_8_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_8_e) + })) + if (_7_valueOrError3).IsFailure() { + output = (_7_valueOrError3).PropagateFailure() + return output + } + var _9_branchKeyVersion _dafny.Sequence + _ = _9_branchKeyVersion + _9_branchKeyVersion = (_7_valueOrError3).Extract().(_dafny.Sequence) + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_CreateKeys.Companion_Default___.VersionActiveBranchKey(input, _5_timestamp, _9_branchKeyVersion, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (config).Dtor_grantTokens(), (config).Dtor_kmsClient(), (config).Dtor_ddbClient()) + output = _out2 + return output +} +func (_static *CompanionStruct_Default___) GetActiveBranchKey(config Config, input m_AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_GetKeys.Companion_Default___.GetActiveKeyAndUnwrap(input, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (config).Dtor_grantTokens(), (config).Dtor_kmsClient(), (config).Dtor_ddbClient()) + output = _out0 + return output +} +func (_static *CompanionStruct_Default___) GetBranchKeyVersion(config Config, input m_AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_GetKeys.Companion_Default___.GetBranchKeyVersion(input, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (config).Dtor_grantTokens(), (config).Dtor_kmsClient(), (config).Dtor_ddbClient()) + output = _out0 + return output +} +func (_static *CompanionStruct_Default___) GetBeaconKey(config Config, input m_AwsCryptographyKeyStoreTypes.GetBeaconKeyInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_GetKeys.Companion_Default___.GetBeaconKeyAndUnwrap(input, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (config).Dtor_grantTokens(), (config).Dtor_kmsClient(), (config).Dtor_ddbClient()) + output = _out0 + return output +} + +// End of class Default__ + +// Definition of datatype Config +type Config struct { + Data_Config_ +} + +func (_this Config) Get_() Data_Config_ { + return _this.Data_Config_ +} + +type Data_Config_ interface { + isConfig() +} + +type CompanionStruct_Config_ struct { +} + +var Companion_Config_ = CompanionStruct_Config_{} + +type Config_Config struct { + Id _dafny.Sequence + DdbTableName _dafny.Sequence + LogicalKeyStoreName _dafny.Sequence + KmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration + GrantTokens _dafny.Sequence + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + DdbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient +} + +func (Config_Config) isConfig() {} + +func (CompanionStruct_Config_) Create_Config_(Id _dafny.Sequence, DdbTableName _dafny.Sequence, LogicalKeyStoreName _dafny.Sequence, KmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, GrantTokens _dafny.Sequence, KmsClient m_ComAmazonawsKmsTypes.IKMSClient, DdbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) Config { + return Config{Config_Config{Id, DdbTableName, LogicalKeyStoreName, KmsConfiguration, GrantTokens, KmsClient, DdbClient}} +} + +func (_this Config) Is_Config() bool { + _, ok := _this.Get_().(Config_Config) + return ok +} + +func (CompanionStruct_Config_) Default() Config { + return Companion_Config_.Create_Config_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), m_AwsCryptographyKeyStoreTypes.Companion_KMSConfiguration_.Default(), _dafny.EmptySeq, (m_ComAmazonawsKmsTypes.IKMSClient)(nil), (m_ComAmazonawsDynamodbTypes.IDynamoDBClient)(nil)) +} + +func (_this Config) Dtor_id() _dafny.Sequence { + return _this.Get_().(Config_Config).Id +} + +func (_this Config) Dtor_ddbTableName() _dafny.Sequence { + return _this.Get_().(Config_Config).DdbTableName +} + +func (_this Config) Dtor_logicalKeyStoreName() _dafny.Sequence { + return _this.Get_().(Config_Config).LogicalKeyStoreName +} + +func (_this Config) Dtor_kmsConfiguration() m_AwsCryptographyKeyStoreTypes.KMSConfiguration { + return _this.Get_().(Config_Config).KmsConfiguration +} + +func (_this Config) Dtor_grantTokens() _dafny.Sequence { + return _this.Get_().(Config_Config).GrantTokens +} + +func (_this Config) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(Config_Config).KmsClient +} + +func (_this Config) Dtor_ddbClient() m_ComAmazonawsDynamodbTypes.IDynamoDBClient { + return _this.Get_().(Config_Config).DdbClient +} + +func (_this Config) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Config_Config: + { + return "AwsCryptographyKeyStoreOperations.Config.Config" + "(" + _dafny.String(data.Id) + ", " + _dafny.String(data.DdbTableName) + ", " + _dafny.String(data.LogicalKeyStoreName) + ", " + _dafny.String(data.KmsConfiguration) + ", " + _dafny.String(data.GrantTokens) + ", " + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.DdbClient) + ")" + } + default: + { + return "" + } + } +} + +func (_this Config) Equals(other Config) bool { + switch data1 := _this.Get_().(type) { + case Config_Config: + { + data2, ok := other.Get_().(Config_Config) + return ok && data1.Id.Equals(data2.Id) && data1.DdbTableName.Equals(data2.DdbTableName) && data1.LogicalKeyStoreName.Equals(data2.LogicalKeyStoreName) && data1.KmsConfiguration.Equals(data2.KmsConfiguration) && data1.GrantTokens.Equals(data2.GrantTokens) && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && _dafny.AreEqual(data1.DdbClient, data2.DdbClient) + } + default: + { + return false // unexpected + } + } +} + +func (_this Config) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Config) + return ok && _this.Equals(typed) +} + +func Type_Config_() _dafny.TypeDescriptor { + return type_Config_{} +} + +type type_Config_ struct { +} + +func (_this type_Config_) Default() interface{} { + return Companion_Config_.Default() +} + +func (_this type_Config_) String() string { + return "AwsCryptographyKeyStoreOperations.Config" +} +func (_this Config) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Config{} + +// End of datatype Config diff --git a/releases/go/mpl/AwsCryptographyKeyStoreTypes/AwsCryptographyKeyStoreTypes.go b/releases/go/mpl/AwsCryptographyKeyStoreTypes/AwsCryptographyKeyStoreTypes.go new file mode 100644 index 000000000..f9fe1c246 --- /dev/null +++ b/releases/go/mpl/AwsCryptographyKeyStoreTypes/AwsCryptographyKeyStoreTypes.go @@ -0,0 +1,2713 @@ +// Package AwsCryptographyKeyStoreTypes +// Dafny module AwsCryptographyKeyStoreTypes compiled into Go + +package AwsCryptographyKeyStoreTypes + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsCryptographyKeyStoreTypes.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) IsDummySubsetType(x _dafny.Int) bool { + return (x).Sign() == 1 +} + +// End of class Default__ + +// Definition of datatype DafnyCallEvent +type DafnyCallEvent struct { + Data_DafnyCallEvent_ +} + +func (_this DafnyCallEvent) Get_() Data_DafnyCallEvent_ { + return _this.Data_DafnyCallEvent_ +} + +type Data_DafnyCallEvent_ interface { + isDafnyCallEvent() +} + +type CompanionStruct_DafnyCallEvent_ struct { +} + +var Companion_DafnyCallEvent_ = CompanionStruct_DafnyCallEvent_{} + +type DafnyCallEvent_DafnyCallEvent struct { + Input interface{} + Output interface{} +} + +func (DafnyCallEvent_DafnyCallEvent) isDafnyCallEvent() {} + +func (CompanionStruct_DafnyCallEvent_) Create_DafnyCallEvent_(Input interface{}, Output interface{}) DafnyCallEvent { + return DafnyCallEvent{DafnyCallEvent_DafnyCallEvent{Input, Output}} +} + +func (_this DafnyCallEvent) Is_DafnyCallEvent() bool { + _, ok := _this.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok +} + +func (CompanionStruct_DafnyCallEvent_) Default(_default_I interface{}, _default_O interface{}) DafnyCallEvent { + return Companion_DafnyCallEvent_.Create_DafnyCallEvent_(_default_I, _default_O) +} + +func (_this DafnyCallEvent) Dtor_input() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Input +} + +func (_this DafnyCallEvent) Dtor_output() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Output +} + +func (_this DafnyCallEvent) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DafnyCallEvent_DafnyCallEvent: + { + return "AwsCryptographyKeyStoreTypes.DafnyCallEvent.DafnyCallEvent" + "(" + _dafny.String(data.Input) + ", " + _dafny.String(data.Output) + ")" + } + default: + { + return "" + } + } +} + +func (_this DafnyCallEvent) Equals(other DafnyCallEvent) bool { + switch data1 := _this.Get_().(type) { + case DafnyCallEvent_DafnyCallEvent: + { + data2, ok := other.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok && _dafny.AreEqual(data1.Input, data2.Input) && _dafny.AreEqual(data1.Output, data2.Output) + } + default: + { + return false // unexpected + } + } +} + +func (_this DafnyCallEvent) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DafnyCallEvent) + return ok && _this.Equals(typed) +} + +func Type_DafnyCallEvent_(Type_I_ _dafny.TypeDescriptor, Type_O_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_DafnyCallEvent_{Type_I_, Type_O_} +} + +type type_DafnyCallEvent_ struct { + Type_I_ _dafny.TypeDescriptor + Type_O_ _dafny.TypeDescriptor +} + +func (_this type_DafnyCallEvent_) Default() interface{} { + Type_I_ := _this.Type_I_ + _ = Type_I_ + Type_O_ := _this.Type_O_ + _ = Type_O_ + return Companion_DafnyCallEvent_.Default(Type_I_.Default(), Type_O_.Default()) +} + +func (_this type_DafnyCallEvent_) String() string { + return "AwsCryptographyKeyStoreTypes.DafnyCallEvent" +} +func (_this DafnyCallEvent) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DafnyCallEvent{} + +// End of datatype DafnyCallEvent + +// Definition of datatype BeaconKeyMaterials +type BeaconKeyMaterials struct { + Data_BeaconKeyMaterials_ +} + +func (_this BeaconKeyMaterials) Get_() Data_BeaconKeyMaterials_ { + return _this.Data_BeaconKeyMaterials_ +} + +type Data_BeaconKeyMaterials_ interface { + isBeaconKeyMaterials() +} + +type CompanionStruct_BeaconKeyMaterials_ struct { +} + +var Companion_BeaconKeyMaterials_ = CompanionStruct_BeaconKeyMaterials_{} + +type BeaconKeyMaterials_BeaconKeyMaterials struct { + BeaconKeyIdentifier _dafny.Sequence + EncryptionContext _dafny.Map + BeaconKey m_Wrappers.Option + HmacKeys m_Wrappers.Option +} + +func (BeaconKeyMaterials_BeaconKeyMaterials) isBeaconKeyMaterials() {} + +func (CompanionStruct_BeaconKeyMaterials_) Create_BeaconKeyMaterials_(BeaconKeyIdentifier _dafny.Sequence, EncryptionContext _dafny.Map, BeaconKey m_Wrappers.Option, HmacKeys m_Wrappers.Option) BeaconKeyMaterials { + return BeaconKeyMaterials{BeaconKeyMaterials_BeaconKeyMaterials{BeaconKeyIdentifier, EncryptionContext, BeaconKey, HmacKeys}} +} + +func (_this BeaconKeyMaterials) Is_BeaconKeyMaterials() bool { + _, ok := _this.Get_().(BeaconKeyMaterials_BeaconKeyMaterials) + return ok +} + +func (CompanionStruct_BeaconKeyMaterials_) Default() BeaconKeyMaterials { + return Companion_BeaconKeyMaterials_.Create_BeaconKeyMaterials_(_dafny.EmptySeq.SetString(), _dafny.EmptyMap, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this BeaconKeyMaterials) Dtor_beaconKeyIdentifier() _dafny.Sequence { + return _this.Get_().(BeaconKeyMaterials_BeaconKeyMaterials).BeaconKeyIdentifier +} + +func (_this BeaconKeyMaterials) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(BeaconKeyMaterials_BeaconKeyMaterials).EncryptionContext +} + +func (_this BeaconKeyMaterials) Dtor_beaconKey() m_Wrappers.Option { + return _this.Get_().(BeaconKeyMaterials_BeaconKeyMaterials).BeaconKey +} + +func (_this BeaconKeyMaterials) Dtor_hmacKeys() m_Wrappers.Option { + return _this.Get_().(BeaconKeyMaterials_BeaconKeyMaterials).HmacKeys +} + +func (_this BeaconKeyMaterials) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case BeaconKeyMaterials_BeaconKeyMaterials: + { + return "AwsCryptographyKeyStoreTypes.BeaconKeyMaterials.BeaconKeyMaterials" + "(" + _dafny.String(data.BeaconKeyIdentifier) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.BeaconKey) + ", " + _dafny.String(data.HmacKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this BeaconKeyMaterials) Equals(other BeaconKeyMaterials) bool { + switch data1 := _this.Get_().(type) { + case BeaconKeyMaterials_BeaconKeyMaterials: + { + data2, ok := other.Get_().(BeaconKeyMaterials_BeaconKeyMaterials) + return ok && data1.BeaconKeyIdentifier.Equals(data2.BeaconKeyIdentifier) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.BeaconKey.Equals(data2.BeaconKey) && data1.HmacKeys.Equals(data2.HmacKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this BeaconKeyMaterials) EqualsGeneric(other interface{}) bool { + typed, ok := other.(BeaconKeyMaterials) + return ok && _this.Equals(typed) +} + +func Type_BeaconKeyMaterials_() _dafny.TypeDescriptor { + return type_BeaconKeyMaterials_{} +} + +type type_BeaconKeyMaterials_ struct { +} + +func (_this type_BeaconKeyMaterials_) Default() interface{} { + return Companion_BeaconKeyMaterials_.Default() +} + +func (_this type_BeaconKeyMaterials_) String() string { + return "AwsCryptographyKeyStoreTypes.BeaconKeyMaterials" +} +func (_this BeaconKeyMaterials) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = BeaconKeyMaterials{} + +// End of datatype BeaconKeyMaterials + +// Definition of datatype BranchKeyMaterials +type BranchKeyMaterials struct { + Data_BranchKeyMaterials_ +} + +func (_this BranchKeyMaterials) Get_() Data_BranchKeyMaterials_ { + return _this.Data_BranchKeyMaterials_ +} + +type Data_BranchKeyMaterials_ interface { + isBranchKeyMaterials() +} + +type CompanionStruct_BranchKeyMaterials_ struct { +} + +var Companion_BranchKeyMaterials_ = CompanionStruct_BranchKeyMaterials_{} + +type BranchKeyMaterials_BranchKeyMaterials struct { + BranchKeyIdentifier _dafny.Sequence + BranchKeyVersion _dafny.Sequence + EncryptionContext _dafny.Map + BranchKey _dafny.Sequence +} + +func (BranchKeyMaterials_BranchKeyMaterials) isBranchKeyMaterials() {} + +func (CompanionStruct_BranchKeyMaterials_) Create_BranchKeyMaterials_(BranchKeyIdentifier _dafny.Sequence, BranchKeyVersion _dafny.Sequence, EncryptionContext _dafny.Map, BranchKey _dafny.Sequence) BranchKeyMaterials { + return BranchKeyMaterials{BranchKeyMaterials_BranchKeyMaterials{BranchKeyIdentifier, BranchKeyVersion, EncryptionContext, BranchKey}} +} + +func (_this BranchKeyMaterials) Is_BranchKeyMaterials() bool { + _, ok := _this.Get_().(BranchKeyMaterials_BranchKeyMaterials) + return ok +} + +func (CompanionStruct_BranchKeyMaterials_) Default() BranchKeyMaterials { + return Companion_BranchKeyMaterials_.Create_BranchKeyMaterials_(_dafny.EmptySeq.SetString(), m_UTF8.Companion_ValidUTF8Bytes_.Witness(), _dafny.EmptyMap, _dafny.EmptySeq) +} + +func (_this BranchKeyMaterials) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(BranchKeyMaterials_BranchKeyMaterials).BranchKeyIdentifier +} + +func (_this BranchKeyMaterials) Dtor_branchKeyVersion() _dafny.Sequence { + return _this.Get_().(BranchKeyMaterials_BranchKeyMaterials).BranchKeyVersion +} + +func (_this BranchKeyMaterials) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(BranchKeyMaterials_BranchKeyMaterials).EncryptionContext +} + +func (_this BranchKeyMaterials) Dtor_branchKey() _dafny.Sequence { + return _this.Get_().(BranchKeyMaterials_BranchKeyMaterials).BranchKey +} + +func (_this BranchKeyMaterials) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case BranchKeyMaterials_BranchKeyMaterials: + { + return "AwsCryptographyKeyStoreTypes.BranchKeyMaterials.BranchKeyMaterials" + "(" + _dafny.String(data.BranchKeyIdentifier) + ", " + _dafny.String(data.BranchKeyVersion) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.BranchKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this BranchKeyMaterials) Equals(other BranchKeyMaterials) bool { + switch data1 := _this.Get_().(type) { + case BranchKeyMaterials_BranchKeyMaterials: + { + data2, ok := other.Get_().(BranchKeyMaterials_BranchKeyMaterials) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) && data1.BranchKeyVersion.Equals(data2.BranchKeyVersion) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.BranchKey.Equals(data2.BranchKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this BranchKeyMaterials) EqualsGeneric(other interface{}) bool { + typed, ok := other.(BranchKeyMaterials) + return ok && _this.Equals(typed) +} + +func Type_BranchKeyMaterials_() _dafny.TypeDescriptor { + return type_BranchKeyMaterials_{} +} + +type type_BranchKeyMaterials_ struct { +} + +func (_this type_BranchKeyMaterials_) Default() interface{} { + return Companion_BranchKeyMaterials_.Default() +} + +func (_this type_BranchKeyMaterials_) String() string { + return "AwsCryptographyKeyStoreTypes.BranchKeyMaterials" +} +func (_this BranchKeyMaterials) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = BranchKeyMaterials{} + +// End of datatype BranchKeyMaterials + +// Definition of datatype CreateKeyInput +type CreateKeyInput struct { + Data_CreateKeyInput_ +} + +func (_this CreateKeyInput) Get_() Data_CreateKeyInput_ { + return _this.Data_CreateKeyInput_ +} + +type Data_CreateKeyInput_ interface { + isCreateKeyInput() +} + +type CompanionStruct_CreateKeyInput_ struct { +} + +var Companion_CreateKeyInput_ = CompanionStruct_CreateKeyInput_{} + +type CreateKeyInput_CreateKeyInput struct { + BranchKeyIdentifier m_Wrappers.Option + EncryptionContext m_Wrappers.Option +} + +func (CreateKeyInput_CreateKeyInput) isCreateKeyInput() {} + +func (CompanionStruct_CreateKeyInput_) Create_CreateKeyInput_(BranchKeyIdentifier m_Wrappers.Option, EncryptionContext m_Wrappers.Option) CreateKeyInput { + return CreateKeyInput{CreateKeyInput_CreateKeyInput{BranchKeyIdentifier, EncryptionContext}} +} + +func (_this CreateKeyInput) Is_CreateKeyInput() bool { + _, ok := _this.Get_().(CreateKeyInput_CreateKeyInput) + return ok +} + +func (CompanionStruct_CreateKeyInput_) Default() CreateKeyInput { + return Companion_CreateKeyInput_.Create_CreateKeyInput_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateKeyInput) Dtor_branchKeyIdentifier() m_Wrappers.Option { + return _this.Get_().(CreateKeyInput_CreateKeyInput).BranchKeyIdentifier +} + +func (_this CreateKeyInput) Dtor_encryptionContext() m_Wrappers.Option { + return _this.Get_().(CreateKeyInput_CreateKeyInput).EncryptionContext +} + +func (_this CreateKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateKeyInput_CreateKeyInput: + { + return "AwsCryptographyKeyStoreTypes.CreateKeyInput.CreateKeyInput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ", " + _dafny.String(data.EncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateKeyInput) Equals(other CreateKeyInput) bool { + switch data1 := _this.Get_().(type) { + case CreateKeyInput_CreateKeyInput: + { + data2, ok := other.Get_().(CreateKeyInput_CreateKeyInput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) && data1.EncryptionContext.Equals(data2.EncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateKeyInput) + return ok && _this.Equals(typed) +} + +func Type_CreateKeyInput_() _dafny.TypeDescriptor { + return type_CreateKeyInput_{} +} + +type type_CreateKeyInput_ struct { +} + +func (_this type_CreateKeyInput_) Default() interface{} { + return Companion_CreateKeyInput_.Default() +} + +func (_this type_CreateKeyInput_) String() string { + return "AwsCryptographyKeyStoreTypes.CreateKeyInput" +} +func (_this CreateKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateKeyInput{} + +// End of datatype CreateKeyInput + +// Definition of datatype CreateKeyOutput +type CreateKeyOutput struct { + Data_CreateKeyOutput_ +} + +func (_this CreateKeyOutput) Get_() Data_CreateKeyOutput_ { + return _this.Data_CreateKeyOutput_ +} + +type Data_CreateKeyOutput_ interface { + isCreateKeyOutput() +} + +type CompanionStruct_CreateKeyOutput_ struct { +} + +var Companion_CreateKeyOutput_ = CompanionStruct_CreateKeyOutput_{} + +type CreateKeyOutput_CreateKeyOutput struct { + BranchKeyIdentifier _dafny.Sequence +} + +func (CreateKeyOutput_CreateKeyOutput) isCreateKeyOutput() {} + +func (CompanionStruct_CreateKeyOutput_) Create_CreateKeyOutput_(BranchKeyIdentifier _dafny.Sequence) CreateKeyOutput { + return CreateKeyOutput{CreateKeyOutput_CreateKeyOutput{BranchKeyIdentifier}} +} + +func (_this CreateKeyOutput) Is_CreateKeyOutput() bool { + _, ok := _this.Get_().(CreateKeyOutput_CreateKeyOutput) + return ok +} + +func (CompanionStruct_CreateKeyOutput_) Default() CreateKeyOutput { + return Companion_CreateKeyOutput_.Create_CreateKeyOutput_(_dafny.EmptySeq.SetString()) +} + +func (_this CreateKeyOutput) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(CreateKeyOutput_CreateKeyOutput).BranchKeyIdentifier +} + +func (_this CreateKeyOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateKeyOutput_CreateKeyOutput: + { + return "AwsCryptographyKeyStoreTypes.CreateKeyOutput.CreateKeyOutput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateKeyOutput) Equals(other CreateKeyOutput) bool { + switch data1 := _this.Get_().(type) { + case CreateKeyOutput_CreateKeyOutput: + { + data2, ok := other.Get_().(CreateKeyOutput_CreateKeyOutput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateKeyOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateKeyOutput) + return ok && _this.Equals(typed) +} + +func Type_CreateKeyOutput_() _dafny.TypeDescriptor { + return type_CreateKeyOutput_{} +} + +type type_CreateKeyOutput_ struct { +} + +func (_this type_CreateKeyOutput_) Default() interface{} { + return Companion_CreateKeyOutput_.Default() +} + +func (_this type_CreateKeyOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.CreateKeyOutput" +} +func (_this CreateKeyOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateKeyOutput{} + +// End of datatype CreateKeyOutput + +// Definition of datatype CreateKeyStoreInput +type CreateKeyStoreInput struct { + Data_CreateKeyStoreInput_ +} + +func (_this CreateKeyStoreInput) Get_() Data_CreateKeyStoreInput_ { + return _this.Data_CreateKeyStoreInput_ +} + +type Data_CreateKeyStoreInput_ interface { + isCreateKeyStoreInput() +} + +type CompanionStruct_CreateKeyStoreInput_ struct { +} + +var Companion_CreateKeyStoreInput_ = CompanionStruct_CreateKeyStoreInput_{} + +type CreateKeyStoreInput_CreateKeyStoreInput struct { +} + +func (CreateKeyStoreInput_CreateKeyStoreInput) isCreateKeyStoreInput() {} + +func (CompanionStruct_CreateKeyStoreInput_) Create_CreateKeyStoreInput_() CreateKeyStoreInput { + return CreateKeyStoreInput{CreateKeyStoreInput_CreateKeyStoreInput{}} +} + +func (_this CreateKeyStoreInput) Is_CreateKeyStoreInput() bool { + _, ok := _this.Get_().(CreateKeyStoreInput_CreateKeyStoreInput) + return ok +} + +func (CompanionStruct_CreateKeyStoreInput_) Default() CreateKeyStoreInput { + return Companion_CreateKeyStoreInput_.Create_CreateKeyStoreInput_() +} + +func (_ CompanionStruct_CreateKeyStoreInput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateKeyStoreInput_.Create_CreateKeyStoreInput_(), true + default: + return CreateKeyStoreInput{}, false + } + } +} + +func (_this CreateKeyStoreInput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateKeyStoreInput_CreateKeyStoreInput: + { + return "AwsCryptographyKeyStoreTypes.CreateKeyStoreInput.CreateKeyStoreInput" + } + default: + { + return "" + } + } +} + +func (_this CreateKeyStoreInput) Equals(other CreateKeyStoreInput) bool { + switch _this.Get_().(type) { + case CreateKeyStoreInput_CreateKeyStoreInput: + { + _, ok := other.Get_().(CreateKeyStoreInput_CreateKeyStoreInput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateKeyStoreInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateKeyStoreInput) + return ok && _this.Equals(typed) +} + +func Type_CreateKeyStoreInput_() _dafny.TypeDescriptor { + return type_CreateKeyStoreInput_{} +} + +type type_CreateKeyStoreInput_ struct { +} + +func (_this type_CreateKeyStoreInput_) Default() interface{} { + return Companion_CreateKeyStoreInput_.Default() +} + +func (_this type_CreateKeyStoreInput_) String() string { + return "AwsCryptographyKeyStoreTypes.CreateKeyStoreInput" +} +func (_this CreateKeyStoreInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateKeyStoreInput{} + +// End of datatype CreateKeyStoreInput + +// Definition of datatype CreateKeyStoreOutput +type CreateKeyStoreOutput struct { + Data_CreateKeyStoreOutput_ +} + +func (_this CreateKeyStoreOutput) Get_() Data_CreateKeyStoreOutput_ { + return _this.Data_CreateKeyStoreOutput_ +} + +type Data_CreateKeyStoreOutput_ interface { + isCreateKeyStoreOutput() +} + +type CompanionStruct_CreateKeyStoreOutput_ struct { +} + +var Companion_CreateKeyStoreOutput_ = CompanionStruct_CreateKeyStoreOutput_{} + +type CreateKeyStoreOutput_CreateKeyStoreOutput struct { + TableArn _dafny.Sequence +} + +func (CreateKeyStoreOutput_CreateKeyStoreOutput) isCreateKeyStoreOutput() {} + +func (CompanionStruct_CreateKeyStoreOutput_) Create_CreateKeyStoreOutput_(TableArn _dafny.Sequence) CreateKeyStoreOutput { + return CreateKeyStoreOutput{CreateKeyStoreOutput_CreateKeyStoreOutput{TableArn}} +} + +func (_this CreateKeyStoreOutput) Is_CreateKeyStoreOutput() bool { + _, ok := _this.Get_().(CreateKeyStoreOutput_CreateKeyStoreOutput) + return ok +} + +func (CompanionStruct_CreateKeyStoreOutput_) Default() CreateKeyStoreOutput { + return Companion_CreateKeyStoreOutput_.Create_CreateKeyStoreOutput_(_dafny.EmptySeq.SetString()) +} + +func (_this CreateKeyStoreOutput) Dtor_tableArn() _dafny.Sequence { + return _this.Get_().(CreateKeyStoreOutput_CreateKeyStoreOutput).TableArn +} + +func (_this CreateKeyStoreOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateKeyStoreOutput_CreateKeyStoreOutput: + { + return "AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput.CreateKeyStoreOutput" + "(" + _dafny.String(data.TableArn) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateKeyStoreOutput) Equals(other CreateKeyStoreOutput) bool { + switch data1 := _this.Get_().(type) { + case CreateKeyStoreOutput_CreateKeyStoreOutput: + { + data2, ok := other.Get_().(CreateKeyStoreOutput_CreateKeyStoreOutput) + return ok && data1.TableArn.Equals(data2.TableArn) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateKeyStoreOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateKeyStoreOutput) + return ok && _this.Equals(typed) +} + +func Type_CreateKeyStoreOutput_() _dafny.TypeDescriptor { + return type_CreateKeyStoreOutput_{} +} + +type type_CreateKeyStoreOutput_ struct { +} + +func (_this type_CreateKeyStoreOutput_) Default() interface{} { + return Companion_CreateKeyStoreOutput_.Default() +} + +func (_this type_CreateKeyStoreOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput" +} +func (_this CreateKeyStoreOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateKeyStoreOutput{} + +// End of datatype CreateKeyStoreOutput + +// Definition of datatype Discovery +type Discovery struct { + Data_Discovery_ +} + +func (_this Discovery) Get_() Data_Discovery_ { + return _this.Data_Discovery_ +} + +type Data_Discovery_ interface { + isDiscovery() +} + +type CompanionStruct_Discovery_ struct { +} + +var Companion_Discovery_ = CompanionStruct_Discovery_{} + +type Discovery_Discovery struct { +} + +func (Discovery_Discovery) isDiscovery() {} + +func (CompanionStruct_Discovery_) Create_Discovery_() Discovery { + return Discovery{Discovery_Discovery{}} +} + +func (_this Discovery) Is_Discovery() bool { + _, ok := _this.Get_().(Discovery_Discovery) + return ok +} + +func (CompanionStruct_Discovery_) Default() Discovery { + return Companion_Discovery_.Create_Discovery_() +} + +func (_ CompanionStruct_Discovery_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_Discovery_.Create_Discovery_(), true + default: + return Discovery{}, false + } + } +} + +func (_this Discovery) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case Discovery_Discovery: + { + return "AwsCryptographyKeyStoreTypes.Discovery.Discovery" + } + default: + { + return "" + } + } +} + +func (_this Discovery) Equals(other Discovery) bool { + switch _this.Get_().(type) { + case Discovery_Discovery: + { + _, ok := other.Get_().(Discovery_Discovery) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this Discovery) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Discovery) + return ok && _this.Equals(typed) +} + +func Type_Discovery_() _dafny.TypeDescriptor { + return type_Discovery_{} +} + +type type_Discovery_ struct { +} + +func (_this type_Discovery_) Default() interface{} { + return Companion_Discovery_.Default() +} + +func (_this type_Discovery_) String() string { + return "AwsCryptographyKeyStoreTypes.Discovery" +} +func (_this Discovery) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Discovery{} + +// End of datatype Discovery + +// Definition of datatype GetActiveBranchKeyInput +type GetActiveBranchKeyInput struct { + Data_GetActiveBranchKeyInput_ +} + +func (_this GetActiveBranchKeyInput) Get_() Data_GetActiveBranchKeyInput_ { + return _this.Data_GetActiveBranchKeyInput_ +} + +type Data_GetActiveBranchKeyInput_ interface { + isGetActiveBranchKeyInput() +} + +type CompanionStruct_GetActiveBranchKeyInput_ struct { +} + +var Companion_GetActiveBranchKeyInput_ = CompanionStruct_GetActiveBranchKeyInput_{} + +type GetActiveBranchKeyInput_GetActiveBranchKeyInput struct { + BranchKeyIdentifier _dafny.Sequence +} + +func (GetActiveBranchKeyInput_GetActiveBranchKeyInput) isGetActiveBranchKeyInput() {} + +func (CompanionStruct_GetActiveBranchKeyInput_) Create_GetActiveBranchKeyInput_(BranchKeyIdentifier _dafny.Sequence) GetActiveBranchKeyInput { + return GetActiveBranchKeyInput{GetActiveBranchKeyInput_GetActiveBranchKeyInput{BranchKeyIdentifier}} +} + +func (_this GetActiveBranchKeyInput) Is_GetActiveBranchKeyInput() bool { + _, ok := _this.Get_().(GetActiveBranchKeyInput_GetActiveBranchKeyInput) + return ok +} + +func (CompanionStruct_GetActiveBranchKeyInput_) Default() GetActiveBranchKeyInput { + return Companion_GetActiveBranchKeyInput_.Create_GetActiveBranchKeyInput_(_dafny.EmptySeq.SetString()) +} + +func (_this GetActiveBranchKeyInput) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(GetActiveBranchKeyInput_GetActiveBranchKeyInput).BranchKeyIdentifier +} + +func (_this GetActiveBranchKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetActiveBranchKeyInput_GetActiveBranchKeyInput: + { + return "AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput.GetActiveBranchKeyInput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetActiveBranchKeyInput) Equals(other GetActiveBranchKeyInput) bool { + switch data1 := _this.Get_().(type) { + case GetActiveBranchKeyInput_GetActiveBranchKeyInput: + { + data2, ok := other.Get_().(GetActiveBranchKeyInput_GetActiveBranchKeyInput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetActiveBranchKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetActiveBranchKeyInput) + return ok && _this.Equals(typed) +} + +func Type_GetActiveBranchKeyInput_() _dafny.TypeDescriptor { + return type_GetActiveBranchKeyInput_{} +} + +type type_GetActiveBranchKeyInput_ struct { +} + +func (_this type_GetActiveBranchKeyInput_) Default() interface{} { + return Companion_GetActiveBranchKeyInput_.Default() +} + +func (_this type_GetActiveBranchKeyInput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput" +} +func (_this GetActiveBranchKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetActiveBranchKeyInput{} + +// End of datatype GetActiveBranchKeyInput + +// Definition of datatype GetActiveBranchKeyOutput +type GetActiveBranchKeyOutput struct { + Data_GetActiveBranchKeyOutput_ +} + +func (_this GetActiveBranchKeyOutput) Get_() Data_GetActiveBranchKeyOutput_ { + return _this.Data_GetActiveBranchKeyOutput_ +} + +type Data_GetActiveBranchKeyOutput_ interface { + isGetActiveBranchKeyOutput() +} + +type CompanionStruct_GetActiveBranchKeyOutput_ struct { +} + +var Companion_GetActiveBranchKeyOutput_ = CompanionStruct_GetActiveBranchKeyOutput_{} + +type GetActiveBranchKeyOutput_GetActiveBranchKeyOutput struct { + BranchKeyMaterials BranchKeyMaterials +} + +func (GetActiveBranchKeyOutput_GetActiveBranchKeyOutput) isGetActiveBranchKeyOutput() {} + +func (CompanionStruct_GetActiveBranchKeyOutput_) Create_GetActiveBranchKeyOutput_(BranchKeyMaterials BranchKeyMaterials) GetActiveBranchKeyOutput { + return GetActiveBranchKeyOutput{GetActiveBranchKeyOutput_GetActiveBranchKeyOutput{BranchKeyMaterials}} +} + +func (_this GetActiveBranchKeyOutput) Is_GetActiveBranchKeyOutput() bool { + _, ok := _this.Get_().(GetActiveBranchKeyOutput_GetActiveBranchKeyOutput) + return ok +} + +func (CompanionStruct_GetActiveBranchKeyOutput_) Default() GetActiveBranchKeyOutput { + return Companion_GetActiveBranchKeyOutput_.Create_GetActiveBranchKeyOutput_(Companion_BranchKeyMaterials_.Default()) +} + +func (_this GetActiveBranchKeyOutput) Dtor_branchKeyMaterials() BranchKeyMaterials { + return _this.Get_().(GetActiveBranchKeyOutput_GetActiveBranchKeyOutput).BranchKeyMaterials +} + +func (_this GetActiveBranchKeyOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetActiveBranchKeyOutput_GetActiveBranchKeyOutput: + { + return "AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput.GetActiveBranchKeyOutput" + "(" + _dafny.String(data.BranchKeyMaterials) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetActiveBranchKeyOutput) Equals(other GetActiveBranchKeyOutput) bool { + switch data1 := _this.Get_().(type) { + case GetActiveBranchKeyOutput_GetActiveBranchKeyOutput: + { + data2, ok := other.Get_().(GetActiveBranchKeyOutput_GetActiveBranchKeyOutput) + return ok && data1.BranchKeyMaterials.Equals(data2.BranchKeyMaterials) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetActiveBranchKeyOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetActiveBranchKeyOutput) + return ok && _this.Equals(typed) +} + +func Type_GetActiveBranchKeyOutput_() _dafny.TypeDescriptor { + return type_GetActiveBranchKeyOutput_{} +} + +type type_GetActiveBranchKeyOutput_ struct { +} + +func (_this type_GetActiveBranchKeyOutput_) Default() interface{} { + return Companion_GetActiveBranchKeyOutput_.Default() +} + +func (_this type_GetActiveBranchKeyOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput" +} +func (_this GetActiveBranchKeyOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetActiveBranchKeyOutput{} + +// End of datatype GetActiveBranchKeyOutput + +// Definition of datatype GetBeaconKeyInput +type GetBeaconKeyInput struct { + Data_GetBeaconKeyInput_ +} + +func (_this GetBeaconKeyInput) Get_() Data_GetBeaconKeyInput_ { + return _this.Data_GetBeaconKeyInput_ +} + +type Data_GetBeaconKeyInput_ interface { + isGetBeaconKeyInput() +} + +type CompanionStruct_GetBeaconKeyInput_ struct { +} + +var Companion_GetBeaconKeyInput_ = CompanionStruct_GetBeaconKeyInput_{} + +type GetBeaconKeyInput_GetBeaconKeyInput struct { + BranchKeyIdentifier _dafny.Sequence +} + +func (GetBeaconKeyInput_GetBeaconKeyInput) isGetBeaconKeyInput() {} + +func (CompanionStruct_GetBeaconKeyInput_) Create_GetBeaconKeyInput_(BranchKeyIdentifier _dafny.Sequence) GetBeaconKeyInput { + return GetBeaconKeyInput{GetBeaconKeyInput_GetBeaconKeyInput{BranchKeyIdentifier}} +} + +func (_this GetBeaconKeyInput) Is_GetBeaconKeyInput() bool { + _, ok := _this.Get_().(GetBeaconKeyInput_GetBeaconKeyInput) + return ok +} + +func (CompanionStruct_GetBeaconKeyInput_) Default() GetBeaconKeyInput { + return Companion_GetBeaconKeyInput_.Create_GetBeaconKeyInput_(_dafny.EmptySeq.SetString()) +} + +func (_this GetBeaconKeyInput) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(GetBeaconKeyInput_GetBeaconKeyInput).BranchKeyIdentifier +} + +func (_this GetBeaconKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBeaconKeyInput_GetBeaconKeyInput: + { + return "AwsCryptographyKeyStoreTypes.GetBeaconKeyInput.GetBeaconKeyInput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBeaconKeyInput) Equals(other GetBeaconKeyInput) bool { + switch data1 := _this.Get_().(type) { + case GetBeaconKeyInput_GetBeaconKeyInput: + { + data2, ok := other.Get_().(GetBeaconKeyInput_GetBeaconKeyInput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBeaconKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBeaconKeyInput) + return ok && _this.Equals(typed) +} + +func Type_GetBeaconKeyInput_() _dafny.TypeDescriptor { + return type_GetBeaconKeyInput_{} +} + +type type_GetBeaconKeyInput_ struct { +} + +func (_this type_GetBeaconKeyInput_) Default() interface{} { + return Companion_GetBeaconKeyInput_.Default() +} + +func (_this type_GetBeaconKeyInput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetBeaconKeyInput" +} +func (_this GetBeaconKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBeaconKeyInput{} + +// End of datatype GetBeaconKeyInput + +// Definition of datatype GetBeaconKeyOutput +type GetBeaconKeyOutput struct { + Data_GetBeaconKeyOutput_ +} + +func (_this GetBeaconKeyOutput) Get_() Data_GetBeaconKeyOutput_ { + return _this.Data_GetBeaconKeyOutput_ +} + +type Data_GetBeaconKeyOutput_ interface { + isGetBeaconKeyOutput() +} + +type CompanionStruct_GetBeaconKeyOutput_ struct { +} + +var Companion_GetBeaconKeyOutput_ = CompanionStruct_GetBeaconKeyOutput_{} + +type GetBeaconKeyOutput_GetBeaconKeyOutput struct { + BeaconKeyMaterials BeaconKeyMaterials +} + +func (GetBeaconKeyOutput_GetBeaconKeyOutput) isGetBeaconKeyOutput() {} + +func (CompanionStruct_GetBeaconKeyOutput_) Create_GetBeaconKeyOutput_(BeaconKeyMaterials BeaconKeyMaterials) GetBeaconKeyOutput { + return GetBeaconKeyOutput{GetBeaconKeyOutput_GetBeaconKeyOutput{BeaconKeyMaterials}} +} + +func (_this GetBeaconKeyOutput) Is_GetBeaconKeyOutput() bool { + _, ok := _this.Get_().(GetBeaconKeyOutput_GetBeaconKeyOutput) + return ok +} + +func (CompanionStruct_GetBeaconKeyOutput_) Default() GetBeaconKeyOutput { + return Companion_GetBeaconKeyOutput_.Create_GetBeaconKeyOutput_(Companion_BeaconKeyMaterials_.Default()) +} + +func (_this GetBeaconKeyOutput) Dtor_beaconKeyMaterials() BeaconKeyMaterials { + return _this.Get_().(GetBeaconKeyOutput_GetBeaconKeyOutput).BeaconKeyMaterials +} + +func (_this GetBeaconKeyOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBeaconKeyOutput_GetBeaconKeyOutput: + { + return "AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput.GetBeaconKeyOutput" + "(" + _dafny.String(data.BeaconKeyMaterials) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBeaconKeyOutput) Equals(other GetBeaconKeyOutput) bool { + switch data1 := _this.Get_().(type) { + case GetBeaconKeyOutput_GetBeaconKeyOutput: + { + data2, ok := other.Get_().(GetBeaconKeyOutput_GetBeaconKeyOutput) + return ok && data1.BeaconKeyMaterials.Equals(data2.BeaconKeyMaterials) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBeaconKeyOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBeaconKeyOutput) + return ok && _this.Equals(typed) +} + +func Type_GetBeaconKeyOutput_() _dafny.TypeDescriptor { + return type_GetBeaconKeyOutput_{} +} + +type type_GetBeaconKeyOutput_ struct { +} + +func (_this type_GetBeaconKeyOutput_) Default() interface{} { + return Companion_GetBeaconKeyOutput_.Default() +} + +func (_this type_GetBeaconKeyOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput" +} +func (_this GetBeaconKeyOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBeaconKeyOutput{} + +// End of datatype GetBeaconKeyOutput + +// Definition of datatype GetBranchKeyVersionInput +type GetBranchKeyVersionInput struct { + Data_GetBranchKeyVersionInput_ +} + +func (_this GetBranchKeyVersionInput) Get_() Data_GetBranchKeyVersionInput_ { + return _this.Data_GetBranchKeyVersionInput_ +} + +type Data_GetBranchKeyVersionInput_ interface { + isGetBranchKeyVersionInput() +} + +type CompanionStruct_GetBranchKeyVersionInput_ struct { +} + +var Companion_GetBranchKeyVersionInput_ = CompanionStruct_GetBranchKeyVersionInput_{} + +type GetBranchKeyVersionInput_GetBranchKeyVersionInput struct { + BranchKeyIdentifier _dafny.Sequence + BranchKeyVersion _dafny.Sequence +} + +func (GetBranchKeyVersionInput_GetBranchKeyVersionInput) isGetBranchKeyVersionInput() {} + +func (CompanionStruct_GetBranchKeyVersionInput_) Create_GetBranchKeyVersionInput_(BranchKeyIdentifier _dafny.Sequence, BranchKeyVersion _dafny.Sequence) GetBranchKeyVersionInput { + return GetBranchKeyVersionInput{GetBranchKeyVersionInput_GetBranchKeyVersionInput{BranchKeyIdentifier, BranchKeyVersion}} +} + +func (_this GetBranchKeyVersionInput) Is_GetBranchKeyVersionInput() bool { + _, ok := _this.Get_().(GetBranchKeyVersionInput_GetBranchKeyVersionInput) + return ok +} + +func (CompanionStruct_GetBranchKeyVersionInput_) Default() GetBranchKeyVersionInput { + return Companion_GetBranchKeyVersionInput_.Create_GetBranchKeyVersionInput_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString()) +} + +func (_this GetBranchKeyVersionInput) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(GetBranchKeyVersionInput_GetBranchKeyVersionInput).BranchKeyIdentifier +} + +func (_this GetBranchKeyVersionInput) Dtor_branchKeyVersion() _dafny.Sequence { + return _this.Get_().(GetBranchKeyVersionInput_GetBranchKeyVersionInput).BranchKeyVersion +} + +func (_this GetBranchKeyVersionInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBranchKeyVersionInput_GetBranchKeyVersionInput: + { + return "AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput.GetBranchKeyVersionInput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ", " + _dafny.String(data.BranchKeyVersion) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBranchKeyVersionInput) Equals(other GetBranchKeyVersionInput) bool { + switch data1 := _this.Get_().(type) { + case GetBranchKeyVersionInput_GetBranchKeyVersionInput: + { + data2, ok := other.Get_().(GetBranchKeyVersionInput_GetBranchKeyVersionInput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) && data1.BranchKeyVersion.Equals(data2.BranchKeyVersion) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBranchKeyVersionInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBranchKeyVersionInput) + return ok && _this.Equals(typed) +} + +func Type_GetBranchKeyVersionInput_() _dafny.TypeDescriptor { + return type_GetBranchKeyVersionInput_{} +} + +type type_GetBranchKeyVersionInput_ struct { +} + +func (_this type_GetBranchKeyVersionInput_) Default() interface{} { + return Companion_GetBranchKeyVersionInput_.Default() +} + +func (_this type_GetBranchKeyVersionInput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput" +} +func (_this GetBranchKeyVersionInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBranchKeyVersionInput{} + +// End of datatype GetBranchKeyVersionInput + +// Definition of datatype GetBranchKeyVersionOutput +type GetBranchKeyVersionOutput struct { + Data_GetBranchKeyVersionOutput_ +} + +func (_this GetBranchKeyVersionOutput) Get_() Data_GetBranchKeyVersionOutput_ { + return _this.Data_GetBranchKeyVersionOutput_ +} + +type Data_GetBranchKeyVersionOutput_ interface { + isGetBranchKeyVersionOutput() +} + +type CompanionStruct_GetBranchKeyVersionOutput_ struct { +} + +var Companion_GetBranchKeyVersionOutput_ = CompanionStruct_GetBranchKeyVersionOutput_{} + +type GetBranchKeyVersionOutput_GetBranchKeyVersionOutput struct { + BranchKeyMaterials BranchKeyMaterials +} + +func (GetBranchKeyVersionOutput_GetBranchKeyVersionOutput) isGetBranchKeyVersionOutput() {} + +func (CompanionStruct_GetBranchKeyVersionOutput_) Create_GetBranchKeyVersionOutput_(BranchKeyMaterials BranchKeyMaterials) GetBranchKeyVersionOutput { + return GetBranchKeyVersionOutput{GetBranchKeyVersionOutput_GetBranchKeyVersionOutput{BranchKeyMaterials}} +} + +func (_this GetBranchKeyVersionOutput) Is_GetBranchKeyVersionOutput() bool { + _, ok := _this.Get_().(GetBranchKeyVersionOutput_GetBranchKeyVersionOutput) + return ok +} + +func (CompanionStruct_GetBranchKeyVersionOutput_) Default() GetBranchKeyVersionOutput { + return Companion_GetBranchKeyVersionOutput_.Create_GetBranchKeyVersionOutput_(Companion_BranchKeyMaterials_.Default()) +} + +func (_this GetBranchKeyVersionOutput) Dtor_branchKeyMaterials() BranchKeyMaterials { + return _this.Get_().(GetBranchKeyVersionOutput_GetBranchKeyVersionOutput).BranchKeyMaterials +} + +func (_this GetBranchKeyVersionOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBranchKeyVersionOutput_GetBranchKeyVersionOutput: + { + return "AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput.GetBranchKeyVersionOutput" + "(" + _dafny.String(data.BranchKeyMaterials) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBranchKeyVersionOutput) Equals(other GetBranchKeyVersionOutput) bool { + switch data1 := _this.Get_().(type) { + case GetBranchKeyVersionOutput_GetBranchKeyVersionOutput: + { + data2, ok := other.Get_().(GetBranchKeyVersionOutput_GetBranchKeyVersionOutput) + return ok && data1.BranchKeyMaterials.Equals(data2.BranchKeyMaterials) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBranchKeyVersionOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBranchKeyVersionOutput) + return ok && _this.Equals(typed) +} + +func Type_GetBranchKeyVersionOutput_() _dafny.TypeDescriptor { + return type_GetBranchKeyVersionOutput_{} +} + +type type_GetBranchKeyVersionOutput_ struct { +} + +func (_this type_GetBranchKeyVersionOutput_) Default() interface{} { + return Companion_GetBranchKeyVersionOutput_.Default() +} + +func (_this type_GetBranchKeyVersionOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput" +} +func (_this GetBranchKeyVersionOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBranchKeyVersionOutput{} + +// End of datatype GetBranchKeyVersionOutput + +// Definition of datatype GetKeyStoreInfoOutput +type GetKeyStoreInfoOutput struct { + Data_GetKeyStoreInfoOutput_ +} + +func (_this GetKeyStoreInfoOutput) Get_() Data_GetKeyStoreInfoOutput_ { + return _this.Data_GetKeyStoreInfoOutput_ +} + +type Data_GetKeyStoreInfoOutput_ interface { + isGetKeyStoreInfoOutput() +} + +type CompanionStruct_GetKeyStoreInfoOutput_ struct { +} + +var Companion_GetKeyStoreInfoOutput_ = CompanionStruct_GetKeyStoreInfoOutput_{} + +type GetKeyStoreInfoOutput_GetKeyStoreInfoOutput struct { + KeyStoreId _dafny.Sequence + KeyStoreName _dafny.Sequence + LogicalKeyStoreName _dafny.Sequence + GrantTokens _dafny.Sequence + KmsConfiguration KMSConfiguration +} + +func (GetKeyStoreInfoOutput_GetKeyStoreInfoOutput) isGetKeyStoreInfoOutput() {} + +func (CompanionStruct_GetKeyStoreInfoOutput_) Create_GetKeyStoreInfoOutput_(KeyStoreId _dafny.Sequence, KeyStoreName _dafny.Sequence, LogicalKeyStoreName _dafny.Sequence, GrantTokens _dafny.Sequence, KmsConfiguration KMSConfiguration) GetKeyStoreInfoOutput { + return GetKeyStoreInfoOutput{GetKeyStoreInfoOutput_GetKeyStoreInfoOutput{KeyStoreId, KeyStoreName, LogicalKeyStoreName, GrantTokens, KmsConfiguration}} +} + +func (_this GetKeyStoreInfoOutput) Is_GetKeyStoreInfoOutput() bool { + _, ok := _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput) + return ok +} + +func (CompanionStruct_GetKeyStoreInfoOutput_) Default() GetKeyStoreInfoOutput { + return Companion_GetKeyStoreInfoOutput_.Create_GetKeyStoreInfoOutput_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq, Companion_KMSConfiguration_.Default()) +} + +func (_this GetKeyStoreInfoOutput) Dtor_keyStoreId() _dafny.Sequence { + return _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput).KeyStoreId +} + +func (_this GetKeyStoreInfoOutput) Dtor_keyStoreName() _dafny.Sequence { + return _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput).KeyStoreName +} + +func (_this GetKeyStoreInfoOutput) Dtor_logicalKeyStoreName() _dafny.Sequence { + return _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput).LogicalKeyStoreName +} + +func (_this GetKeyStoreInfoOutput) Dtor_grantTokens() _dafny.Sequence { + return _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput).GrantTokens +} + +func (_this GetKeyStoreInfoOutput) Dtor_kmsConfiguration() KMSConfiguration { + return _this.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput).KmsConfiguration +} + +func (_this GetKeyStoreInfoOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetKeyStoreInfoOutput_GetKeyStoreInfoOutput: + { + return "AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput.GetKeyStoreInfoOutput" + "(" + _dafny.String(data.KeyStoreId) + ", " + _dafny.String(data.KeyStoreName) + ", " + _dafny.String(data.LogicalKeyStoreName) + ", " + _dafny.String(data.GrantTokens) + ", " + _dafny.String(data.KmsConfiguration) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetKeyStoreInfoOutput) Equals(other GetKeyStoreInfoOutput) bool { + switch data1 := _this.Get_().(type) { + case GetKeyStoreInfoOutput_GetKeyStoreInfoOutput: + { + data2, ok := other.Get_().(GetKeyStoreInfoOutput_GetKeyStoreInfoOutput) + return ok && data1.KeyStoreId.Equals(data2.KeyStoreId) && data1.KeyStoreName.Equals(data2.KeyStoreName) && data1.LogicalKeyStoreName.Equals(data2.LogicalKeyStoreName) && data1.GrantTokens.Equals(data2.GrantTokens) && data1.KmsConfiguration.Equals(data2.KmsConfiguration) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetKeyStoreInfoOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetKeyStoreInfoOutput) + return ok && _this.Equals(typed) +} + +func Type_GetKeyStoreInfoOutput_() _dafny.TypeDescriptor { + return type_GetKeyStoreInfoOutput_{} +} + +type type_GetKeyStoreInfoOutput_ struct { +} + +func (_this type_GetKeyStoreInfoOutput_) Default() interface{} { + return Companion_GetKeyStoreInfoOutput_.Default() +} + +func (_this type_GetKeyStoreInfoOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput" +} +func (_this GetKeyStoreInfoOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetKeyStoreInfoOutput{} + +// End of datatype GetKeyStoreInfoOutput + +// Definition of class IKeyStoreClientCallHistory +type IKeyStoreClientCallHistory struct { + dummy byte +} + +func New_IKeyStoreClientCallHistory_() *IKeyStoreClientCallHistory { + _this := IKeyStoreClientCallHistory{} + + return &_this +} + +type CompanionStruct_IKeyStoreClientCallHistory_ struct { +} + +var Companion_IKeyStoreClientCallHistory_ = CompanionStruct_IKeyStoreClientCallHistory_{} + +func (_this *IKeyStoreClientCallHistory) Equals(other *IKeyStoreClientCallHistory) bool { + return _this == other +} + +func (_this *IKeyStoreClientCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IKeyStoreClientCallHistory) + return ok && _this.Equals(other) +} + +func (*IKeyStoreClientCallHistory) String() string { + return "AwsCryptographyKeyStoreTypes.IKeyStoreClientCallHistory" +} + +func Type_IKeyStoreClientCallHistory_() _dafny.TypeDescriptor { + return type_IKeyStoreClientCallHistory_{} +} + +type type_IKeyStoreClientCallHistory_ struct { +} + +func (_this type_IKeyStoreClientCallHistory_) Default() interface{} { + return (*IKeyStoreClientCallHistory)(nil) +} + +func (_this type_IKeyStoreClientCallHistory_) String() string { + return "AwsCryptographyKeyStoreTypes.IKeyStoreClientCallHistory" +} +func (_this *IKeyStoreClientCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IKeyStoreClientCallHistory{} + +// End of class IKeyStoreClientCallHistory + +// Definition of trait IKeyStoreClient +type IKeyStoreClient interface { + String() string + GetKeyStoreInfo() m_Wrappers.Result + CreateKeyStore(input CreateKeyStoreInput) m_Wrappers.Result + CreateKey(input CreateKeyInput) m_Wrappers.Result + VersionKey(input VersionKeyInput) m_Wrappers.Result + GetActiveBranchKey(input GetActiveBranchKeyInput) m_Wrappers.Result + GetBranchKeyVersion(input GetBranchKeyVersionInput) m_Wrappers.Result + GetBeaconKey(input GetBeaconKeyInput) m_Wrappers.Result +} +type CompanionStruct_IKeyStoreClient_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IKeyStoreClient_ = CompanionStruct_IKeyStoreClient_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IKeyStoreClient_) CastTo_(x interface{}) IKeyStoreClient { + var t IKeyStoreClient + t, _ = x.(IKeyStoreClient) + return t +} + +// End of trait IKeyStoreClient + +// Definition of datatype KeyStoreConfig +type KeyStoreConfig struct { + Data_KeyStoreConfig_ +} + +func (_this KeyStoreConfig) Get_() Data_KeyStoreConfig_ { + return _this.Data_KeyStoreConfig_ +} + +type Data_KeyStoreConfig_ interface { + isKeyStoreConfig() +} + +type CompanionStruct_KeyStoreConfig_ struct { +} + +var Companion_KeyStoreConfig_ = CompanionStruct_KeyStoreConfig_{} + +type KeyStoreConfig_KeyStoreConfig struct { + DdbTableName _dafny.Sequence + KmsConfiguration KMSConfiguration + LogicalKeyStoreName _dafny.Sequence + Id m_Wrappers.Option + GrantTokens m_Wrappers.Option + DdbClient m_Wrappers.Option + KmsClient m_Wrappers.Option +} + +func (KeyStoreConfig_KeyStoreConfig) isKeyStoreConfig() {} + +func (CompanionStruct_KeyStoreConfig_) Create_KeyStoreConfig_(DdbTableName _dafny.Sequence, KmsConfiguration KMSConfiguration, LogicalKeyStoreName _dafny.Sequence, Id m_Wrappers.Option, GrantTokens m_Wrappers.Option, DdbClient m_Wrappers.Option, KmsClient m_Wrappers.Option) KeyStoreConfig { + return KeyStoreConfig{KeyStoreConfig_KeyStoreConfig{DdbTableName, KmsConfiguration, LogicalKeyStoreName, Id, GrantTokens, DdbClient, KmsClient}} +} + +func (_this KeyStoreConfig) Is_KeyStoreConfig() bool { + _, ok := _this.Get_().(KeyStoreConfig_KeyStoreConfig) + return ok +} + +func (CompanionStruct_KeyStoreConfig_) Default() KeyStoreConfig { + return Companion_KeyStoreConfig_.Create_KeyStoreConfig_(_dafny.EmptySeq.SetString(), Companion_KMSConfiguration_.Default(), _dafny.EmptySeq.SetString(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this KeyStoreConfig) Dtor_ddbTableName() _dafny.Sequence { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).DdbTableName +} + +func (_this KeyStoreConfig) Dtor_kmsConfiguration() KMSConfiguration { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).KmsConfiguration +} + +func (_this KeyStoreConfig) Dtor_logicalKeyStoreName() _dafny.Sequence { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).LogicalKeyStoreName +} + +func (_this KeyStoreConfig) Dtor_id() m_Wrappers.Option { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).Id +} + +func (_this KeyStoreConfig) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).GrantTokens +} + +func (_this KeyStoreConfig) Dtor_ddbClient() m_Wrappers.Option { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).DdbClient +} + +func (_this KeyStoreConfig) Dtor_kmsClient() m_Wrappers.Option { + return _this.Get_().(KeyStoreConfig_KeyStoreConfig).KmsClient +} + +func (_this KeyStoreConfig) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KeyStoreConfig_KeyStoreConfig: + { + return "AwsCryptographyKeyStoreTypes.KeyStoreConfig.KeyStoreConfig" + "(" + _dafny.String(data.DdbTableName) + ", " + _dafny.String(data.KmsConfiguration) + ", " + _dafny.String(data.LogicalKeyStoreName) + ", " + _dafny.String(data.Id) + ", " + _dafny.String(data.GrantTokens) + ", " + _dafny.String(data.DdbClient) + ", " + _dafny.String(data.KmsClient) + ")" + } + default: + { + return "" + } + } +} + +func (_this KeyStoreConfig) Equals(other KeyStoreConfig) bool { + switch data1 := _this.Get_().(type) { + case KeyStoreConfig_KeyStoreConfig: + { + data2, ok := other.Get_().(KeyStoreConfig_KeyStoreConfig) + return ok && data1.DdbTableName.Equals(data2.DdbTableName) && data1.KmsConfiguration.Equals(data2.KmsConfiguration) && data1.LogicalKeyStoreName.Equals(data2.LogicalKeyStoreName) && data1.Id.Equals(data2.Id) && data1.GrantTokens.Equals(data2.GrantTokens) && data1.DdbClient.Equals(data2.DdbClient) && data1.KmsClient.Equals(data2.KmsClient) + } + default: + { + return false // unexpected + } + } +} + +func (_this KeyStoreConfig) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KeyStoreConfig) + return ok && _this.Equals(typed) +} + +func Type_KeyStoreConfig_() _dafny.TypeDescriptor { + return type_KeyStoreConfig_{} +} + +type type_KeyStoreConfig_ struct { +} + +func (_this type_KeyStoreConfig_) Default() interface{} { + return Companion_KeyStoreConfig_.Default() +} + +func (_this type_KeyStoreConfig_) String() string { + return "AwsCryptographyKeyStoreTypes.KeyStoreConfig" +} +func (_this KeyStoreConfig) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KeyStoreConfig{} + +// End of datatype KeyStoreConfig + +// Definition of datatype KMSConfiguration +type KMSConfiguration struct { + Data_KMSConfiguration_ +} + +func (_this KMSConfiguration) Get_() Data_KMSConfiguration_ { + return _this.Data_KMSConfiguration_ +} + +type Data_KMSConfiguration_ interface { + isKMSConfiguration() +} + +type CompanionStruct_KMSConfiguration_ struct { +} + +var Companion_KMSConfiguration_ = CompanionStruct_KMSConfiguration_{} + +type KMSConfiguration_kmsKeyArn struct { + KmsKeyArn _dafny.Sequence +} + +func (KMSConfiguration_kmsKeyArn) isKMSConfiguration() {} + +func (CompanionStruct_KMSConfiguration_) Create_kmsKeyArn_(KmsKeyArn _dafny.Sequence) KMSConfiguration { + return KMSConfiguration{KMSConfiguration_kmsKeyArn{KmsKeyArn}} +} + +func (_this KMSConfiguration) Is_kmsKeyArn() bool { + _, ok := _this.Get_().(KMSConfiguration_kmsKeyArn) + return ok +} + +type KMSConfiguration_kmsMRKeyArn struct { + KmsMRKeyArn _dafny.Sequence +} + +func (KMSConfiguration_kmsMRKeyArn) isKMSConfiguration() {} + +func (CompanionStruct_KMSConfiguration_) Create_kmsMRKeyArn_(KmsMRKeyArn _dafny.Sequence) KMSConfiguration { + return KMSConfiguration{KMSConfiguration_kmsMRKeyArn{KmsMRKeyArn}} +} + +func (_this KMSConfiguration) Is_kmsMRKeyArn() bool { + _, ok := _this.Get_().(KMSConfiguration_kmsMRKeyArn) + return ok +} + +type KMSConfiguration_discovery struct { + Discovery Discovery +} + +func (KMSConfiguration_discovery) isKMSConfiguration() {} + +func (CompanionStruct_KMSConfiguration_) Create_discovery_(Discovery Discovery) KMSConfiguration { + return KMSConfiguration{KMSConfiguration_discovery{Discovery}} +} + +func (_this KMSConfiguration) Is_discovery() bool { + _, ok := _this.Get_().(KMSConfiguration_discovery) + return ok +} + +type KMSConfiguration_mrDiscovery struct { + MrDiscovery MRDiscovery +} + +func (KMSConfiguration_mrDiscovery) isKMSConfiguration() {} + +func (CompanionStruct_KMSConfiguration_) Create_mrDiscovery_(MrDiscovery MRDiscovery) KMSConfiguration { + return KMSConfiguration{KMSConfiguration_mrDiscovery{MrDiscovery}} +} + +func (_this KMSConfiguration) Is_mrDiscovery() bool { + _, ok := _this.Get_().(KMSConfiguration_mrDiscovery) + return ok +} + +func (CompanionStruct_KMSConfiguration_) Default() KMSConfiguration { + return Companion_KMSConfiguration_.Create_kmsKeyArn_(_dafny.EmptySeq.SetString()) +} + +func (_this KMSConfiguration) Dtor_kmsKeyArn() _dafny.Sequence { + return _this.Get_().(KMSConfiguration_kmsKeyArn).KmsKeyArn +} + +func (_this KMSConfiguration) Dtor_kmsMRKeyArn() _dafny.Sequence { + return _this.Get_().(KMSConfiguration_kmsMRKeyArn).KmsMRKeyArn +} + +func (_this KMSConfiguration) Dtor_discovery() Discovery { + return _this.Get_().(KMSConfiguration_discovery).Discovery +} + +func (_this KMSConfiguration) Dtor_mrDiscovery() MRDiscovery { + return _this.Get_().(KMSConfiguration_mrDiscovery).MrDiscovery +} + +func (_this KMSConfiguration) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KMSConfiguration_kmsKeyArn: + { + return "AwsCryptographyKeyStoreTypes.KMSConfiguration.kmsKeyArn" + "(" + _dafny.String(data.KmsKeyArn) + ")" + } + case KMSConfiguration_kmsMRKeyArn: + { + return "AwsCryptographyKeyStoreTypes.KMSConfiguration.kmsMRKeyArn" + "(" + _dafny.String(data.KmsMRKeyArn) + ")" + } + case KMSConfiguration_discovery: + { + return "AwsCryptographyKeyStoreTypes.KMSConfiguration.discovery" + "(" + _dafny.String(data.Discovery) + ")" + } + case KMSConfiguration_mrDiscovery: + { + return "AwsCryptographyKeyStoreTypes.KMSConfiguration.mrDiscovery" + "(" + _dafny.String(data.MrDiscovery) + ")" + } + default: + { + return "" + } + } +} + +func (_this KMSConfiguration) Equals(other KMSConfiguration) bool { + switch data1 := _this.Get_().(type) { + case KMSConfiguration_kmsKeyArn: + { + data2, ok := other.Get_().(KMSConfiguration_kmsKeyArn) + return ok && data1.KmsKeyArn.Equals(data2.KmsKeyArn) + } + case KMSConfiguration_kmsMRKeyArn: + { + data2, ok := other.Get_().(KMSConfiguration_kmsMRKeyArn) + return ok && data1.KmsMRKeyArn.Equals(data2.KmsMRKeyArn) + } + case KMSConfiguration_discovery: + { + data2, ok := other.Get_().(KMSConfiguration_discovery) + return ok && data1.Discovery.Equals(data2.Discovery) + } + case KMSConfiguration_mrDiscovery: + { + data2, ok := other.Get_().(KMSConfiguration_mrDiscovery) + return ok && data1.MrDiscovery.Equals(data2.MrDiscovery) + } + default: + { + return false // unexpected + } + } +} + +func (_this KMSConfiguration) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KMSConfiguration) + return ok && _this.Equals(typed) +} + +func Type_KMSConfiguration_() _dafny.TypeDescriptor { + return type_KMSConfiguration_{} +} + +type type_KMSConfiguration_ struct { +} + +func (_this type_KMSConfiguration_) Default() interface{} { + return Companion_KMSConfiguration_.Default() +} + +func (_this type_KMSConfiguration_) String() string { + return "AwsCryptographyKeyStoreTypes.KMSConfiguration" +} +func (_this KMSConfiguration) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KMSConfiguration{} + +// End of datatype KMSConfiguration + +// Definition of datatype MRDiscovery +type MRDiscovery struct { + Data_MRDiscovery_ +} + +func (_this MRDiscovery) Get_() Data_MRDiscovery_ { + return _this.Data_MRDiscovery_ +} + +type Data_MRDiscovery_ interface { + isMRDiscovery() +} + +type CompanionStruct_MRDiscovery_ struct { +} + +var Companion_MRDiscovery_ = CompanionStruct_MRDiscovery_{} + +type MRDiscovery_MRDiscovery struct { + Region _dafny.Sequence +} + +func (MRDiscovery_MRDiscovery) isMRDiscovery() {} + +func (CompanionStruct_MRDiscovery_) Create_MRDiscovery_(Region _dafny.Sequence) MRDiscovery { + return MRDiscovery{MRDiscovery_MRDiscovery{Region}} +} + +func (_this MRDiscovery) Is_MRDiscovery() bool { + _, ok := _this.Get_().(MRDiscovery_MRDiscovery) + return ok +} + +func (CompanionStruct_MRDiscovery_) Default() MRDiscovery { + return Companion_MRDiscovery_.Create_MRDiscovery_(_dafny.EmptySeq.SetString()) +} + +func (_this MRDiscovery) Dtor_region() _dafny.Sequence { + return _this.Get_().(MRDiscovery_MRDiscovery).Region +} + +func (_this MRDiscovery) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case MRDiscovery_MRDiscovery: + { + return "AwsCryptographyKeyStoreTypes.MRDiscovery.MRDiscovery" + "(" + _dafny.String(data.Region) + ")" + } + default: + { + return "" + } + } +} + +func (_this MRDiscovery) Equals(other MRDiscovery) bool { + switch data1 := _this.Get_().(type) { + case MRDiscovery_MRDiscovery: + { + data2, ok := other.Get_().(MRDiscovery_MRDiscovery) + return ok && data1.Region.Equals(data2.Region) + } + default: + { + return false // unexpected + } + } +} + +func (_this MRDiscovery) EqualsGeneric(other interface{}) bool { + typed, ok := other.(MRDiscovery) + return ok && _this.Equals(typed) +} + +func Type_MRDiscovery_() _dafny.TypeDescriptor { + return type_MRDiscovery_{} +} + +type type_MRDiscovery_ struct { +} + +func (_this type_MRDiscovery_) Default() interface{} { + return Companion_MRDiscovery_.Default() +} + +func (_this type_MRDiscovery_) String() string { + return "AwsCryptographyKeyStoreTypes.MRDiscovery" +} +func (_this MRDiscovery) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = MRDiscovery{} + +// End of datatype MRDiscovery + +// Definition of datatype VersionKeyInput +type VersionKeyInput struct { + Data_VersionKeyInput_ +} + +func (_this VersionKeyInput) Get_() Data_VersionKeyInput_ { + return _this.Data_VersionKeyInput_ +} + +type Data_VersionKeyInput_ interface { + isVersionKeyInput() +} + +type CompanionStruct_VersionKeyInput_ struct { +} + +var Companion_VersionKeyInput_ = CompanionStruct_VersionKeyInput_{} + +type VersionKeyInput_VersionKeyInput struct { + BranchKeyIdentifier _dafny.Sequence +} + +func (VersionKeyInput_VersionKeyInput) isVersionKeyInput() {} + +func (CompanionStruct_VersionKeyInput_) Create_VersionKeyInput_(BranchKeyIdentifier _dafny.Sequence) VersionKeyInput { + return VersionKeyInput{VersionKeyInput_VersionKeyInput{BranchKeyIdentifier}} +} + +func (_this VersionKeyInput) Is_VersionKeyInput() bool { + _, ok := _this.Get_().(VersionKeyInput_VersionKeyInput) + return ok +} + +func (CompanionStruct_VersionKeyInput_) Default() VersionKeyInput { + return Companion_VersionKeyInput_.Create_VersionKeyInput_(_dafny.EmptySeq.SetString()) +} + +func (_this VersionKeyInput) Dtor_branchKeyIdentifier() _dafny.Sequence { + return _this.Get_().(VersionKeyInput_VersionKeyInput).BranchKeyIdentifier +} + +func (_this VersionKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case VersionKeyInput_VersionKeyInput: + { + return "AwsCryptographyKeyStoreTypes.VersionKeyInput.VersionKeyInput" + "(" + _dafny.String(data.BranchKeyIdentifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this VersionKeyInput) Equals(other VersionKeyInput) bool { + switch data1 := _this.Get_().(type) { + case VersionKeyInput_VersionKeyInput: + { + data2, ok := other.Get_().(VersionKeyInput_VersionKeyInput) + return ok && data1.BranchKeyIdentifier.Equals(data2.BranchKeyIdentifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this VersionKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(VersionKeyInput) + return ok && _this.Equals(typed) +} + +func Type_VersionKeyInput_() _dafny.TypeDescriptor { + return type_VersionKeyInput_{} +} + +type type_VersionKeyInput_ struct { +} + +func (_this type_VersionKeyInput_) Default() interface{} { + return Companion_VersionKeyInput_.Default() +} + +func (_this type_VersionKeyInput_) String() string { + return "AwsCryptographyKeyStoreTypes.VersionKeyInput" +} +func (_this VersionKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = VersionKeyInput{} + +// End of datatype VersionKeyInput + +// Definition of datatype VersionKeyOutput +type VersionKeyOutput struct { + Data_VersionKeyOutput_ +} + +func (_this VersionKeyOutput) Get_() Data_VersionKeyOutput_ { + return _this.Data_VersionKeyOutput_ +} + +type Data_VersionKeyOutput_ interface { + isVersionKeyOutput() +} + +type CompanionStruct_VersionKeyOutput_ struct { +} + +var Companion_VersionKeyOutput_ = CompanionStruct_VersionKeyOutput_{} + +type VersionKeyOutput_VersionKeyOutput struct { +} + +func (VersionKeyOutput_VersionKeyOutput) isVersionKeyOutput() {} + +func (CompanionStruct_VersionKeyOutput_) Create_VersionKeyOutput_() VersionKeyOutput { + return VersionKeyOutput{VersionKeyOutput_VersionKeyOutput{}} +} + +func (_this VersionKeyOutput) Is_VersionKeyOutput() bool { + _, ok := _this.Get_().(VersionKeyOutput_VersionKeyOutput) + return ok +} + +func (CompanionStruct_VersionKeyOutput_) Default() VersionKeyOutput { + return Companion_VersionKeyOutput_.Create_VersionKeyOutput_() +} + +func (_ CompanionStruct_VersionKeyOutput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_VersionKeyOutput_.Create_VersionKeyOutput_(), true + default: + return VersionKeyOutput{}, false + } + } +} + +func (_this VersionKeyOutput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case VersionKeyOutput_VersionKeyOutput: + { + return "AwsCryptographyKeyStoreTypes.VersionKeyOutput.VersionKeyOutput" + } + default: + { + return "" + } + } +} + +func (_this VersionKeyOutput) Equals(other VersionKeyOutput) bool { + switch _this.Get_().(type) { + case VersionKeyOutput_VersionKeyOutput: + { + _, ok := other.Get_().(VersionKeyOutput_VersionKeyOutput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this VersionKeyOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(VersionKeyOutput) + return ok && _this.Equals(typed) +} + +func Type_VersionKeyOutput_() _dafny.TypeDescriptor { + return type_VersionKeyOutput_{} +} + +type type_VersionKeyOutput_ struct { +} + +func (_this type_VersionKeyOutput_) Default() interface{} { + return Companion_VersionKeyOutput_.Default() +} + +func (_this type_VersionKeyOutput_) String() string { + return "AwsCryptographyKeyStoreTypes.VersionKeyOutput" +} +func (_this VersionKeyOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = VersionKeyOutput{} + +// End of datatype VersionKeyOutput + +// Definition of datatype Error +type Error struct { + Data_Error_ +} + +func (_this Error) Get_() Data_Error_ { + return _this.Data_Error_ +} + +type Data_Error_ interface { + isError() +} + +type CompanionStruct_Error_ struct { +} + +var Companion_Error_ = CompanionStruct_Error_{} + +type Error_KeyStoreException struct { + Message _dafny.Sequence +} + +func (Error_KeyStoreException) isError() {} + +func (CompanionStruct_Error_) Create_KeyStoreException_(Message _dafny.Sequence) Error { + return Error{Error_KeyStoreException{Message}} +} + +func (_this Error) Is_KeyStoreException() bool { + _, ok := _this.Get_().(Error_KeyStoreException) + return ok +} + +type Error_ComAmazonawsDynamodb struct { + ComAmazonawsDynamodb m_ComAmazonawsDynamodbTypes.Error +} + +func (Error_ComAmazonawsDynamodb) isError() {} + +func (CompanionStruct_Error_) Create_ComAmazonawsDynamodb_(ComAmazonawsDynamodb m_ComAmazonawsDynamodbTypes.Error) Error { + return Error{Error_ComAmazonawsDynamodb{ComAmazonawsDynamodb}} +} + +func (_this Error) Is_ComAmazonawsDynamodb() bool { + _, ok := _this.Get_().(Error_ComAmazonawsDynamodb) + return ok +} + +type Error_ComAmazonawsKms struct { + ComAmazonawsKms m_ComAmazonawsKmsTypes.Error +} + +func (Error_ComAmazonawsKms) isError() {} + +func (CompanionStruct_Error_) Create_ComAmazonawsKms_(ComAmazonawsKms m_ComAmazonawsKmsTypes.Error) Error { + return Error{Error_ComAmazonawsKms{ComAmazonawsKms}} +} + +func (_this Error) Is_ComAmazonawsKms() bool { + _, ok := _this.Get_().(Error_ComAmazonawsKms) + return ok +} + +type Error_CollectionOfErrors struct { + List _dafny.Sequence + Message _dafny.Sequence +} + +func (Error_CollectionOfErrors) isError() {} + +func (CompanionStruct_Error_) Create_CollectionOfErrors_(List _dafny.Sequence, Message _dafny.Sequence) Error { + return Error{Error_CollectionOfErrors{List, Message}} +} + +func (_this Error) Is_CollectionOfErrors() bool { + _, ok := _this.Get_().(Error_CollectionOfErrors) + return ok +} + +type Error_Opaque struct { + Obj interface{} +} + +func (Error_Opaque) isError() {} + +func (CompanionStruct_Error_) Create_Opaque_(Obj interface{}) Error { + return Error{Error_Opaque{Obj}} +} + +func (_this Error) Is_Opaque() bool { + _, ok := _this.Get_().(Error_Opaque) + return ok +} + +type Error_OpaqueWithText struct { + Obj interface{} + ObjMessage _dafny.Sequence +} + +func (Error_OpaqueWithText) isError() {} + +func (CompanionStruct_Error_) Create_OpaqueWithText_(Obj interface{}, ObjMessage _dafny.Sequence) Error { + return Error{Error_OpaqueWithText{Obj, ObjMessage}} +} + +func (_this Error) Is_OpaqueWithText() bool { + _, ok := _this.Get_().(Error_OpaqueWithText) + return ok +} + +func (CompanionStruct_Error_) Default() Error { + return Companion_Error_.Create_KeyStoreException_(_dafny.EmptySeq.SetString()) +} + +func (_this Error) Dtor_message() _dafny.Sequence { + switch data := _this.Get_().(type) { + case Error_KeyStoreException: + return data.Message + default: + return data.(Error_CollectionOfErrors).Message + } +} + +func (_this Error) Dtor_ComAmazonawsDynamodb() m_ComAmazonawsDynamodbTypes.Error { + return _this.Get_().(Error_ComAmazonawsDynamodb).ComAmazonawsDynamodb +} + +func (_this Error) Dtor_ComAmazonawsKms() m_ComAmazonawsKmsTypes.Error { + return _this.Get_().(Error_ComAmazonawsKms).ComAmazonawsKms +} + +func (_this Error) Dtor_list() _dafny.Sequence { + return _this.Get_().(Error_CollectionOfErrors).List +} + +func (_this Error) Dtor_obj() interface{} { + switch data := _this.Get_().(type) { + case Error_Opaque: + return data.Obj + default: + return data.(Error_OpaqueWithText).Obj + } +} + +func (_this Error) Dtor_objMessage() _dafny.Sequence { + return _this.Get_().(Error_OpaqueWithText).ObjMessage +} + +func (_this Error) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Error_KeyStoreException: + { + return "AwsCryptographyKeyStoreTypes.Error.KeyStoreException" + "(" + _dafny.String(data.Message) + ")" + } + case Error_ComAmazonawsDynamodb: + { + return "AwsCryptographyKeyStoreTypes.Error.ComAmazonawsDynamodb" + "(" + _dafny.String(data.ComAmazonawsDynamodb) + ")" + } + case Error_ComAmazonawsKms: + { + return "AwsCryptographyKeyStoreTypes.Error.ComAmazonawsKms" + "(" + _dafny.String(data.ComAmazonawsKms) + ")" + } + case Error_CollectionOfErrors: + { + return "AwsCryptographyKeyStoreTypes.Error.CollectionOfErrors" + "(" + _dafny.String(data.List) + ", " + _dafny.String(data.Message) + ")" + } + case Error_Opaque: + { + return "AwsCryptographyKeyStoreTypes.Error.Opaque" + "(" + _dafny.String(data.Obj) + ")" + } + case Error_OpaqueWithText: + { + return "AwsCryptographyKeyStoreTypes.Error.OpaqueWithText" + "(" + _dafny.String(data.Obj) + ", " + _dafny.String(data.ObjMessage) + ")" + } + default: + { + return "" + } + } +} + +func (_this Error) Equals(other Error) bool { + switch data1 := _this.Get_().(type) { + case Error_KeyStoreException: + { + data2, ok := other.Get_().(Error_KeyStoreException) + return ok && data1.Message.Equals(data2.Message) + } + case Error_ComAmazonawsDynamodb: + { + data2, ok := other.Get_().(Error_ComAmazonawsDynamodb) + return ok && data1.ComAmazonawsDynamodb.Equals(data2.ComAmazonawsDynamodb) + } + case Error_ComAmazonawsKms: + { + data2, ok := other.Get_().(Error_ComAmazonawsKms) + return ok && data1.ComAmazonawsKms.Equals(data2.ComAmazonawsKms) + } + case Error_CollectionOfErrors: + { + data2, ok := other.Get_().(Error_CollectionOfErrors) + return ok && data1.List.Equals(data2.List) && data1.Message.Equals(data2.Message) + } + case Error_Opaque: + { + data2, ok := other.Get_().(Error_Opaque) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) + } + case Error_OpaqueWithText: + { + data2, ok := other.Get_().(Error_OpaqueWithText) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) && data1.ObjMessage.Equals(data2.ObjMessage) + } + default: + { + return false // unexpected + } + } +} + +func (_this Error) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Error) + return ok && _this.Equals(typed) +} + +func Type_Error_() _dafny.TypeDescriptor { + return type_Error_{} +} + +type type_Error_ struct { +} + +func (_this type_Error_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_Error_) String() string { + return "AwsCryptographyKeyStoreTypes.Error" +} +func (_this Error) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Error{} + +// End of datatype Error + +// Definition of class OpaqueError +type OpaqueError struct { +} + +func New_OpaqueError_() *OpaqueError { + _this := OpaqueError{} + + return &_this +} + +type CompanionStruct_OpaqueError_ struct { +} + +var Companion_OpaqueError_ = CompanionStruct_OpaqueError_{} + +func (*OpaqueError) String() string { + return "AwsCryptographyKeyStoreTypes.OpaqueError" +} + +// End of class OpaqueError + +func Type_OpaqueError_() _dafny.TypeDescriptor { + return type_OpaqueError_{} +} + +type type_OpaqueError_ struct { +} + +func (_this type_OpaqueError_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_OpaqueError_) String() string { + return "AwsCryptographyKeyStoreTypes.OpaqueError" +} +func (_this *CompanionStruct_OpaqueError_) Is_(__source Error) bool { + var _0_e Error = (__source) + _ = _0_e + return ((_0_e).Is_Opaque()) || ((_0_e).Is_OpaqueWithText()) +} + +// Definition of class DummySubsetType +type DummySubsetType struct { +} + +func New_DummySubsetType_() *DummySubsetType { + _this := DummySubsetType{} + + return &_this +} + +type CompanionStruct_DummySubsetType_ struct { +} + +var Companion_DummySubsetType_ = CompanionStruct_DummySubsetType_{} + +func (*DummySubsetType) String() string { + return "AwsCryptographyKeyStoreTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Witness() _dafny.Int { + return _dafny.One +} + +// End of class DummySubsetType + +func Type_DummySubsetType_() _dafny.TypeDescriptor { + return type_DummySubsetType_{} +} + +type type_DummySubsetType_ struct { +} + +func (_this type_DummySubsetType_) Default() interface{} { + return Companion_DummySubsetType_.Witness() +} + +func (_this type_DummySubsetType_) String() string { + return "AwsCryptographyKeyStoreTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Is_(__source _dafny.Int) bool { + var _1_x _dafny.Int = (__source) + _ = _1_x + return Companion_Default___.IsDummySubsetType(_1_x) +} diff --git a/releases/go/mpl/AwsCryptographyMaterialProvidersOperations/AwsCryptographyMaterialProvidersOperations.go b/releases/go/mpl/AwsCryptographyMaterialProvidersOperations/AwsCryptographyMaterialProvidersOperations.go new file mode 100644 index 000000000..b9377eb7b --- /dev/null +++ b/releases/go/mpl/AwsCryptographyMaterialProvidersOperations/AwsCryptographyMaterialProvidersOperations.go @@ -0,0 +1,1786 @@ +// Package AwsCryptographyMaterialProvidersOperations +// Dafny module AwsCryptographyMaterialProvidersOperations compiled into Go + +package AwsCryptographyMaterialProvidersOperations + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DefaultCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultCMM" + m_DefaultClientSupplier "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultClientSupplier" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_RequiredEncryptionContextCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RequiredEncryptionContextCMM" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_Utils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Utils" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UUID "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UUID" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ +var _ m_DefaultCMM.Dummy__ +var _ m_DefaultClientSupplier.Dummy__ +var _ m_Utils.Dummy__ +var _ m_RequiredEncryptionContextCMM.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsCryptographyMaterialProvidersOperations.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) CreateAwsKmsKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((input).Dtor_kmsKeyId()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1___v0 _dafny.Tuple + _ = _1___v0 + _1___v0 = (_0_valueOrError0).Extract().(_dafny.Tuple) + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError1 + _2_valueOrError1 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_grantTokens _dafny.Sequence + _ = _3_grantTokens + _3_grantTokens = (_2_valueOrError1).Extract().(_dafny.Sequence) + var _4_keyring *m_AwsKmsKeyring.AwsKmsKeyring + _ = _4_keyring + var _nw0 *m_AwsKmsKeyring.AwsKmsKeyring = m_AwsKmsKeyring.New_AwsKmsKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_kmsClient(), (input).Dtor_kmsKeyId(), _3_grantTokens) + _4_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_4_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsDiscoveryKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + if ((input).Dtor_discoveryFilter()).Is_Some() { + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateDiscoveryFilter(((input).Dtor_discoveryFilter()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter)) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1___v1 _dafny.Tuple + _ = _1___v1 + _1___v1 = (_0_valueOrError0).Extract().(_dafny.Tuple) + } + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError1 + _2_valueOrError1 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_grantTokens _dafny.Sequence + _ = _3_grantTokens + _3_grantTokens = (_2_valueOrError1).Extract().(_dafny.Sequence) + var _4_keyring *m_AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring + _ = _4_keyring + var _nw0 *m_AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring = m_AwsKmsDiscoveryKeyring.New_AwsKmsDiscoveryKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_kmsClient(), (input).Dtor_discoveryFilter(), _3_grantTokens) + _4_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_4_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsMultiKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_grantTokens _dafny.Sequence + _ = _1_grantTokens + _1_grantTokens = (_0_valueOrError0).Extract().(_dafny.Sequence) + if ((input).Dtor_clientSupplier()).Is_Some() { + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_StrictMultiKeyring.Companion_Default___.StrictMultiKeyring((input).Dtor_generator(), (input).Dtor_kmsKeyIds(), m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_(((input).Dtor_clientSupplier()).Dtor_value()), m_Wrappers.Companion_Option_.Create_Some_(_1_grantTokens)) + output = _out0 + } else { + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _2_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.CreateDefaultClientSupplier(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_()) + _2_valueOrError1 = _out1 + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier + _ = _3_clientSupplier + _3_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_((_2_valueOrError1).Extract()) + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_StrictMultiKeyring.Companion_Default___.StrictMultiKeyring((input).Dtor_generator(), (input).Dtor_kmsKeyIds(), _3_clientSupplier, m_Wrappers.Companion_Option_.Create_Some_(_1_grantTokens)) + output = _out2 + } + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsDiscoveryMultiKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_grantTokens _dafny.Sequence + _ = _1_grantTokens + _1_grantTokens = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier = (m_AwsCryptographyMaterialProvidersTypes.IClientSupplier)(nil) + _ = _2_clientSupplier + if ((input).Dtor_clientSupplier()).Is_None() { + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.CreateDefaultClientSupplier(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_()) + _3_valueOrError1 = _out0 + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_((_3_valueOrError1).Extract()) + } else { + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_(((input).Dtor_clientSupplier()).Dtor_value()) + } + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_DiscoveryMultiKeyring.Companion_Default___.DiscoveryMultiKeyring((input).Dtor_regions(), (input).Dtor_discoveryFilter(), _2_clientSupplier, m_Wrappers.Companion_Option_.Create_Some_(_1_grantTokens)) + output = _out1 + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsMrkKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((input).Dtor_kmsKeyId()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1___v2 _dafny.Tuple + _ = _1___v2 + _1___v2 = (_0_valueOrError0).Extract().(_dafny.Tuple) + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError1 + _2_valueOrError1 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_grantTokens _dafny.Sequence + _ = _3_grantTokens + _3_grantTokens = (_2_valueOrError1).Extract().(_dafny.Sequence) + var _4_keyring *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring + _ = _4_keyring + var _nw0 *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring = m_AwsKmsMrkKeyring.New_AwsKmsMrkKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_kmsClient(), (input).Dtor_kmsKeyId(), _3_grantTokens) + _4_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_4_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsMrkMultiKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_grantTokens _dafny.Sequence + _ = _1_grantTokens + _1_grantTokens = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier = (m_AwsCryptographyMaterialProvidersTypes.IClientSupplier)(nil) + _ = _2_clientSupplier + if ((input).Dtor_clientSupplier()).Is_None() { + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.CreateDefaultClientSupplier(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_()) + _3_valueOrError1 = _out0 + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_((_3_valueOrError1).Extract()) + } else { + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_(((input).Dtor_clientSupplier()).Dtor_value()) + } + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_MrkAwareStrictMultiKeyring.Companion_Default___.MrkAwareStrictMultiKeyring((input).Dtor_generator(), (input).Dtor_kmsKeyIds(), _2_clientSupplier, m_Wrappers.Companion_Option_.Create_Some_(_1_grantTokens)) + output = _out1 + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsMrkDiscoveryKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + if ((input).Dtor_discoveryFilter()).Is_Some() { + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateDiscoveryFilter(((input).Dtor_discoveryFilter()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter)) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1___v3 _dafny.Tuple + _ = _1___v3 + _1___v3 = (_0_valueOrError0).Extract().(_dafny.Tuple) + } + var _2_regionMatch m_Wrappers.Option + _ = _2_regionMatch + _2_regionMatch = m_Com_Amazonaws_Kms.Companion_Default___.RegionMatch((input).Dtor_kmsClient(), (input).Dtor_region()) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(!(_2_regionMatch).Equals(m_Wrappers.Companion_Option_.Create_Some_(false)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Provided client and region do not match"))) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError2 + _4_valueOrError2 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_grantTokens _dafny.Sequence + _ = _5_grantTokens + _5_grantTokens = (_4_valueOrError2).Extract().(_dafny.Sequence) + var _6_keyring *m_AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring + _ = _6_keyring + var _nw0 *m_AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring = m_AwsKmsMrkDiscoveryKeyring.New_AwsKmsMrkDiscoveryKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_kmsClient(), (input).Dtor_region(), (input).Dtor_discoveryFilter(), _5_grantTokens) + _6_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_6_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsMrkDiscoveryMultiKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_grantTokens _dafny.Sequence + _ = _1_grantTokens + _1_grantTokens = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier = (m_AwsCryptographyMaterialProvidersTypes.IClientSupplier)(nil) + _ = _2_clientSupplier + if ((input).Dtor_clientSupplier()).Is_None() { + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.CreateDefaultClientSupplier(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_()) + _3_valueOrError1 = _out0 + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_((_3_valueOrError1).Extract()) + } else { + _2_clientSupplier = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.CastTo_(((input).Dtor_clientSupplier()).Dtor_value()) + } + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_MrkAwareDiscoveryMultiKeyring.Companion_Default___.MrkAwareDiscoveryMultiKeyring((input).Dtor_regions(), (input).Dtor_discoveryFilter(), _2_clientSupplier, m_Wrappers.Companion_Option_.Create_Some_(_1_grantTokens)) + output = _out1 + return output +} +func (_static *CompanionStruct_Default___) N(n int64) _dafny.Sequence { + return m_StandardLibrary_String.Companion_Default___.Base10Int2String(_dafny.IntOfInt64(n)) +} +func (_static *CompanionStruct_Default___) CheckCache(cache m_AwsCryptographyMaterialProvidersTypes.CacheType, ttlSeconds int64) m_Wrappers.Outcome { + var output m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = output + if (cache).Is_StormTracking() { + var _0_gracePeriod int64 + _ = _0_gracePeriod + if ((((cache).Dtor_StormTracking()).Dtor_timeUnits()).UnwrapOr(m_AwsCryptographyMaterialProvidersTypes.Companion_TimeUnits_.Create_Seconds_()).(m_AwsCryptographyMaterialProvidersTypes.TimeUnits)).Is_Seconds() { + _0_gracePeriod = int64(((cache).Dtor_StormTracking()).Dtor_gracePeriod()) + } else { + _0_gracePeriod = _dafny.DivInt64(int64(((cache).Dtor_StormTracking()).Dtor_gracePeriod()), int64(1000)) + } + var _1_storm m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache + _ = _1_storm + _1_storm = (cache).Dtor_StormTracking() + if (ttlSeconds) <= (_0_gracePeriod) { + var _2_msg _dafny.Sequence + _ = _2_msg + _2_msg = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("When creating an AwsKmsHierarchicalKeyring with a StormCache, "), _dafny.SeqOfString("the ttlSeconds of the KeyRing must be greater than the gracePeriod of the StormCache ")), _dafny.SeqOfString("yet the ttlSeconds is ")), Companion_Default___.N(ttlSeconds)), _dafny.SeqOfString(" and the gracePeriod is ")), Companion_Default___.N(_0_gracePeriod)), _dafny.SeqOfString(".")) + output = m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_2_msg)) + return output + } + output = m_Wrappers.Companion_Outcome_.Create_Pass_() + return output + } else { + output = m_Wrappers.Companion_Outcome_.Create_Pass_() + return output + } + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsHierarchicalKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_cmc m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache = (m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache)(nil) + _ = _0_cmc + if ((input).Dtor_cache()).Is_Some() { + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError0 + var _out0 m_Wrappers.Outcome + _ = _out0 + _out0 = Companion_Default___.CheckCache(((input).Dtor_cache()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.CacheType), (input).Dtor_ttlSeconds()) + _1_valueOrError0 = _out0 + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _source0 m_AwsCryptographyMaterialProvidersTypes.CacheType = ((input).Dtor_cache()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.CacheType) + _ = _source0 + { + { + if _source0.Is_Shared() { + var _2_c m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_Shared).Shared + _ = _2_c + _0_cmc = _2_c + goto Lmatch0 + } + } + { + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.CreateCryptographicMaterialsCache(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateCryptographicMaterialsCacheInput_.Create_CreateCryptographicMaterialsCacheInput_(((input).Dtor_cache()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.CacheType))) + _3_valueOrError1 = _out1 + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + _0_cmc = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.CastTo_((_3_valueOrError1).Extract()) + } + goto Lmatch0 + } + Lmatch0: + } else { + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError2 + var _out2 m_Wrappers.Outcome + _ = _out2 + _out2 = Companion_Default___.CheckCache(m_AwsCryptographyMaterialProvidersTypes.Companion_CacheType_.Create_StormTracking_(m_StormTracker.Companion_Default___.DefaultStorm()), (input).Dtor_ttlSeconds()) + _4_valueOrError2 = _out2 + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _5_valueOrError3 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = Companion_Default___.CreateCryptographicMaterialsCache(config, m_AwsCryptographyMaterialProvidersTypes.Companion_CreateCryptographicMaterialsCacheInput_.Create_CreateCryptographicMaterialsCacheInput_(m_AwsCryptographyMaterialProvidersTypes.Companion_CacheType_.Create_Default_(m_AwsCryptographyMaterialProvidersTypes.Companion_DefaultCache_.Create_DefaultCache_(int32(1000))))) + _5_valueOrError3 = _out3 + if (_5_valueOrError3).IsFailure() { + output = (_5_valueOrError3).PropagateFailure() + return output + } + _0_cmc = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.CastTo_((_5_valueOrError3).Extract()) + } + var _6_partitionIdBytes _dafny.Sequence = _dafny.EmptySeq + _ = _6_partitionIdBytes + if ((input).Dtor_partitionId()).Is_Some() { + var _7_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _7_valueOrError4 + _7_valueOrError4 = (m_UTF8.Encode(((input).Dtor_partitionId()).Dtor_value().(_dafny.Sequence))).MapFailure(func(coer132 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg133 interface{}) interface{} { + return coer132(arg133.(_dafny.Sequence)) + } + }(func(_8_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Could not UTF-8 Encode Partition ID: "), _8_e)) + })) + if (_7_valueOrError4).IsFailure() { + output = (_7_valueOrError4).PropagateFailure() + return output + } + _6_partitionIdBytes = (_7_valueOrError4).Extract().(_dafny.Sequence) + } else { + var _9_uuid_q m_Wrappers.Result + _ = _9_uuid_q + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_UUID.GenerateUUID() + _9_uuid_q = _out4 + var _10_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _10_valueOrError5 + _10_valueOrError5 = (_9_uuid_q).MapFailure(func(coer133 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg134 interface{}) interface{} { + return coer133(arg134.(_dafny.Sequence)) + } + }(func(_11_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_11_e) + })) + if (_10_valueOrError5).IsFailure() { + output = (_10_valueOrError5).PropagateFailure() + return output + } + var _12_uuid _dafny.Sequence + _ = _12_uuid + _12_uuid = (_10_valueOrError5).Extract().(_dafny.Sequence) + var _13_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _13_valueOrError6 + _13_valueOrError6 = (m_UUID.ToByteArray(_12_uuid)).MapFailure(func(coer134 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg135 interface{}) interface{} { + return coer134(arg135.(_dafny.Sequence)) + } + }(func(_14_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_14_e) + })) + if (_13_valueOrError6).IsFailure() { + output = (_13_valueOrError6).PropagateFailure() + return output + } + _6_partitionIdBytes = (_13_valueOrError6).Extract().(_dafny.Sequence) + } + var _15_getKeyStoreInfoOutput_q m_Wrappers.Result + _ = _15_getKeyStoreInfoOutput_q + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = ((input).Dtor_keyStore()).GetKeyStoreInfo() + _15_getKeyStoreInfoOutput_q = _out5 + var _16_valueOrError7 m_Wrappers.Result = m_Wrappers.Result{} + _ = _16_valueOrError7 + _16_valueOrError7 = (_15_getKeyStoreInfoOutput_q).MapFailure(func(coer135 func(m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg136 interface{}) interface{} { + return coer135(arg136.(m_AwsCryptographyKeyStoreTypes.Error)) + } + }(func(_17_e m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyKeyStore_(_17_e) + })) + if (_16_valueOrError7).IsFailure() { + output = (_16_valueOrError7).PropagateFailure() + return output + } + var _18_getKeyStoreInfoOutput m_AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput + _ = _18_getKeyStoreInfoOutput + _18_getKeyStoreInfoOutput = (_16_valueOrError7).Extract().(m_AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput) + var _19_logicalKeyStoreName _dafny.Sequence + _ = _19_logicalKeyStoreName + _19_logicalKeyStoreName = (_18_getKeyStoreInfoOutput).Dtor_logicalKeyStoreName() + var _20_valueOrError8 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _20_valueOrError8 + _20_valueOrError8 = (m_UTF8.Encode(_19_logicalKeyStoreName)).MapFailure(func(coer136 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg137 interface{}) interface{} { + return coer136(arg137.(_dafny.Sequence)) + } + }(func(_21_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Could not UTF-8 Encode Logical Key Store Name: "), _21_e)) + })) + if (_20_valueOrError8).IsFailure() { + output = (_20_valueOrError8).PropagateFailure() + return output + } + var _22_logicalKeyStoreNameBytes _dafny.Sequence + _ = _22_logicalKeyStoreNameBytes + _22_logicalKeyStoreNameBytes = (_20_valueOrError8).Extract().(_dafny.Sequence) + var _23_valueOrError9 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _23_valueOrError9 + _23_valueOrError9 = m_Wrappers.Companion_Default___.Need((((input).Dtor_branchKeyId()).Is_None()) || (((input).Dtor_branchKeyIdSupplier()).Is_None()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Cannot initialize keyring with both a branchKeyId and BranchKeyIdSupplier."))) + if (_23_valueOrError9).IsFailure() { + output = (_23_valueOrError9).PropagateFailure() + return output + } + var _24_valueOrError10 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _24_valueOrError10 + _24_valueOrError10 = m_Wrappers.Companion_Default___.Need((((input).Dtor_branchKeyId()).Is_Some()) || (((input).Dtor_branchKeyIdSupplier()).Is_Some()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Must initialize keyring with either branchKeyId or BranchKeyIdSupplier."))) + if (_24_valueOrError10).IsFailure() { + output = (_24_valueOrError10).PropagateFailure() + return output + } + var _25_keyring *m_AwsKmsHierarchicalKeyring.AwsKmsHierarchicalKeyring + _ = _25_keyring + var _nw0 *m_AwsKmsHierarchicalKeyring.AwsKmsHierarchicalKeyring = m_AwsKmsHierarchicalKeyring.New_AwsKmsHierarchicalKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_keyStore(), (input).Dtor_branchKeyId(), (input).Dtor_branchKeyIdSupplier(), (input).Dtor_ttlSeconds(), _0_cmc, _6_partitionIdBytes, _22_logicalKeyStoreNameBytes, (config).Dtor_crypto()) + _25_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_25_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsEcdhKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_grantTokens _dafny.Sequence + _ = _1_grantTokens + _1_grantTokens = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_recipientPublicKey _dafny.Sequence = _dafny.EmptySeq + _ = _2_recipientPublicKey + var _3_senderPublicKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _3_senderPublicKey + var _4_compressedSenderPublicKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _4_compressedSenderPublicKey + var _source0 m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations = (input).Dtor_KeyAgreementScheme() + _ = _source0 + { + { + if _source0.Is_KmsPublicKeyDiscovery() { + var _5_kmsPublicKeyDiscovery m_AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery).KmsPublicKeyDiscovery + _ = _5_kmsPublicKeyDiscovery + { + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _6_valueOrError1 + _6_valueOrError1 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((_5_kmsPublicKeyDiscovery).Dtor_recipientKmsIdentifier()) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7___v5 _dafny.Tuple + _ = _7___v5 + _7___v5 = (_6_valueOrError1).Extract().(_dafny.Tuple) + var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _8_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsKmsUtils.Companion_Default___.GetEcdhPublicKey((input).Dtor_kmsClient(), (_5_kmsPublicKeyDiscovery).Dtor_recipientKmsIdentifier()) + _8_valueOrError2 = _out0 + if (_8_valueOrError2).IsFailure() { + output = (_8_valueOrError2).PropagateFailure() + return output + } + _2_recipientPublicKey = (_8_valueOrError2).Extract().(_dafny.Sequence) + _3_senderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + _4_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + } + goto Lmatch0 + } + } + { + var _9_kmsPrivateKeyToStaticPublicKey m_AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey).KmsPrivateKeyToStaticPublicKey + _ = _9_kmsPrivateKeyToStaticPublicKey + { + if ((_9_kmsPrivateKeyToStaticPublicKey).Dtor_senderPublicKey()).Is_Some() { + var _10_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _10_valueOrError3 + _10_valueOrError3 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PublicKeyType(((_9_kmsPrivateKeyToStaticPublicKey).Dtor_senderPublicKey()).Dtor_value().(_dafny.Sequence)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid SenderPublicKey length."))) + if (_10_valueOrError3).IsFailure() { + output = (_10_valueOrError3).PropagateFailure() + return output + } + _3_senderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(((_9_kmsPrivateKeyToStaticPublicKey).Dtor_senderPublicKey()).Dtor_value().(_dafny.Sequence)) + var _11_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _11_valueOrError4 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_RawECDHKeyring.Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_((_3_senderPublicKey).Dtor_value().(_dafny.Sequence)), (input).Dtor_curveSpec(), (config).Dtor_crypto()) + _11_valueOrError4 = _out1 + if (_11_valueOrError4).IsFailure() { + output = (_11_valueOrError4).PropagateFailure() + return output + } + var _12_compressedPKU _dafny.Sequence + _ = _12_compressedPKU + _12_compressedPKU = (_11_valueOrError4).Extract().(_dafny.Sequence) + _4_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(_12_compressedPKU) + } else { + var _13_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _13_valueOrError5 + _13_valueOrError5 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((_9_kmsPrivateKeyToStaticPublicKey).Dtor_senderKmsIdentifier()) + if (_13_valueOrError5).IsFailure() { + output = (_13_valueOrError5).PropagateFailure() + return output + } + var _14___v6 _dafny.Tuple + _ = _14___v6 + _14___v6 = (_13_valueOrError5).Extract().(_dafny.Tuple) + var _15_valueOrError6 m_Wrappers.Result = m_Wrappers.Result{} + _ = _15_valueOrError6 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AwsKmsUtils.Companion_Default___.GetEcdhPublicKey((input).Dtor_kmsClient(), (_9_kmsPrivateKeyToStaticPublicKey).Dtor_senderKmsIdentifier()) + _15_valueOrError6 = _out2 + if (_15_valueOrError6).IsFailure() { + output = (_15_valueOrError6).PropagateFailure() + return output + } + var _16_senderPublicKeyResponse _dafny.Sequence + _ = _16_senderPublicKeyResponse + _16_senderPublicKeyResponse = (_15_valueOrError6).Extract().(_dafny.Sequence) + var _17_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _17_valueOrError7 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_RawECDHKeyring.Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_16_senderPublicKeyResponse), (input).Dtor_curveSpec(), (config).Dtor_crypto()) + _17_valueOrError7 = _out3 + if (_17_valueOrError7).IsFailure() { + output = (_17_valueOrError7).PropagateFailure() + return output + } + var _18_compressedPKU _dafny.Sequence + _ = _18_compressedPKU + _18_compressedPKU = (_17_valueOrError7).Extract().(_dafny.Sequence) + _3_senderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(_16_senderPublicKeyResponse) + _4_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(_18_compressedPKU) + } + var _19_valueOrError8 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _19_valueOrError8 + _19_valueOrError8 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PublicKeyType((_9_kmsPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid RecipientPublicKey length."))) + if (_19_valueOrError8).IsFailure() { + output = (_19_valueOrError8).PropagateFailure() + return output + } + _2_recipientPublicKey = (_9_kmsPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey() + } + } + goto Lmatch0 + } +Lmatch0: + var _20_valueOrError9 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _20_valueOrError9 + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((config).Dtor_crypto(), (input).Dtor_curveSpec(), _2_recipientPublicKey) + _20_valueOrError9 = _out4 + if (_20_valueOrError9).IsFailure() { + output = (_20_valueOrError9).PropagateFailure() + return output + } + var _21___v7 bool + _ = _21___v7 + _21___v7 = (_20_valueOrError9).Extract().(bool) + var _22_valueOrError10 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _22_valueOrError10 + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = m_RawECDHKeyring.Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_2_recipientPublicKey), (input).Dtor_curveSpec(), (config).Dtor_crypto()) + _22_valueOrError10 = _out5 + if (_22_valueOrError10).IsFailure() { + output = (_22_valueOrError10).PropagateFailure() + return output + } + var _23_compressedRecipientPublicKey _dafny.Sequence + _ = _23_compressedRecipientPublicKey + _23_compressedRecipientPublicKey = (_22_valueOrError10).Extract().(_dafny.Sequence) + var _24_senderKmsKeyId m_Wrappers.Option + _ = _24_senderKmsKeyId + if ((input).Dtor_KeyAgreementScheme()).Is_KmsPublicKeyDiscovery() { + _24_senderKmsKeyId = m_Wrappers.Companion_Option_.Create_None_() + } else { + _24_senderKmsKeyId = m_Wrappers.Companion_Option_.Create_Some_((((input).Dtor_KeyAgreementScheme()).Dtor_KmsPrivateKeyToStaticPublicKey()).Dtor_senderKmsIdentifier()) + } + if (_24_senderKmsKeyId).Is_Some() { + var _25_valueOrError11 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _25_valueOrError11 + _25_valueOrError11 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((_24_senderKmsKeyId).Dtor_value().(_dafny.Sequence)) + if (_25_valueOrError11).IsFailure() { + output = (_25_valueOrError11).PropagateFailure() + return output + } + var _26___v8 _dafny.Tuple + _ = _26___v8 + _26___v8 = (_25_valueOrError11).Extract().(_dafny.Tuple) + } + if (_3_senderPublicKey).Is_Some() { + var _27_valueOrError12 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _27_valueOrError12 + var _out6 m_Wrappers.Result + _ = _out6 + _out6 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((config).Dtor_crypto(), (input).Dtor_curveSpec(), (_3_senderPublicKey).Dtor_value().(_dafny.Sequence)) + _27_valueOrError12 = _out6 + if (_27_valueOrError12).IsFailure() { + output = (_27_valueOrError12).PropagateFailure() + return output + } + var _28___v9 bool + _ = _28___v9 + _28___v9 = (_27_valueOrError12).Extract().(bool) + } + var _29_keyring *m_AwsKmsEcdhKeyring.AwsKmsEcdhKeyring + _ = _29_keyring + var _nw0 *m_AwsKmsEcdhKeyring.AwsKmsEcdhKeyring = m_AwsKmsEcdhKeyring.New_AwsKmsEcdhKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_KeyAgreementScheme(), (input).Dtor_curveSpec(), (input).Dtor_kmsClient(), _1_grantTokens, _24_senderKmsKeyId, _3_senderPublicKey, _2_recipientPublicKey, _4_compressedSenderPublicKey, _23_compressedRecipientPublicKey, (config).Dtor_crypto()) + _29_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_29_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateMultiKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((input).Dtor_generator()).Is_Some()) || ((_dafny.IntOfUint32(((input).Dtor_childKeyrings()).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Must include a generator keyring and/or at least one child keyring"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_keyring *m_MultiKeyring.MultiKeyring + _ = _1_keyring + var _nw0 *m_MultiKeyring.MultiKeyring = m_MultiKeyring.New_MultiKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_generator(), (input).Dtor_childKeyrings()) + _1_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_1_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateRawAesKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(!_dafny.Companion_Sequence_.Equal((input).Dtor_keyNamespace(), _dafny.SeqOfString("aws-kms")), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("keyNamespace must not be `aws-kms`"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_wrappingAlg m_AwsCryptographyPrimitivesTypes.AES__GCM + _ = _1_wrappingAlg + var _source0 m_AwsCryptographyMaterialProvidersTypes.AesWrappingAlg = (input).Dtor_wrappingAlg() + _ = _source0 + { + { + if _source0.Is_ALG__AES128__GCM__IV12__TAG16() { + _1_wrappingAlg = m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(int32(16), int32(16), int32(12)) + goto Lmatch0 + } + } + { + if _source0.Is_ALG__AES192__GCM__IV12__TAG16() { + _1_wrappingAlg = m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(int32(24), int32(16), int32(12)) + goto Lmatch0 + } + } + { + _1_wrappingAlg = m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(int32(32), int32(16), int32(12)) + } + goto Lmatch0 + } +Lmatch0: + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf(m_UTF8.Companion_ValidUTF8Bytes_.Witness(), m_UTF8.Companion_ValidUTF8Bytes_.Witness())) + _ = _2_valueOrError1 + _2_valueOrError1 = m_AwsKmsUtils.Companion_Default___.ParseKeyNamespaceAndName((input).Dtor_keyNamespace(), (input).Dtor_keyName()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_namespaceAndName _dafny.Tuple + _ = _3_namespaceAndName + _3_namespaceAndName = (_2_valueOrError1).Extract().(_dafny.Tuple) + var _let_tmp_rhs0 _dafny.Tuple = _3_namespaceAndName + _ = _let_tmp_rhs0 + var _4_namespace _dafny.Sequence = (*(_let_tmp_rhs0).IndexInt(0)).(_dafny.Sequence) + _ = _4_namespace + var _5_name _dafny.Sequence = (*(_let_tmp_rhs0).IndexInt(1)).(_dafny.Sequence) + _ = _5_name + var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError2 + _6_valueOrError2 = m_Wrappers.Companion_Default___.Need((((_dafny.IntOfUint32(((input).Dtor_wrappingKey()).Cardinality())).Cmp(_dafny.IntOfInt64(16)) == 0) || ((_dafny.IntOfUint32(((input).Dtor_wrappingKey()).Cardinality())).Cmp(_dafny.IntOfInt64(24)) == 0)) || ((_dafny.IntOfUint32(((input).Dtor_wrappingKey()).Cardinality())).Cmp(_dafny.IntOfInt64(32)) == 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid wrapping key length"))) + if (_6_valueOrError2).IsFailure() { + output = (_6_valueOrError2).PropagateFailure() + return output + } + var _7_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError3 + _7_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32(((input).Dtor_wrappingKey()).Cardinality())).Cmp(_dafny.IntOfInt32((_1_wrappingAlg).Dtor_keyLength())) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Wrapping key length does not match specified wrapping algorithm"))) + if (_7_valueOrError3).IsFailure() { + output = (_7_valueOrError3).PropagateFailure() + return output + } + var _8_keyring *m_RawAESKeyring.RawAESKeyring + _ = _8_keyring + var _nw0 *m_RawAESKeyring.RawAESKeyring = m_RawAESKeyring.New_RawAESKeyring_() + _ = _nw0 + _nw0.Ctor__(_4_namespace, _5_name, (input).Dtor_wrappingKey(), _1_wrappingAlg, (config).Dtor_crypto()) + _8_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_8_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateRawRsaKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(!_dafny.Companion_Sequence_.Equal((input).Dtor_keyNamespace(), _dafny.SeqOfString("aws-kms")), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("keyNamespace must not be `aws-kms`"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need((((input).Dtor_publicKey()).Is_Some()) || (((input).Dtor_privateKey()).Is_Some()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A publicKey or a privateKey is required"))) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_padding m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _ = _2_padding + var _source0 m_AwsCryptographyMaterialProvidersTypes.PaddingScheme = (input).Dtor_paddingScheme() + _ = _source0 + { + { + if _source0.Is_PKCS1() { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_PKCS1_() + goto Lmatch0 + } + } + { + if _source0.Is_OAEP__SHA1__MGF1() { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA1_() + goto Lmatch0 + } + } + { + if _source0.Is_OAEP__SHA256__MGF1() { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA256_() + goto Lmatch0 + } + } + { + if _source0.Is_OAEP__SHA384__MGF1() { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA384_() + goto Lmatch0 + } + } + { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA512_() + } + goto Lmatch0 + } +Lmatch0: + var _3_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf(m_UTF8.Companion_ValidUTF8Bytes_.Witness(), m_UTF8.Companion_ValidUTF8Bytes_.Witness())) + _ = _3_valueOrError2 + _3_valueOrError2 = m_AwsKmsUtils.Companion_Default___.ParseKeyNamespaceAndName((input).Dtor_keyNamespace(), (input).Dtor_keyName()) + if (_3_valueOrError2).IsFailure() { + output = (_3_valueOrError2).PropagateFailure() + return output + } + var _4_namespaceAndName _dafny.Tuple + _ = _4_namespaceAndName + _4_namespaceAndName = (_3_valueOrError2).Extract().(_dafny.Tuple) + var _let_tmp_rhs0 _dafny.Tuple = _4_namespaceAndName + _ = _let_tmp_rhs0 + var _5_namespace _dafny.Sequence = (*(_let_tmp_rhs0).IndexInt(0)).(_dafny.Sequence) + _ = _5_namespace + var _6_name _dafny.Sequence = (*(_let_tmp_rhs0).IndexInt(1)).(_dafny.Sequence) + _ = _6_name + var _7_keyring *m_RawRSAKeyring.RawRSAKeyring + _ = _7_keyring + var _nw0 *m_RawRSAKeyring.RawRSAKeyring = m_RawRSAKeyring.New_RawRSAKeyring_() + _ = _nw0 + _nw0.Ctor__(_5_namespace, _6_name, (input).Dtor_publicKey(), (input).Dtor_privateKey(), _2_padding, (config).Dtor_crypto()) + _7_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_7_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateRawEcdhKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_recipientPublicKey _dafny.Sequence = _dafny.EmptySeq + _ = _0_recipientPublicKey + var _1_senderPrivateKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _1_senderPrivateKey + var _2_senderPublicKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _2_senderPublicKey + var _3_compressedSenderPublicKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _3_compressedSenderPublicKey + var _source0 m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations = (input).Dtor_KeyAgreementScheme() + _ = _source0 + { + { + if _source0.Is_RawPrivateKeyToStaticPublicKey() { + var _4_rawPrivateKeyToStaticPublicKey m_AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey).RawPrivateKeyToStaticPublicKey + _ = _4_rawPrivateKeyToStaticPublicKey + { + _0_recipientPublicKey = (_4_rawPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey() + _1_senderPrivateKey = m_Wrappers.Companion_Option_.Create_Some_((_4_rawPrivateKeyToStaticPublicKey).Dtor_senderStaticPrivateKey()) + var _5_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Utils.Companion_Default___.GetPublicKey((input).Dtor_curveSpec(), m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Create_ECCPrivateKey_((_1_senderPrivateKey).Dtor_value().(_dafny.Sequence)), (config).Dtor_crypto()) + _5_valueOrError0 = _out0 + if (_5_valueOrError0).IsFailure() { + output = (_5_valueOrError0).PropagateFailure() + return output + } + var _6_reproducedPublicKey _dafny.Sequence + _ = _6_reproducedPublicKey + _6_reproducedPublicKey = (_5_valueOrError0).Extract().(_dafny.Sequence) + var _7_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _7_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((config).Dtor_crypto(), (input).Dtor_curveSpec(), _6_reproducedPublicKey) + _7_valueOrError1 = _out1 + if (_7_valueOrError1).IsFailure() { + output = (_7_valueOrError1).PropagateFailure() + return output + } + var _8___v10 bool + _ = _8___v10 + _8___v10 = (_7_valueOrError1).Extract().(bool) + _2_senderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(_6_reproducedPublicKey) + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _9_valueOrError2 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_RawECDHKeyring.Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_6_reproducedPublicKey), (input).Dtor_curveSpec(), (config).Dtor_crypto()) + _9_valueOrError2 = _out2 + if (_9_valueOrError2).IsFailure() { + output = (_9_valueOrError2).PropagateFailure() + return output + } + var _10_compressedSenderPublicKey_q _dafny.Sequence + _ = _10_compressedSenderPublicKey_q + _10_compressedSenderPublicKey_q = (_9_valueOrError2).Extract().(_dafny.Sequence) + _3_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_Some_(_10_compressedSenderPublicKey_q) + } + goto Lmatch0 + } + } + { + if _source0.Is_EphemeralPrivateKeyToStaticPublicKey() { + var _11_ephemeralPrivateKeyToStaticPublicKey m_AwsCryptographyMaterialProvidersTypes.EphemeralPrivateKeyToStaticPublicKeyInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey).EphemeralPrivateKeyToStaticPublicKey + _ = _11_ephemeralPrivateKeyToStaticPublicKey + { + _0_recipientPublicKey = (_11_ephemeralPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey() + _1_senderPrivateKey = m_Wrappers.Companion_Option_.Create_None_() + _2_senderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + _3_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + } + goto Lmatch0 + } + } + { + var _12_publicKeyDiscovery m_AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations_PublicKeyDiscovery).PublicKeyDiscovery + _ = _12_publicKeyDiscovery + { + var _13_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _13_valueOrError3 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_Utils.Companion_Default___.GetPublicKey((input).Dtor_curveSpec(), m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Create_ECCPrivateKey_((_12_publicKeyDiscovery).Dtor_recipientStaticPrivateKey()), (config).Dtor_crypto()) + _13_valueOrError3 = _out3 + if (_13_valueOrError3).IsFailure() { + output = (_13_valueOrError3).PropagateFailure() + return output + } + var _14_reproducedPublicKey _dafny.Sequence + _ = _14_reproducedPublicKey + _14_reproducedPublicKey = (_13_valueOrError3).Extract().(_dafny.Sequence) + _0_recipientPublicKey = _14_reproducedPublicKey + _1_senderPrivateKey = m_Wrappers.Companion_Option_.Create_None_() + _2_senderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + _3_compressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + } + } + goto Lmatch0 + } +Lmatch0: + var _15_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _15_valueOrError4 + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_RawECDHKeyring.Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_0_recipientPublicKey), (input).Dtor_curveSpec(), (config).Dtor_crypto()) + _15_valueOrError4 = _out4 + if (_15_valueOrError4).IsFailure() { + output = (_15_valueOrError4).PropagateFailure() + return output + } + var _16_compressedRecipientPublicKey _dafny.Sequence + _ = _16_compressedRecipientPublicKey + _16_compressedRecipientPublicKey = (_15_valueOrError4).Extract().(_dafny.Sequence) + var _17_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _17_valueOrError5 + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((config).Dtor_crypto(), (input).Dtor_curveSpec(), _0_recipientPublicKey) + _17_valueOrError5 = _out5 + if (_17_valueOrError5).IsFailure() { + output = (_17_valueOrError5).PropagateFailure() + return output + } + var _18___v11 bool + _ = _18___v11 + _18___v11 = (_17_valueOrError5).Extract().(bool) + if (_2_senderPublicKey).Is_Some() { + var _19_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _19_valueOrError6 + var _out6 m_Wrappers.Result + _ = _out6 + _out6 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((config).Dtor_crypto(), (input).Dtor_curveSpec(), (_2_senderPublicKey).Dtor_value().(_dafny.Sequence)) + _19_valueOrError6 = _out6 + if (_19_valueOrError6).IsFailure() { + output = (_19_valueOrError6).PropagateFailure() + return output + } + var _20___v12 bool + _ = _20___v12 + _20___v12 = (_19_valueOrError6).Extract().(bool) + var _21_valueOrError7 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _21_valueOrError7 + _21_valueOrError7 = m_Wrappers.Companion_Default___.Need(m_RawECDHKeyring.Companion_Default___.ValidPublicKeyLength((_2_senderPublicKey).Dtor_value().(_dafny.Sequence)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid sender public key length"))) + if (_21_valueOrError7).IsFailure() { + output = (_21_valueOrError7).PropagateFailure() + return output + } + } + var _22_valueOrError8 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _22_valueOrError8 + _22_valueOrError8 = m_Wrappers.Companion_Default___.Need(m_RawECDHKeyring.Companion_Default___.ValidPublicKeyLength(_0_recipientPublicKey), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid recipient public key length"))) + if (_22_valueOrError8).IsFailure() { + output = (_22_valueOrError8).PropagateFailure() + return output + } + var _23_keyring *m_RawECDHKeyring.RawEcdhKeyring + _ = _23_keyring + var _nw0 *m_RawECDHKeyring.RawEcdhKeyring = m_RawECDHKeyring.New_RawEcdhKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_KeyAgreementScheme(), (input).Dtor_curveSpec(), _1_senderPrivateKey, _2_senderPublicKey, _0_recipientPublicKey, _3_compressedSenderPublicKey, _16_compressedRecipientPublicKey, (config).Dtor_crypto()) + _23_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_23_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateAwsKmsRsaKeyring(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((input).Dtor_publicKey()).Is_Some()) || (((input).Dtor_kmsClient()).Is_Some()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A publicKey or a kmsClient is required"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need((((input).Dtor_encryptionAlgorithm()).Is_RSAES__OAEP__SHA__1()) || (((input).Dtor_encryptionAlgorithm()).Is_RSAES__OAEP__SHA__256()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unsupported EncryptionAlgorithmSpec"))) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError2 + _2_valueOrError2 = m_Wrappers.Companion_Default___.Need((m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType((input).Dtor_kmsKeyId())) && ((m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn((input).Dtor_kmsKeyId())).Is_Success()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Kms Key ID must be a KMS Key ARN"))) + if (_2_valueOrError2).IsFailure() { + output = (_2_valueOrError2).PropagateFailure() + return output + } + if ((input).Dtor_publicKey()).Is_Some() { + var _3_lengthOutputRes m_Wrappers.Result + _ = _3_lengthOutputRes + _3_lengthOutputRes = ((config).Dtor_crypto()).GetRSAKeyModulusLength(m_AwsCryptographyPrimitivesTypes.Companion_GetRSAKeyModulusLengthInput_.Create_GetRSAKeyModulusLengthInput_(((input).Dtor_publicKey()).Dtor_value().(_dafny.Sequence))) + var _4_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError3 + _4_valueOrError3 = (_3_lengthOutputRes).MapFailure(func(coer137 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg138 interface{}) interface{} { + return coer137(arg138.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e) + })) + if (_4_valueOrError3).IsFailure() { + output = (_4_valueOrError3).PropagateFailure() + return output + } + var _6_lengthOutput m_AwsCryptographyPrimitivesTypes.GetRSAKeyModulusLengthOutput + _ = _6_lengthOutput + _6_lengthOutput = (_4_valueOrError3).Extract().(m_AwsCryptographyPrimitivesTypes.GetRSAKeyModulusLengthOutput) + var _7_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError4 + _7_valueOrError4 = m_Wrappers.Companion_Default___.Need(((_6_lengthOutput).Dtor_length()) >= (m_AwsKmsRsaKeyring.Companion_Default___.MIN__KMS__RSA__KEY__LEN()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid public key length"))) + if (_7_valueOrError4).IsFailure() { + output = (_7_valueOrError4).PropagateFailure() + return output + } + } + var _8_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _8_valueOrError5 + _8_valueOrError5 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((input).Dtor_kmsKeyId()) + if (_8_valueOrError5).IsFailure() { + output = (_8_valueOrError5).PropagateFailure() + return output + } + var _9___v13 _dafny.Tuple + _ = _9___v13 + _9___v13 = (_8_valueOrError5).Extract().(_dafny.Tuple) + var _10_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _10_valueOrError6 + _10_valueOrError6 = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((input).Dtor_grantTokens()) + if (_10_valueOrError6).IsFailure() { + output = (_10_valueOrError6).PropagateFailure() + return output + } + var _11_grantTokens _dafny.Sequence + _ = _11_grantTokens + _11_grantTokens = (_10_valueOrError6).Extract().(_dafny.Sequence) + var _12_keyring *m_AwsKmsRsaKeyring.AwsKmsRsaKeyring + _ = _12_keyring + var _nw0 *m_AwsKmsRsaKeyring.AwsKmsRsaKeyring = m_AwsKmsRsaKeyring.New_AwsKmsRsaKeyring_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_publicKey(), (input).Dtor_kmsKeyId(), (input).Dtor_encryptionAlgorithm(), (input).Dtor_kmsClient(), (config).Dtor_crypto(), _11_grantTokens) + _12_keyring = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_12_keyring) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateDefaultCryptographicMaterialsManager(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_cmm *m_DefaultCMM.DefaultCMM + _ = _0_cmm + var _nw0 *m_DefaultCMM.DefaultCMM = m_DefaultCMM.New_DefaultCMM_() + _ = _nw0 + _nw0.OfKeyring((input).Dtor_keyring(), (config).Dtor_crypto()) + _0_cmm = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_0_cmm) + return output + return output +} +func (_static *CompanionStruct_Default___) CmpError(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} +func (_static *CompanionStruct_Default___) CreateRequiredEncryptionContextCMM(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((input).Dtor_underlyingCMM()).Is_Some()) && (((input).Dtor_keyring()).Is_None()), Companion_Default___.CmpError(_dafny.SeqOfString("CreateRequiredEncryptionContextCMM currently only supports cmm."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_keySet _dafny.Set + _ = _1_keySet + _1_keySet = func() _dafny.Set { + var _coll0 = _dafny.NewBuilder() + _ = _coll0 + for _iter10 := _dafny.Iterate(((input).Dtor_requiredEncryptionContextKeys()).Elements()); ; { + _compr_0, _ok10 := _iter10() + if !_ok10 { + break + } + var _2_k _dafny.Sequence + _2_k = interface{}(_compr_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_2_k) { + if _dafny.Companion_Sequence_.Contains((input).Dtor_requiredEncryptionContextKeys(), _2_k) { + _coll0.Add(_2_k) + } + } + } + return _coll0.ToSet() + }() + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(((_1_keySet).Cardinality()).Sign() == 1, Companion_Default___.CmpError(_dafny.SeqOfString("RequiredEncryptionContextCMM needs at least one requiredEncryptionContextKey."))) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_cmm *m_RequiredEncryptionContextCMM.RequiredEncryptionContextCMM + _ = _4_cmm + var _nw0 *m_RequiredEncryptionContextCMM.RequiredEncryptionContextCMM = m_RequiredEncryptionContextCMM.New_RequiredEncryptionContextCMM_() + _ = _nw0 + _nw0.Ctor__(m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.CastTo_(((input).Dtor_underlyingCMM()).Dtor_value()), _1_keySet) + _4_cmm = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_4_cmm) + return output + return output +} +func (_static *CompanionStruct_Default___) CreateCryptographicMaterialsCache(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _source0 m_AwsCryptographyMaterialProvidersTypes.CacheType = (input).Dtor_cache() + _ = _source0 + { + { + if _source0.Is_Default() { + var _0_c m_AwsCryptographyMaterialProvidersTypes.DefaultCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_Default).Default + _ = _0_c + var _1_cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache + _ = _1_cache + var _2_dt__update__tmp_h0 m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache = m_StormTracker.Companion_Default___.DefaultStorm() + _ = _2_dt__update__tmp_h0 + var _3_dt__update_hentryCapacity_h0 int32 = (_0_c).Dtor_entryCapacity() + _ = _3_dt__update_hentryCapacity_h0 + _1_cache = m_AwsCryptographyMaterialProvidersTypes.Companion_StormTrackingCache_.Create_StormTrackingCache_(_3_dt__update_hentryCapacity_h0, (_2_dt__update__tmp_h0).Dtor_entryPruningTailSize(), (_2_dt__update__tmp_h0).Dtor_gracePeriod(), (_2_dt__update__tmp_h0).Dtor_graceInterval(), (_2_dt__update__tmp_h0).Dtor_fanOut(), (_2_dt__update__tmp_h0).Dtor_inFlightTTL(), (_2_dt__update__tmp_h0).Dtor_sleepMilli(), (_2_dt__update__tmp_h0).Dtor_timeUnits()) + var _4_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError0 + _4_valueOrError0 = m_StormTracker.Companion_Default___.CheckSettings(_1_cache) + if (_4_valueOrError0).IsFailure() { + output = (_4_valueOrError0).PropagateFailure() + return output + } + var _5_cmc *m_StormTracker.StormTracker + _ = _5_cmc + var _nw0 *m_StormTracker.StormTracker = m_StormTracker.New_StormTracker_() + _ = _nw0 + _nw0.Ctor__(_1_cache) + _5_cmc = _nw0 + var _6_synCmc *m_StormTrackingCMC.StormTrackingCMC + _ = _6_synCmc + var _nw1 *m_StormTrackingCMC.StormTrackingCMC = m_StormTrackingCMC.New_StormTrackingCMC_(_5_cmc) + _ = _nw1 + _6_synCmc = _nw1 + output = m_Wrappers.Companion_Result_.Create_Success_(_6_synCmc) + return output + goto Lmatch0 + } + } + { + if _source0.Is_No() { + var _7_cmc *m_LocalCMC.LocalCMC + _ = _7_cmc + var _nw2 *m_LocalCMC.LocalCMC = m_LocalCMC.New_LocalCMC_() + _ = _nw2 + _nw2.Ctor__(_dafny.Zero, _dafny.One) + _7_cmc = _nw2 + output = m_Wrappers.Companion_Result_.Create_Success_(_7_cmc) + return output + goto Lmatch0 + } + } + { + if _source0.Is_SingleThreaded() { + var _8_c m_AwsCryptographyMaterialProvidersTypes.SingleThreadedCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_SingleThreaded).SingleThreaded + _ = _8_c + var _9_cmc *m_LocalCMC.LocalCMC + _ = _9_cmc + var _nw3 *m_LocalCMC.LocalCMC = m_LocalCMC.New_LocalCMC_() + _ = _nw3 + _nw3.Ctor__(_dafny.IntOfInt32((_8_c).Dtor_entryCapacity()), _dafny.IntOfInt32((Companion_Default___.OptionalCountingNumber((_8_c).Dtor_entryPruningTailSize())).UnwrapOr(int32(1)).(int32))) + _9_cmc = _nw3 + output = m_Wrappers.Companion_Result_.Create_Success_(_9_cmc) + return output + goto Lmatch0 + } + } + { + if _source0.Is_MultiThreaded() { + var _10_c m_AwsCryptographyMaterialProvidersTypes.MultiThreadedCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_MultiThreaded).MultiThreaded + _ = _10_c + var _11_cmc *m_LocalCMC.LocalCMC + _ = _11_cmc + var _nw4 *m_LocalCMC.LocalCMC = m_LocalCMC.New_LocalCMC_() + _ = _nw4 + _nw4.Ctor__(_dafny.IntOfInt32((_10_c).Dtor_entryCapacity()), _dafny.IntOfInt32((Companion_Default___.OptionalCountingNumber((_10_c).Dtor_entryPruningTailSize())).UnwrapOr(int32(1)).(int32))) + _11_cmc = _nw4 + var _12_synCmc *m_SynchronizedLocalCMC.SynchronizedLocalCMC + _ = _12_synCmc + var _nw5 *m_SynchronizedLocalCMC.SynchronizedLocalCMC = m_SynchronizedLocalCMC.New_SynchronizedLocalCMC_(_11_cmc) + _ = _nw5 + _12_synCmc = _nw5 + output = m_Wrappers.Companion_Result_.Create_Success_(_12_synCmc) + return output + goto Lmatch0 + } + } + { + if _source0.Is_StormTracking() { + var _13_c m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_StormTracking).StormTracking + _ = _13_c + var _14_cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache + _ = _14_cache + var _15_dt__update__tmp_h1 m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache = _13_c + _ = _15_dt__update__tmp_h1 + var _16_dt__update_hentryPruningTailSize_h0 m_Wrappers.Option = Companion_Default___.OptionalCountingNumber((_13_c).Dtor_entryPruningTailSize()) + _ = _16_dt__update_hentryPruningTailSize_h0 + _14_cache = m_AwsCryptographyMaterialProvidersTypes.Companion_StormTrackingCache_.Create_StormTrackingCache_((_15_dt__update__tmp_h1).Dtor_entryCapacity(), _16_dt__update_hentryPruningTailSize_h0, (_15_dt__update__tmp_h1).Dtor_gracePeriod(), (_15_dt__update__tmp_h1).Dtor_graceInterval(), (_15_dt__update__tmp_h1).Dtor_fanOut(), (_15_dt__update__tmp_h1).Dtor_inFlightTTL(), (_15_dt__update__tmp_h1).Dtor_sleepMilli(), (_15_dt__update__tmp_h1).Dtor_timeUnits()) + var _17_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _17_valueOrError1 + _17_valueOrError1 = m_StormTracker.Companion_Default___.CheckSettings(_14_cache) + if (_17_valueOrError1).IsFailure() { + output = (_17_valueOrError1).PropagateFailure() + return output + } + var _18_cmc *m_StormTracker.StormTracker + _ = _18_cmc + var _nw6 *m_StormTracker.StormTracker = m_StormTracker.New_StormTracker_() + _ = _nw6 + _nw6.Ctor__(_14_cache) + _18_cmc = _nw6 + var _19_synCmc *m_StormTrackingCMC.StormTrackingCMC + _ = _19_synCmc + var _nw7 *m_StormTrackingCMC.StormTrackingCMC = m_StormTrackingCMC.New_StormTrackingCMC_(_18_cmc) + _ = _nw7 + _19_synCmc = _nw7 + output = m_Wrappers.Companion_Result_.Create_Success_(_19_synCmc) + return output + goto Lmatch0 + } + } + { + var _20_c m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CacheType_Shared).Shared + _ = _20_c + var _21_exception m_AwsCryptographyMaterialProvidersTypes.Error + _ = _21_exception + _21_exception = m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("CreateCryptographicMaterialsCache should never be called with Shared CacheType.")) + output = m_Wrappers.Companion_Result_.Create_Failure_(_21_exception) + return output + } + goto Lmatch0 + } +Lmatch0: + return output +} +func (_static *CompanionStruct_Default___) OptionalCountingNumber(c m_Wrappers.Option) m_Wrappers.Option { + if ((c).Is_Some()) && (((c).Dtor_value().(int32)) <= (int32(0))) { + return m_Wrappers.Companion_Option_.Create_None_() + } else { + return c + } +} +func (_static *CompanionStruct_Default___) CreateDefaultClientSupplier(config Config, input m_AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_clientSupplier *m_DefaultClientSupplier.DefaultClientSupplier + _ = _0_clientSupplier + var _nw0 *m_DefaultClientSupplier.DefaultClientSupplier = m_DefaultClientSupplier.New_DefaultClientSupplier_() + _ = _nw0 + _nw0.Ctor__() + _0_clientSupplier = _nw0 + output = m_Wrappers.Companion_Result_.Create_Success_(_0_clientSupplier) + return output + return output +} +func (_static *CompanionStruct_Default___) InitializeEncryptionMaterials(config Config, input m_AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput) m_Wrappers.Result { + return m_Materials.Companion_Default___.InitializeEncryptionMaterials(input) +} +func (_static *CompanionStruct_Default___) InitializeDecryptionMaterials(config Config, input m_AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput) m_Wrappers.Result { + return m_Materials.Companion_Default___.InitializeDecryptionMaterials(input) +} +func (_static *CompanionStruct_Default___) ValidEncryptionMaterialsTransition(config Config, input m_AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterialsTransition((input).Dtor_start(), (input).Dtor_stop()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Invalid Encryption Materials Transition"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) ValidDecryptionMaterialsTransition(config Config, input m_AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsTransitionIsValid((input).Dtor_start(), (input).Dtor_stop()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("Invalid Decryption Materials Transition"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) EncryptionMaterialsHasPlaintextDataKey(config Config, input m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.EncryptionMaterialsHasPlaintextDataKey(input), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterials_(_dafny.SeqOfString("Invalid Encryption Materials"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) DecryptionMaterialsWithPlaintextDataKey(config Config, input m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithPlaintextDataKey(input), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterials_(_dafny.SeqOfString("Invalid Decryption Materials"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) GetAlgorithmSuiteInfo(config Config, input _dafny.Sequence) m_Wrappers.Result { + return m_AlgorithmSuites.Companion_Default___.GetAlgorithmSuiteInfo(input) +} +func (_static *CompanionStruct_Default___) ValidAlgorithmSuiteInfo(config Config, input m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_AlgorithmSuites.Companion_Default___.AlgorithmSuite_q(input), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfo_(_dafny.SeqOfString("Invalid AlgorithmSuiteInfo"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) ValidateCommitmentPolicyOnEncrypt(config Config, input m_AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Commitment.Companion_Default___.ValidateCommitmentPolicyOnEncrypt((input).Dtor_algorithm(), (input).Dtor_commitmentPolicy()) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} +func (_static *CompanionStruct_Default___) ValidateCommitmentPolicyOnDecrypt(config Config, input m_AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Commitment.Companion_Default___.ValidateCommitmentPolicyOnDecrypt((input).Dtor_algorithm(), (input).Dtor_commitmentPolicy()) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } +} + +// End of class Default__ + +// Definition of datatype Config +type Config struct { + Data_Config_ +} + +func (_this Config) Get_() Data_Config_ { + return _this.Data_Config_ +} + +type Data_Config_ interface { + isConfig() +} + +type CompanionStruct_Config_ struct { +} + +var Companion_Config_ = CompanionStruct_Config_{} + +type Config_Config struct { + Crypto *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func (Config_Config) isConfig() {} + +func (CompanionStruct_Config_) Create_Config_(Crypto *m_AtomicPrimitives.AtomicPrimitivesClient) Config { + return Config{Config_Config{Crypto}} +} + +func (_this Config) Is_Config() bool { + _, ok := _this.Get_().(Config_Config) + return ok +} + +func (CompanionStruct_Config_) Default() Config { + return Companion_Config_.Create_Config_((*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)) +} + +func (_this Config) Dtor_crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + return _this.Get_().(Config_Config).Crypto +} + +func (_this Config) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Config_Config: + { + return "AwsCryptographyMaterialProvidersOperations.Config.Config" + "(" + _dafny.String(data.Crypto) + ")" + } + default: + { + return "" + } + } +} + +func (_this Config) Equals(other Config) bool { + switch data1 := _this.Get_().(type) { + case Config_Config: + { + data2, ok := other.Get_().(Config_Config) + return ok && data1.Crypto == data2.Crypto + } + default: + { + return false // unexpected + } + } +} + +func (_this Config) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Config) + return ok && _this.Equals(typed) +} + +func Type_Config_() _dafny.TypeDescriptor { + return type_Config_{} +} + +type type_Config_ struct { +} + +func (_this type_Config_) Default() interface{} { + return Companion_Config_.Default() +} + +func (_this type_Config_) String() string { + return "AwsCryptographyMaterialProvidersOperations.Config" +} +func (_this Config) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Config{} + +// End of datatype Config diff --git a/releases/go/mpl/AwsCryptographyMaterialProvidersTypes/AwsCryptographyMaterialProvidersTypes.go b/releases/go/mpl/AwsCryptographyMaterialProvidersTypes/AwsCryptographyMaterialProvidersTypes.go new file mode 100644 index 000000000..1eb902d84 --- /dev/null +++ b/releases/go/mpl/AwsCryptographyMaterialProvidersTypes/AwsCryptographyMaterialProvidersTypes.go @@ -0,0 +1,11427 @@ +// Package AwsCryptographyMaterialProvidersTypes +// Dafny module AwsCryptographyMaterialProvidersTypes compiled into Go + +package AwsCryptographyMaterialProvidersTypes + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsCryptographyMaterialProvidersTypes.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) IsValid__CountingNumber(x int32) bool { + return (int32(1)) <= (x) +} +func (_static *CompanionStruct_Default___) IsValid__PositiveInteger(x int32) bool { + return (int32(0)) <= (x) +} +func (_static *CompanionStruct_Default___) IsValid__PositiveLong(x int64) bool { + return (int64(0)) <= (x) +} +func (_static *CompanionStruct_Default___) IsDummySubsetType(x _dafny.Int) bool { + return (x).Sign() == 1 +} + +// End of class Default__ + +// Definition of datatype DafnyCallEvent +type DafnyCallEvent struct { + Data_DafnyCallEvent_ +} + +func (_this DafnyCallEvent) Get_() Data_DafnyCallEvent_ { + return _this.Data_DafnyCallEvent_ +} + +type Data_DafnyCallEvent_ interface { + isDafnyCallEvent() +} + +type CompanionStruct_DafnyCallEvent_ struct { +} + +var Companion_DafnyCallEvent_ = CompanionStruct_DafnyCallEvent_{} + +type DafnyCallEvent_DafnyCallEvent struct { + Input interface{} + Output interface{} +} + +func (DafnyCallEvent_DafnyCallEvent) isDafnyCallEvent() {} + +func (CompanionStruct_DafnyCallEvent_) Create_DafnyCallEvent_(Input interface{}, Output interface{}) DafnyCallEvent { + return DafnyCallEvent{DafnyCallEvent_DafnyCallEvent{Input, Output}} +} + +func (_this DafnyCallEvent) Is_DafnyCallEvent() bool { + _, ok := _this.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok +} + +func (CompanionStruct_DafnyCallEvent_) Default(_default_I interface{}, _default_O interface{}) DafnyCallEvent { + return Companion_DafnyCallEvent_.Create_DafnyCallEvent_(_default_I, _default_O) +} + +func (_this DafnyCallEvent) Dtor_input() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Input +} + +func (_this DafnyCallEvent) Dtor_output() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Output +} + +func (_this DafnyCallEvent) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DafnyCallEvent_DafnyCallEvent: + { + return "AwsCryptographyMaterialProvidersTypes.DafnyCallEvent.DafnyCallEvent" + "(" + _dafny.String(data.Input) + ", " + _dafny.String(data.Output) + ")" + } + default: + { + return "" + } + } +} + +func (_this DafnyCallEvent) Equals(other DafnyCallEvent) bool { + switch data1 := _this.Get_().(type) { + case DafnyCallEvent_DafnyCallEvent: + { + data2, ok := other.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok && _dafny.AreEqual(data1.Input, data2.Input) && _dafny.AreEqual(data1.Output, data2.Output) + } + default: + { + return false // unexpected + } + } +} + +func (_this DafnyCallEvent) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DafnyCallEvent) + return ok && _this.Equals(typed) +} + +func Type_DafnyCallEvent_(Type_I_ _dafny.TypeDescriptor, Type_O_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_DafnyCallEvent_{Type_I_, Type_O_} +} + +type type_DafnyCallEvent_ struct { + Type_I_ _dafny.TypeDescriptor + Type_O_ _dafny.TypeDescriptor +} + +func (_this type_DafnyCallEvent_) Default() interface{} { + Type_I_ := _this.Type_I_ + _ = Type_I_ + Type_O_ := _this.Type_O_ + _ = Type_O_ + return Companion_DafnyCallEvent_.Default(Type_I_.Default(), Type_O_.Default()) +} + +func (_this type_DafnyCallEvent_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DafnyCallEvent" +} +func (_this DafnyCallEvent) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DafnyCallEvent{} + +// End of datatype DafnyCallEvent + +// Definition of datatype AesWrappingAlg +type AesWrappingAlg struct { + Data_AesWrappingAlg_ +} + +func (_this AesWrappingAlg) Get_() Data_AesWrappingAlg_ { + return _this.Data_AesWrappingAlg_ +} + +type Data_AesWrappingAlg_ interface { + isAesWrappingAlg() +} + +type CompanionStruct_AesWrappingAlg_ struct { +} + +var Companion_AesWrappingAlg_ = CompanionStruct_AesWrappingAlg_{} + +type AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16 struct { +} + +func (AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16) isAesWrappingAlg() {} + +func (CompanionStruct_AesWrappingAlg_) Create_ALG__AES128__GCM__IV12__TAG16_() AesWrappingAlg { + return AesWrappingAlg{AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16{}} +} + +func (_this AesWrappingAlg) Is_ALG__AES128__GCM__IV12__TAG16() bool { + _, ok := _this.Get_().(AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16) + return ok +} + +type AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16 struct { +} + +func (AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16) isAesWrappingAlg() {} + +func (CompanionStruct_AesWrappingAlg_) Create_ALG__AES192__GCM__IV12__TAG16_() AesWrappingAlg { + return AesWrappingAlg{AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16{}} +} + +func (_this AesWrappingAlg) Is_ALG__AES192__GCM__IV12__TAG16() bool { + _, ok := _this.Get_().(AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16) + return ok +} + +type AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16 struct { +} + +func (AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16) isAesWrappingAlg() {} + +func (CompanionStruct_AesWrappingAlg_) Create_ALG__AES256__GCM__IV12__TAG16_() AesWrappingAlg { + return AesWrappingAlg{AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16{}} +} + +func (_this AesWrappingAlg) Is_ALG__AES256__GCM__IV12__TAG16() bool { + _, ok := _this.Get_().(AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16) + return ok +} + +func (CompanionStruct_AesWrappingAlg_) Default() AesWrappingAlg { + return Companion_AesWrappingAlg_.Create_ALG__AES128__GCM__IV12__TAG16_() +} + +func (_ CompanionStruct_AesWrappingAlg_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_AesWrappingAlg_.Create_ALG__AES128__GCM__IV12__TAG16_(), true + case 1: + return Companion_AesWrappingAlg_.Create_ALG__AES192__GCM__IV12__TAG16_(), true + case 2: + return Companion_AesWrappingAlg_.Create_ALG__AES256__GCM__IV12__TAG16_(), true + default: + return AesWrappingAlg{}, false + } + } +} + +func (_this AesWrappingAlg) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16: + { + return "AwsCryptographyMaterialProvidersTypes.AesWrappingAlg.ALG_AES128_GCM_IV12_TAG16" + } + case AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16: + { + return "AwsCryptographyMaterialProvidersTypes.AesWrappingAlg.ALG_AES192_GCM_IV12_TAG16" + } + case AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16: + { + return "AwsCryptographyMaterialProvidersTypes.AesWrappingAlg.ALG_AES256_GCM_IV12_TAG16" + } + default: + { + return "" + } + } +} + +func (_this AesWrappingAlg) Equals(other AesWrappingAlg) bool { + switch _this.Get_().(type) { + case AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16: + { + _, ok := other.Get_().(AesWrappingAlg_ALG__AES128__GCM__IV12__TAG16) + return ok + } + case AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16: + { + _, ok := other.Get_().(AesWrappingAlg_ALG__AES192__GCM__IV12__TAG16) + return ok + } + case AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16: + { + _, ok := other.Get_().(AesWrappingAlg_ALG__AES256__GCM__IV12__TAG16) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this AesWrappingAlg) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AesWrappingAlg) + return ok && _this.Equals(typed) +} + +func Type_AesWrappingAlg_() _dafny.TypeDescriptor { + return type_AesWrappingAlg_{} +} + +type type_AesWrappingAlg_ struct { +} + +func (_this type_AesWrappingAlg_) Default() interface{} { + return Companion_AesWrappingAlg_.Default() +} + +func (_this type_AesWrappingAlg_) String() string { + return "AwsCryptographyMaterialProvidersTypes.AesWrappingAlg" +} +func (_this AesWrappingAlg) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AesWrappingAlg{} + +// End of datatype AesWrappingAlg + +// Definition of datatype AlgorithmSuiteId +type AlgorithmSuiteId struct { + Data_AlgorithmSuiteId_ +} + +func (_this AlgorithmSuiteId) Get_() Data_AlgorithmSuiteId_ { + return _this.Data_AlgorithmSuiteId_ +} + +type Data_AlgorithmSuiteId_ interface { + isAlgorithmSuiteId() +} + +type CompanionStruct_AlgorithmSuiteId_ struct { +} + +var Companion_AlgorithmSuiteId_ = CompanionStruct_AlgorithmSuiteId_{} + +type AlgorithmSuiteId_ESDK struct { + ESDK ESDKAlgorithmSuiteId +} + +func (AlgorithmSuiteId_ESDK) isAlgorithmSuiteId() {} + +func (CompanionStruct_AlgorithmSuiteId_) Create_ESDK_(ESDK ESDKAlgorithmSuiteId) AlgorithmSuiteId { + return AlgorithmSuiteId{AlgorithmSuiteId_ESDK{ESDK}} +} + +func (_this AlgorithmSuiteId) Is_ESDK() bool { + _, ok := _this.Get_().(AlgorithmSuiteId_ESDK) + return ok +} + +type AlgorithmSuiteId_DBE struct { + DBE DBEAlgorithmSuiteId +} + +func (AlgorithmSuiteId_DBE) isAlgorithmSuiteId() {} + +func (CompanionStruct_AlgorithmSuiteId_) Create_DBE_(DBE DBEAlgorithmSuiteId) AlgorithmSuiteId { + return AlgorithmSuiteId{AlgorithmSuiteId_DBE{DBE}} +} + +func (_this AlgorithmSuiteId) Is_DBE() bool { + _, ok := _this.Get_().(AlgorithmSuiteId_DBE) + return ok +} + +func (CompanionStruct_AlgorithmSuiteId_) Default() AlgorithmSuiteId { + return Companion_AlgorithmSuiteId_.Create_ESDK_(Companion_ESDKAlgorithmSuiteId_.Default()) +} + +func (_this AlgorithmSuiteId) Dtor_ESDK() ESDKAlgorithmSuiteId { + return _this.Get_().(AlgorithmSuiteId_ESDK).ESDK +} + +func (_this AlgorithmSuiteId) Dtor_DBE() DBEAlgorithmSuiteId { + return _this.Get_().(AlgorithmSuiteId_DBE).DBE +} + +func (_this AlgorithmSuiteId) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AlgorithmSuiteId_ESDK: + { + return "AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId.ESDK" + "(" + _dafny.String(data.ESDK) + ")" + } + case AlgorithmSuiteId_DBE: + { + return "AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId.DBE" + "(" + _dafny.String(data.DBE) + ")" + } + default: + { + return "" + } + } +} + +func (_this AlgorithmSuiteId) Equals(other AlgorithmSuiteId) bool { + switch data1 := _this.Get_().(type) { + case AlgorithmSuiteId_ESDK: + { + data2, ok := other.Get_().(AlgorithmSuiteId_ESDK) + return ok && data1.ESDK.Equals(data2.ESDK) + } + case AlgorithmSuiteId_DBE: + { + data2, ok := other.Get_().(AlgorithmSuiteId_DBE) + return ok && data1.DBE.Equals(data2.DBE) + } + default: + { + return false // unexpected + } + } +} + +func (_this AlgorithmSuiteId) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AlgorithmSuiteId) + return ok && _this.Equals(typed) +} + +func Type_AlgorithmSuiteId_() _dafny.TypeDescriptor { + return type_AlgorithmSuiteId_{} +} + +type type_AlgorithmSuiteId_ struct { +} + +func (_this type_AlgorithmSuiteId_) Default() interface{} { + return Companion_AlgorithmSuiteId_.Default() +} + +func (_this type_AlgorithmSuiteId_) String() string { + return "AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId" +} +func (_this AlgorithmSuiteId) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AlgorithmSuiteId{} + +// End of datatype AlgorithmSuiteId + +// Definition of datatype AlgorithmSuiteInfo +type AlgorithmSuiteInfo struct { + Data_AlgorithmSuiteInfo_ +} + +func (_this AlgorithmSuiteInfo) Get_() Data_AlgorithmSuiteInfo_ { + return _this.Data_AlgorithmSuiteInfo_ +} + +type Data_AlgorithmSuiteInfo_ interface { + isAlgorithmSuiteInfo() +} + +type CompanionStruct_AlgorithmSuiteInfo_ struct { +} + +var Companion_AlgorithmSuiteInfo_ = CompanionStruct_AlgorithmSuiteInfo_{} + +type AlgorithmSuiteInfo_AlgorithmSuiteInfo struct { + Id AlgorithmSuiteId + BinaryId _dafny.Sequence + MessageVersion int32 + Encrypt Encrypt + Kdf DerivationAlgorithm + Commitment DerivationAlgorithm + Signature SignatureAlgorithm + SymmetricSignature SymmetricSignatureAlgorithm + EdkWrapping EdkWrappingAlgorithm +} + +func (AlgorithmSuiteInfo_AlgorithmSuiteInfo) isAlgorithmSuiteInfo() {} + +func (CompanionStruct_AlgorithmSuiteInfo_) Create_AlgorithmSuiteInfo_(Id AlgorithmSuiteId, BinaryId _dafny.Sequence, MessageVersion int32, Encrypt Encrypt, Kdf DerivationAlgorithm, Commitment DerivationAlgorithm, Signature SignatureAlgorithm, SymmetricSignature SymmetricSignatureAlgorithm, EdkWrapping EdkWrappingAlgorithm) AlgorithmSuiteInfo { + return AlgorithmSuiteInfo{AlgorithmSuiteInfo_AlgorithmSuiteInfo{Id, BinaryId, MessageVersion, Encrypt, Kdf, Commitment, Signature, SymmetricSignature, EdkWrapping}} +} + +func (_this AlgorithmSuiteInfo) Is_AlgorithmSuiteInfo() bool { + _, ok := _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo) + return ok +} + +func (CompanionStruct_AlgorithmSuiteInfo_) Default() AlgorithmSuiteInfo { + return Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(Companion_AlgorithmSuiteId_.Default(), _dafny.EmptySeq, int32(0), Companion_Encrypt_.Default(), Companion_DerivationAlgorithm_.Default(), Companion_DerivationAlgorithm_.Default(), Companion_SignatureAlgorithm_.Default(), Companion_SymmetricSignatureAlgorithm_.Default(), Companion_EdkWrappingAlgorithm_.Default()) +} + +func (_this AlgorithmSuiteInfo) Dtor_id() AlgorithmSuiteId { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).Id +} + +func (_this AlgorithmSuiteInfo) Dtor_binaryId() _dafny.Sequence { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).BinaryId +} + +func (_this AlgorithmSuiteInfo) Dtor_messageVersion() int32 { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).MessageVersion +} + +func (_this AlgorithmSuiteInfo) Dtor_encrypt() Encrypt { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).Encrypt +} + +func (_this AlgorithmSuiteInfo) Dtor_kdf() DerivationAlgorithm { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).Kdf +} + +func (_this AlgorithmSuiteInfo) Dtor_commitment() DerivationAlgorithm { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).Commitment +} + +func (_this AlgorithmSuiteInfo) Dtor_signature() SignatureAlgorithm { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).Signature +} + +func (_this AlgorithmSuiteInfo) Dtor_symmetricSignature() SymmetricSignatureAlgorithm { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).SymmetricSignature +} + +func (_this AlgorithmSuiteInfo) Dtor_edkWrapping() EdkWrappingAlgorithm { + return _this.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo).EdkWrapping +} + +func (_this AlgorithmSuiteInfo) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AlgorithmSuiteInfo_AlgorithmSuiteInfo: + { + return "AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo.AlgorithmSuiteInfo" + "(" + _dafny.String(data.Id) + ", " + _dafny.String(data.BinaryId) + ", " + _dafny.String(data.MessageVersion) + ", " + _dafny.String(data.Encrypt) + ", " + _dafny.String(data.Kdf) + ", " + _dafny.String(data.Commitment) + ", " + _dafny.String(data.Signature) + ", " + _dafny.String(data.SymmetricSignature) + ", " + _dafny.String(data.EdkWrapping) + ")" + } + default: + { + return "" + } + } +} + +func (_this AlgorithmSuiteInfo) Equals(other AlgorithmSuiteInfo) bool { + switch data1 := _this.Get_().(type) { + case AlgorithmSuiteInfo_AlgorithmSuiteInfo: + { + data2, ok := other.Get_().(AlgorithmSuiteInfo_AlgorithmSuiteInfo) + return ok && data1.Id.Equals(data2.Id) && data1.BinaryId.Equals(data2.BinaryId) && data1.MessageVersion == data2.MessageVersion && data1.Encrypt.Equals(data2.Encrypt) && data1.Kdf.Equals(data2.Kdf) && data1.Commitment.Equals(data2.Commitment) && data1.Signature.Equals(data2.Signature) && data1.SymmetricSignature.Equals(data2.SymmetricSignature) && data1.EdkWrapping.Equals(data2.EdkWrapping) + } + default: + { + return false // unexpected + } + } +} + +func (_this AlgorithmSuiteInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AlgorithmSuiteInfo) + return ok && _this.Equals(typed) +} + +func Type_AlgorithmSuiteInfo_() _dafny.TypeDescriptor { + return type_AlgorithmSuiteInfo_{} +} + +type type_AlgorithmSuiteInfo_ struct { +} + +func (_this type_AlgorithmSuiteInfo_) Default() interface{} { + return Companion_AlgorithmSuiteInfo_.Default() +} + +func (_this type_AlgorithmSuiteInfo_) String() string { + return "AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo" +} +func (_this AlgorithmSuiteInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AlgorithmSuiteInfo{} + +// End of datatype AlgorithmSuiteInfo + +// Definition of class IAwsCryptographicMaterialProvidersClientCallHistory +type IAwsCryptographicMaterialProvidersClientCallHistory struct { + dummy byte +} + +func New_IAwsCryptographicMaterialProvidersClientCallHistory_() *IAwsCryptographicMaterialProvidersClientCallHistory { + _this := IAwsCryptographicMaterialProvidersClientCallHistory{} + + return &_this +} + +type CompanionStruct_IAwsCryptographicMaterialProvidersClientCallHistory_ struct { +} + +var Companion_IAwsCryptographicMaterialProvidersClientCallHistory_ = CompanionStruct_IAwsCryptographicMaterialProvidersClientCallHistory_{} + +func (_this *IAwsCryptographicMaterialProvidersClientCallHistory) Equals(other *IAwsCryptographicMaterialProvidersClientCallHistory) bool { + return _this == other +} + +func (_this *IAwsCryptographicMaterialProvidersClientCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IAwsCryptographicMaterialProvidersClientCallHistory) + return ok && _this.Equals(other) +} + +func (*IAwsCryptographicMaterialProvidersClientCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClientCallHistory" +} + +func Type_IAwsCryptographicMaterialProvidersClientCallHistory_() _dafny.TypeDescriptor { + return type_IAwsCryptographicMaterialProvidersClientCallHistory_{} +} + +type type_IAwsCryptographicMaterialProvidersClientCallHistory_ struct { +} + +func (_this type_IAwsCryptographicMaterialProvidersClientCallHistory_) Default() interface{} { + return (*IAwsCryptographicMaterialProvidersClientCallHistory)(nil) +} + +func (_this type_IAwsCryptographicMaterialProvidersClientCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClientCallHistory" +} +func (_this *IAwsCryptographicMaterialProvidersClientCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IAwsCryptographicMaterialProvidersClientCallHistory{} + +// End of class IAwsCryptographicMaterialProvidersClientCallHistory + +// Definition of trait IAwsCryptographicMaterialProvidersClient +type IAwsCryptographicMaterialProvidersClient interface { + String() string + CreateAwsKmsKeyring(input CreateAwsKmsKeyringInput) m_Wrappers.Result + CreateAwsKmsDiscoveryKeyring(input CreateAwsKmsDiscoveryKeyringInput) m_Wrappers.Result + CreateAwsKmsMultiKeyring(input CreateAwsKmsMultiKeyringInput) m_Wrappers.Result + CreateAwsKmsDiscoveryMultiKeyring(input CreateAwsKmsDiscoveryMultiKeyringInput) m_Wrappers.Result + CreateAwsKmsMrkKeyring(input CreateAwsKmsMrkKeyringInput) m_Wrappers.Result + CreateAwsKmsMrkMultiKeyring(input CreateAwsKmsMrkMultiKeyringInput) m_Wrappers.Result + CreateAwsKmsMrkDiscoveryKeyring(input CreateAwsKmsMrkDiscoveryKeyringInput) m_Wrappers.Result + CreateAwsKmsMrkDiscoveryMultiKeyring(input CreateAwsKmsMrkDiscoveryMultiKeyringInput) m_Wrappers.Result + CreateAwsKmsHierarchicalKeyring(input CreateAwsKmsHierarchicalKeyringInput) m_Wrappers.Result + CreateAwsKmsRsaKeyring(input CreateAwsKmsRsaKeyringInput) m_Wrappers.Result + CreateAwsKmsEcdhKeyring(input CreateAwsKmsEcdhKeyringInput) m_Wrappers.Result + CreateMultiKeyring(input CreateMultiKeyringInput) m_Wrappers.Result + CreateRawAesKeyring(input CreateRawAesKeyringInput) m_Wrappers.Result + CreateRawRsaKeyring(input CreateRawRsaKeyringInput) m_Wrappers.Result + CreateRawEcdhKeyring(input CreateRawEcdhKeyringInput) m_Wrappers.Result + CreateDefaultCryptographicMaterialsManager(input CreateDefaultCryptographicMaterialsManagerInput) m_Wrappers.Result + CreateRequiredEncryptionContextCMM(input CreateRequiredEncryptionContextCMMInput) m_Wrappers.Result + CreateCryptographicMaterialsCache(input CreateCryptographicMaterialsCacheInput) m_Wrappers.Result + CreateDefaultClientSupplier(input CreateDefaultClientSupplierInput) m_Wrappers.Result + InitializeEncryptionMaterials(input InitializeEncryptionMaterialsInput) m_Wrappers.Result + InitializeDecryptionMaterials(input InitializeDecryptionMaterialsInput) m_Wrappers.Result + ValidEncryptionMaterialsTransition(input ValidEncryptionMaterialsTransitionInput) m_Wrappers.Result + ValidDecryptionMaterialsTransition(input ValidDecryptionMaterialsTransitionInput) m_Wrappers.Result + EncryptionMaterialsHasPlaintextDataKey(input EncryptionMaterials) m_Wrappers.Result + DecryptionMaterialsWithPlaintextDataKey(input DecryptionMaterials) m_Wrappers.Result + GetAlgorithmSuiteInfo(input _dafny.Sequence) m_Wrappers.Result + ValidAlgorithmSuiteInfo(input AlgorithmSuiteInfo) m_Wrappers.Result + ValidateCommitmentPolicyOnEncrypt(input ValidateCommitmentPolicyOnEncryptInput) m_Wrappers.Result + ValidateCommitmentPolicyOnDecrypt(input ValidateCommitmentPolicyOnDecryptInput) m_Wrappers.Result +} +type CompanionStruct_IAwsCryptographicMaterialProvidersClient_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IAwsCryptographicMaterialProvidersClient_ = CompanionStruct_IAwsCryptographicMaterialProvidersClient_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IAwsCryptographicMaterialProvidersClient_) CastTo_(x interface{}) IAwsCryptographicMaterialProvidersClient { + var t IAwsCryptographicMaterialProvidersClient + t, _ = x.(IAwsCryptographicMaterialProvidersClient) + return t +} + +// End of trait IAwsCryptographicMaterialProvidersClient + +// Definition of class IBranchKeyIdSupplierCallHistory +type IBranchKeyIdSupplierCallHistory struct { + dummy byte +} + +func New_IBranchKeyIdSupplierCallHistory_() *IBranchKeyIdSupplierCallHistory { + _this := IBranchKeyIdSupplierCallHistory{} + + return &_this +} + +type CompanionStruct_IBranchKeyIdSupplierCallHistory_ struct { +} + +var Companion_IBranchKeyIdSupplierCallHistory_ = CompanionStruct_IBranchKeyIdSupplierCallHistory_{} + +func (_this *IBranchKeyIdSupplierCallHistory) Equals(other *IBranchKeyIdSupplierCallHistory) bool { + return _this == other +} + +func (_this *IBranchKeyIdSupplierCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IBranchKeyIdSupplierCallHistory) + return ok && _this.Equals(other) +} + +func (*IBranchKeyIdSupplierCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplierCallHistory" +} + +func Type_IBranchKeyIdSupplierCallHistory_() _dafny.TypeDescriptor { + return type_IBranchKeyIdSupplierCallHistory_{} +} + +type type_IBranchKeyIdSupplierCallHistory_ struct { +} + +func (_this type_IBranchKeyIdSupplierCallHistory_) Default() interface{} { + return (*IBranchKeyIdSupplierCallHistory)(nil) +} + +func (_this type_IBranchKeyIdSupplierCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplierCallHistory" +} +func (_this *IBranchKeyIdSupplierCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IBranchKeyIdSupplierCallHistory{} + +// End of class IBranchKeyIdSupplierCallHistory + +// Definition of trait IBranchKeyIdSupplier +type IBranchKeyIdSupplier interface { + String() string + GetBranchKeyId(input GetBranchKeyIdInput) m_Wrappers.Result + GetBranchKeyId_k(input GetBranchKeyIdInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_IBranchKeyIdSupplier_) GetBranchKeyId(_this IBranchKeyIdSupplier, input GetBranchKeyIdInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_GetBranchKeyIdOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetBranchKeyId_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_IBranchKeyIdSupplier_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IBranchKeyIdSupplier_ = CompanionStruct_IBranchKeyIdSupplier_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IBranchKeyIdSupplier_) CastTo_(x interface{}) IBranchKeyIdSupplier { + var t IBranchKeyIdSupplier + t, _ = x.(IBranchKeyIdSupplier) + return t +} + +// End of trait IBranchKeyIdSupplier + +// Definition of datatype CacheType +type CacheType struct { + Data_CacheType_ +} + +func (_this CacheType) Get_() Data_CacheType_ { + return _this.Data_CacheType_ +} + +type Data_CacheType_ interface { + isCacheType() +} + +type CompanionStruct_CacheType_ struct { +} + +var Companion_CacheType_ = CompanionStruct_CacheType_{} + +type CacheType_Default struct { + Default DefaultCache +} + +func (CacheType_Default) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_Default_(Default DefaultCache) CacheType { + return CacheType{CacheType_Default{Default}} +} + +func (_this CacheType) Is_Default() bool { + _, ok := _this.Get_().(CacheType_Default) + return ok +} + +type CacheType_No struct { + No NoCache +} + +func (CacheType_No) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_No_(No NoCache) CacheType { + return CacheType{CacheType_No{No}} +} + +func (_this CacheType) Is_No() bool { + _, ok := _this.Get_().(CacheType_No) + return ok +} + +type CacheType_SingleThreaded struct { + SingleThreaded SingleThreadedCache +} + +func (CacheType_SingleThreaded) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_SingleThreaded_(SingleThreaded SingleThreadedCache) CacheType { + return CacheType{CacheType_SingleThreaded{SingleThreaded}} +} + +func (_this CacheType) Is_SingleThreaded() bool { + _, ok := _this.Get_().(CacheType_SingleThreaded) + return ok +} + +type CacheType_MultiThreaded struct { + MultiThreaded MultiThreadedCache +} + +func (CacheType_MultiThreaded) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_MultiThreaded_(MultiThreaded MultiThreadedCache) CacheType { + return CacheType{CacheType_MultiThreaded{MultiThreaded}} +} + +func (_this CacheType) Is_MultiThreaded() bool { + _, ok := _this.Get_().(CacheType_MultiThreaded) + return ok +} + +type CacheType_StormTracking struct { + StormTracking StormTrackingCache +} + +func (CacheType_StormTracking) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_StormTracking_(StormTracking StormTrackingCache) CacheType { + return CacheType{CacheType_StormTracking{StormTracking}} +} + +func (_this CacheType) Is_StormTracking() bool { + _, ok := _this.Get_().(CacheType_StormTracking) + return ok +} + +type CacheType_Shared struct { + Shared ICryptographicMaterialsCache +} + +func (CacheType_Shared) isCacheType() {} + +func (CompanionStruct_CacheType_) Create_Shared_(Shared ICryptographicMaterialsCache) CacheType { + return CacheType{CacheType_Shared{Shared}} +} + +func (_this CacheType) Is_Shared() bool { + _, ok := _this.Get_().(CacheType_Shared) + return ok +} + +func (CompanionStruct_CacheType_) Default() CacheType { + return Companion_CacheType_.Create_Default_(Companion_DefaultCache_.Default()) +} + +func (_this CacheType) Dtor_Default() DefaultCache { + return _this.Get_().(CacheType_Default).Default +} + +func (_this CacheType) Dtor_No() NoCache { + return _this.Get_().(CacheType_No).No +} + +func (_this CacheType) Dtor_SingleThreaded() SingleThreadedCache { + return _this.Get_().(CacheType_SingleThreaded).SingleThreaded +} + +func (_this CacheType) Dtor_MultiThreaded() MultiThreadedCache { + return _this.Get_().(CacheType_MultiThreaded).MultiThreaded +} + +func (_this CacheType) Dtor_StormTracking() StormTrackingCache { + return _this.Get_().(CacheType_StormTracking).StormTracking +} + +func (_this CacheType) Dtor_Shared() ICryptographicMaterialsCache { + return _this.Get_().(CacheType_Shared).Shared +} + +func (_this CacheType) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CacheType_Default: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.Default" + "(" + _dafny.String(data.Default) + ")" + } + case CacheType_No: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.No" + "(" + _dafny.String(data.No) + ")" + } + case CacheType_SingleThreaded: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.SingleThreaded" + "(" + _dafny.String(data.SingleThreaded) + ")" + } + case CacheType_MultiThreaded: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.MultiThreaded" + "(" + _dafny.String(data.MultiThreaded) + ")" + } + case CacheType_StormTracking: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.StormTracking" + "(" + _dafny.String(data.StormTracking) + ")" + } + case CacheType_Shared: + { + return "AwsCryptographyMaterialProvidersTypes.CacheType.Shared" + "(" + _dafny.String(data.Shared) + ")" + } + default: + { + return "" + } + } +} + +func (_this CacheType) Equals(other CacheType) bool { + switch data1 := _this.Get_().(type) { + case CacheType_Default: + { + data2, ok := other.Get_().(CacheType_Default) + return ok && data1.Default.Equals(data2.Default) + } + case CacheType_No: + { + data2, ok := other.Get_().(CacheType_No) + return ok && data1.No.Equals(data2.No) + } + case CacheType_SingleThreaded: + { + data2, ok := other.Get_().(CacheType_SingleThreaded) + return ok && data1.SingleThreaded.Equals(data2.SingleThreaded) + } + case CacheType_MultiThreaded: + { + data2, ok := other.Get_().(CacheType_MultiThreaded) + return ok && data1.MultiThreaded.Equals(data2.MultiThreaded) + } + case CacheType_StormTracking: + { + data2, ok := other.Get_().(CacheType_StormTracking) + return ok && data1.StormTracking.Equals(data2.StormTracking) + } + case CacheType_Shared: + { + data2, ok := other.Get_().(CacheType_Shared) + return ok && _dafny.AreEqual(data1.Shared, data2.Shared) + } + default: + { + return false // unexpected + } + } +} + +func (_this CacheType) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CacheType) + return ok && _this.Equals(typed) +} + +func Type_CacheType_() _dafny.TypeDescriptor { + return type_CacheType_{} +} + +type type_CacheType_ struct { +} + +func (_this type_CacheType_) Default() interface{} { + return Companion_CacheType_.Default() +} + +func (_this type_CacheType_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CacheType" +} +func (_this CacheType) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CacheType{} + +// End of datatype CacheType + +// Definition of class IClientSupplierCallHistory +type IClientSupplierCallHistory struct { + dummy byte +} + +func New_IClientSupplierCallHistory_() *IClientSupplierCallHistory { + _this := IClientSupplierCallHistory{} + + return &_this +} + +type CompanionStruct_IClientSupplierCallHistory_ struct { +} + +var Companion_IClientSupplierCallHistory_ = CompanionStruct_IClientSupplierCallHistory_{} + +func (_this *IClientSupplierCallHistory) Equals(other *IClientSupplierCallHistory) bool { + return _this == other +} + +func (_this *IClientSupplierCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IClientSupplierCallHistory) + return ok && _this.Equals(other) +} + +func (*IClientSupplierCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.IClientSupplierCallHistory" +} + +func Type_IClientSupplierCallHistory_() _dafny.TypeDescriptor { + return type_IClientSupplierCallHistory_{} +} + +type type_IClientSupplierCallHistory_ struct { +} + +func (_this type_IClientSupplierCallHistory_) Default() interface{} { + return (*IClientSupplierCallHistory)(nil) +} + +func (_this type_IClientSupplierCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IClientSupplierCallHistory" +} +func (_this *IClientSupplierCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IClientSupplierCallHistory{} + +// End of class IClientSupplierCallHistory + +// Definition of trait IClientSupplier +type IClientSupplier interface { + String() string + GetClient(input GetClientInput) m_Wrappers.Result + GetClient_k(input GetClientInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_IClientSupplier_) GetClient(_this IClientSupplier, input GetClientInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetClient_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_IClientSupplier_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IClientSupplier_ = CompanionStruct_IClientSupplier_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IClientSupplier_) CastTo_(x interface{}) IClientSupplier { + var t IClientSupplier + t, _ = x.(IClientSupplier) + return t +} + +// End of trait IClientSupplier + +// Definition of datatype CommitmentPolicy +type CommitmentPolicy struct { + Data_CommitmentPolicy_ +} + +func (_this CommitmentPolicy) Get_() Data_CommitmentPolicy_ { + return _this.Data_CommitmentPolicy_ +} + +type Data_CommitmentPolicy_ interface { + isCommitmentPolicy() +} + +type CompanionStruct_CommitmentPolicy_ struct { +} + +var Companion_CommitmentPolicy_ = CompanionStruct_CommitmentPolicy_{} + +type CommitmentPolicy_ESDK struct { + ESDK ESDKCommitmentPolicy +} + +func (CommitmentPolicy_ESDK) isCommitmentPolicy() {} + +func (CompanionStruct_CommitmentPolicy_) Create_ESDK_(ESDK ESDKCommitmentPolicy) CommitmentPolicy { + return CommitmentPolicy{CommitmentPolicy_ESDK{ESDK}} +} + +func (_this CommitmentPolicy) Is_ESDK() bool { + _, ok := _this.Get_().(CommitmentPolicy_ESDK) + return ok +} + +type CommitmentPolicy_DBE struct { + DBE DBECommitmentPolicy +} + +func (CommitmentPolicy_DBE) isCommitmentPolicy() {} + +func (CompanionStruct_CommitmentPolicy_) Create_DBE_(DBE DBECommitmentPolicy) CommitmentPolicy { + return CommitmentPolicy{CommitmentPolicy_DBE{DBE}} +} + +func (_this CommitmentPolicy) Is_DBE() bool { + _, ok := _this.Get_().(CommitmentPolicy_DBE) + return ok +} + +func (CompanionStruct_CommitmentPolicy_) Default() CommitmentPolicy { + return Companion_CommitmentPolicy_.Create_ESDK_(Companion_ESDKCommitmentPolicy_.Default()) +} + +func (_this CommitmentPolicy) Dtor_ESDK() ESDKCommitmentPolicy { + return _this.Get_().(CommitmentPolicy_ESDK).ESDK +} + +func (_this CommitmentPolicy) Dtor_DBE() DBECommitmentPolicy { + return _this.Get_().(CommitmentPolicy_DBE).DBE +} + +func (_this CommitmentPolicy) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CommitmentPolicy_ESDK: + { + return "AwsCryptographyMaterialProvidersTypes.CommitmentPolicy.ESDK" + "(" + _dafny.String(data.ESDK) + ")" + } + case CommitmentPolicy_DBE: + { + return "AwsCryptographyMaterialProvidersTypes.CommitmentPolicy.DBE" + "(" + _dafny.String(data.DBE) + ")" + } + default: + { + return "" + } + } +} + +func (_this CommitmentPolicy) Equals(other CommitmentPolicy) bool { + switch data1 := _this.Get_().(type) { + case CommitmentPolicy_ESDK: + { + data2, ok := other.Get_().(CommitmentPolicy_ESDK) + return ok && data1.ESDK.Equals(data2.ESDK) + } + case CommitmentPolicy_DBE: + { + data2, ok := other.Get_().(CommitmentPolicy_DBE) + return ok && data1.DBE.Equals(data2.DBE) + } + default: + { + return false // unexpected + } + } +} + +func (_this CommitmentPolicy) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CommitmentPolicy) + return ok && _this.Equals(typed) +} + +func Type_CommitmentPolicy_() _dafny.TypeDescriptor { + return type_CommitmentPolicy_{} +} + +type type_CommitmentPolicy_ struct { +} + +func (_this type_CommitmentPolicy_) Default() interface{} { + return Companion_CommitmentPolicy_.Default() +} + +func (_this type_CommitmentPolicy_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CommitmentPolicy" +} +func (_this CommitmentPolicy) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CommitmentPolicy{} + +// End of datatype CommitmentPolicy + +// Definition of class CountingNumber +type CountingNumber struct { +} + +func New_CountingNumber_() *CountingNumber { + _this := CountingNumber{} + + return &_this +} + +type CompanionStruct_CountingNumber_ struct { +} + +var Companion_CountingNumber_ = CompanionStruct_CountingNumber_{} + +func (*CountingNumber) String() string { + return "AwsCryptographyMaterialProvidersTypes.CountingNumber" +} + +// End of class CountingNumber + +func Type_CountingNumber_() _dafny.TypeDescriptor { + return type_CountingNumber_{} +} + +type type_CountingNumber_ struct { +} + +func (_this type_CountingNumber_) Default() interface{} { + return int32(0) +} + +func (_this type_CountingNumber_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CountingNumber" +} +func (_this *CompanionStruct_CountingNumber_) Is_(__source int32) bool { + var _0_x int32 = (__source) + _ = _0_x + if true { + return Companion_Default___.IsValid__CountingNumber(_0_x) + } + return false +} + +// Definition of datatype CreateAwsKmsDiscoveryKeyringInput +type CreateAwsKmsDiscoveryKeyringInput struct { + Data_CreateAwsKmsDiscoveryKeyringInput_ +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Get_() Data_CreateAwsKmsDiscoveryKeyringInput_ { + return _this.Data_CreateAwsKmsDiscoveryKeyringInput_ +} + +type Data_CreateAwsKmsDiscoveryKeyringInput_ interface { + isCreateAwsKmsDiscoveryKeyringInput() +} + +type CompanionStruct_CreateAwsKmsDiscoveryKeyringInput_ struct { +} + +var Companion_CreateAwsKmsDiscoveryKeyringInput_ = CompanionStruct_CreateAwsKmsDiscoveryKeyringInput_{} + +type CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput struct { + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + DiscoveryFilter m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput) isCreateAwsKmsDiscoveryKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsDiscoveryKeyringInput_) Create_CreateAwsKmsDiscoveryKeyringInput_(KmsClient m_ComAmazonawsKmsTypes.IKMSClient, DiscoveryFilter m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsDiscoveryKeyringInput { + return CreateAwsKmsDiscoveryKeyringInput{CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput{KmsClient, DiscoveryFilter, GrantTokens}} +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Is_CreateAwsKmsDiscoveryKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsDiscoveryKeyringInput_) Default() CreateAwsKmsDiscoveryKeyringInput { + return Companion_CreateAwsKmsDiscoveryKeyringInput_.Create_CreateAwsKmsDiscoveryKeyringInput_((m_ComAmazonawsKmsTypes.IKMSClient)(nil), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput).KmsClient +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Dtor_discoveryFilter() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput).DiscoveryFilter +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput.CreateAwsKmsDiscoveryKeyringInput" + "(" + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.DiscoveryFilter) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) Equals(other CreateAwsKmsDiscoveryKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsDiscoveryKeyringInput_CreateAwsKmsDiscoveryKeyringInput) + return ok && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && data1.DiscoveryFilter.Equals(data2.DiscoveryFilter) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsDiscoveryKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsDiscoveryKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsDiscoveryKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsDiscoveryKeyringInput_{} +} + +type type_CreateAwsKmsDiscoveryKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsDiscoveryKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsDiscoveryKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsDiscoveryKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput" +} +func (_this CreateAwsKmsDiscoveryKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsDiscoveryKeyringInput{} + +// End of datatype CreateAwsKmsDiscoveryKeyringInput + +// Definition of datatype CreateAwsKmsDiscoveryMultiKeyringInput +type CreateAwsKmsDiscoveryMultiKeyringInput struct { + Data_CreateAwsKmsDiscoveryMultiKeyringInput_ +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Get_() Data_CreateAwsKmsDiscoveryMultiKeyringInput_ { + return _this.Data_CreateAwsKmsDiscoveryMultiKeyringInput_ +} + +type Data_CreateAwsKmsDiscoveryMultiKeyringInput_ interface { + isCreateAwsKmsDiscoveryMultiKeyringInput() +} + +type CompanionStruct_CreateAwsKmsDiscoveryMultiKeyringInput_ struct { +} + +var Companion_CreateAwsKmsDiscoveryMultiKeyringInput_ = CompanionStruct_CreateAwsKmsDiscoveryMultiKeyringInput_{} + +type CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput struct { + Regions _dafny.Sequence + DiscoveryFilter m_Wrappers.Option + ClientSupplier m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput) isCreateAwsKmsDiscoveryMultiKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsDiscoveryMultiKeyringInput_) Create_CreateAwsKmsDiscoveryMultiKeyringInput_(Regions _dafny.Sequence, DiscoveryFilter m_Wrappers.Option, ClientSupplier m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsDiscoveryMultiKeyringInput { + return CreateAwsKmsDiscoveryMultiKeyringInput{CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput{Regions, DiscoveryFilter, ClientSupplier, GrantTokens}} +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Is_CreateAwsKmsDiscoveryMultiKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsDiscoveryMultiKeyringInput_) Default() CreateAwsKmsDiscoveryMultiKeyringInput { + return Companion_CreateAwsKmsDiscoveryMultiKeyringInput_.Create_CreateAwsKmsDiscoveryMultiKeyringInput_(_dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Dtor_regions() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput).Regions +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Dtor_discoveryFilter() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput).DiscoveryFilter +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Dtor_clientSupplier() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput).ClientSupplier +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput.CreateAwsKmsDiscoveryMultiKeyringInput" + "(" + _dafny.String(data.Regions) + ", " + _dafny.String(data.DiscoveryFilter) + ", " + _dafny.String(data.ClientSupplier) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) Equals(other CreateAwsKmsDiscoveryMultiKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsDiscoveryMultiKeyringInput_CreateAwsKmsDiscoveryMultiKeyringInput) + return ok && data1.Regions.Equals(data2.Regions) && data1.DiscoveryFilter.Equals(data2.DiscoveryFilter) && data1.ClientSupplier.Equals(data2.ClientSupplier) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsDiscoveryMultiKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsDiscoveryMultiKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsDiscoveryMultiKeyringInput_{} +} + +type type_CreateAwsKmsDiscoveryMultiKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsDiscoveryMultiKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsDiscoveryMultiKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsDiscoveryMultiKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput" +} +func (_this CreateAwsKmsDiscoveryMultiKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsDiscoveryMultiKeyringInput{} + +// End of datatype CreateAwsKmsDiscoveryMultiKeyringInput + +// Definition of datatype CreateAwsKmsEcdhKeyringInput +type CreateAwsKmsEcdhKeyringInput struct { + Data_CreateAwsKmsEcdhKeyringInput_ +} + +func (_this CreateAwsKmsEcdhKeyringInput) Get_() Data_CreateAwsKmsEcdhKeyringInput_ { + return _this.Data_CreateAwsKmsEcdhKeyringInput_ +} + +type Data_CreateAwsKmsEcdhKeyringInput_ interface { + isCreateAwsKmsEcdhKeyringInput() +} + +type CompanionStruct_CreateAwsKmsEcdhKeyringInput_ struct { +} + +var Companion_CreateAwsKmsEcdhKeyringInput_ = CompanionStruct_CreateAwsKmsEcdhKeyringInput_{} + +type CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput struct { + KeyAgreementScheme KmsEcdhStaticConfigurations + CurveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput) isCreateAwsKmsEcdhKeyringInput() {} + +func (CompanionStruct_CreateAwsKmsEcdhKeyringInput_) Create_CreateAwsKmsEcdhKeyringInput_(KeyAgreementScheme KmsEcdhStaticConfigurations, CurveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, KmsClient m_ComAmazonawsKmsTypes.IKMSClient, GrantTokens m_Wrappers.Option) CreateAwsKmsEcdhKeyringInput { + return CreateAwsKmsEcdhKeyringInput{CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput{KeyAgreementScheme, CurveSpec, KmsClient, GrantTokens}} +} + +func (_this CreateAwsKmsEcdhKeyringInput) Is_CreateAwsKmsEcdhKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsEcdhKeyringInput_) Default() CreateAwsKmsEcdhKeyringInput { + return Companion_CreateAwsKmsEcdhKeyringInput_.Create_CreateAwsKmsEcdhKeyringInput_(Companion_KmsEcdhStaticConfigurations_.Default(), m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default(), (m_ComAmazonawsKmsTypes.IKMSClient)(nil), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsEcdhKeyringInput) Dtor_KeyAgreementScheme() KmsEcdhStaticConfigurations { + return _this.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput).KeyAgreementScheme +} + +func (_this CreateAwsKmsEcdhKeyringInput) Dtor_curveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + return _this.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput).CurveSpec +} + +func (_this CreateAwsKmsEcdhKeyringInput) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput).KmsClient +} + +func (_this CreateAwsKmsEcdhKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsEcdhKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput.CreateAwsKmsEcdhKeyringInput" + "(" + _dafny.String(data.KeyAgreementScheme) + ", " + _dafny.String(data.CurveSpec) + ", " + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsEcdhKeyringInput) Equals(other CreateAwsKmsEcdhKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsEcdhKeyringInput_CreateAwsKmsEcdhKeyringInput) + return ok && data1.KeyAgreementScheme.Equals(data2.KeyAgreementScheme) && data1.CurveSpec.Equals(data2.CurveSpec) && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsEcdhKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsEcdhKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsEcdhKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsEcdhKeyringInput_{} +} + +type type_CreateAwsKmsEcdhKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsEcdhKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsEcdhKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsEcdhKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput" +} +func (_this CreateAwsKmsEcdhKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsEcdhKeyringInput{} + +// End of datatype CreateAwsKmsEcdhKeyringInput + +// Definition of datatype CreateAwsKmsHierarchicalKeyringInput +type CreateAwsKmsHierarchicalKeyringInput struct { + Data_CreateAwsKmsHierarchicalKeyringInput_ +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Get_() Data_CreateAwsKmsHierarchicalKeyringInput_ { + return _this.Data_CreateAwsKmsHierarchicalKeyringInput_ +} + +type Data_CreateAwsKmsHierarchicalKeyringInput_ interface { + isCreateAwsKmsHierarchicalKeyringInput() +} + +type CompanionStruct_CreateAwsKmsHierarchicalKeyringInput_ struct { +} + +var Companion_CreateAwsKmsHierarchicalKeyringInput_ = CompanionStruct_CreateAwsKmsHierarchicalKeyringInput_{} + +type CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput struct { + BranchKeyId m_Wrappers.Option + BranchKeyIdSupplier m_Wrappers.Option + KeyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient + TtlSeconds int64 + Cache m_Wrappers.Option + PartitionId m_Wrappers.Option +} + +func (CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput) isCreateAwsKmsHierarchicalKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsHierarchicalKeyringInput_) Create_CreateAwsKmsHierarchicalKeyringInput_(BranchKeyId m_Wrappers.Option, BranchKeyIdSupplier m_Wrappers.Option, KeyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient, TtlSeconds int64, Cache m_Wrappers.Option, PartitionId m_Wrappers.Option) CreateAwsKmsHierarchicalKeyringInput { + return CreateAwsKmsHierarchicalKeyringInput{CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput{BranchKeyId, BranchKeyIdSupplier, KeyStore, TtlSeconds, Cache, PartitionId}} +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Is_CreateAwsKmsHierarchicalKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsHierarchicalKeyringInput_) Default() CreateAwsKmsHierarchicalKeyringInput { + return Companion_CreateAwsKmsHierarchicalKeyringInput_.Create_CreateAwsKmsHierarchicalKeyringInput_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), (m_AwsCryptographyKeyStoreTypes.IKeyStoreClient)(nil), int64(0), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_branchKeyId() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).BranchKeyId +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_branchKeyIdSupplier() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).BranchKeyIdSupplier +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_keyStore() m_AwsCryptographyKeyStoreTypes.IKeyStoreClient { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).KeyStore +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_ttlSeconds() int64 { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).TtlSeconds +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_cache() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).Cache +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Dtor_partitionId() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput).PartitionId +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput.CreateAwsKmsHierarchicalKeyringInput" + "(" + _dafny.String(data.BranchKeyId) + ", " + _dafny.String(data.BranchKeyIdSupplier) + ", " + _dafny.String(data.KeyStore) + ", " + _dafny.String(data.TtlSeconds) + ", " + _dafny.String(data.Cache) + ", " + _dafny.String(data.PartitionId) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) Equals(other CreateAwsKmsHierarchicalKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsHierarchicalKeyringInput_CreateAwsKmsHierarchicalKeyringInput) + return ok && data1.BranchKeyId.Equals(data2.BranchKeyId) && data1.BranchKeyIdSupplier.Equals(data2.BranchKeyIdSupplier) && _dafny.AreEqual(data1.KeyStore, data2.KeyStore) && data1.TtlSeconds == data2.TtlSeconds && data1.Cache.Equals(data2.Cache) && data1.PartitionId.Equals(data2.PartitionId) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsHierarchicalKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsHierarchicalKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsHierarchicalKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsHierarchicalKeyringInput_{} +} + +type type_CreateAwsKmsHierarchicalKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsHierarchicalKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsHierarchicalKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsHierarchicalKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput" +} +func (_this CreateAwsKmsHierarchicalKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsHierarchicalKeyringInput{} + +// End of datatype CreateAwsKmsHierarchicalKeyringInput + +// Definition of datatype CreateAwsKmsKeyringInput +type CreateAwsKmsKeyringInput struct { + Data_CreateAwsKmsKeyringInput_ +} + +func (_this CreateAwsKmsKeyringInput) Get_() Data_CreateAwsKmsKeyringInput_ { + return _this.Data_CreateAwsKmsKeyringInput_ +} + +type Data_CreateAwsKmsKeyringInput_ interface { + isCreateAwsKmsKeyringInput() +} + +type CompanionStruct_CreateAwsKmsKeyringInput_ struct { +} + +var Companion_CreateAwsKmsKeyringInput_ = CompanionStruct_CreateAwsKmsKeyringInput_{} + +type CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput struct { + KmsKeyId _dafny.Sequence + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput) isCreateAwsKmsKeyringInput() {} + +func (CompanionStruct_CreateAwsKmsKeyringInput_) Create_CreateAwsKmsKeyringInput_(KmsKeyId _dafny.Sequence, KmsClient m_ComAmazonawsKmsTypes.IKMSClient, GrantTokens m_Wrappers.Option) CreateAwsKmsKeyringInput { + return CreateAwsKmsKeyringInput{CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput{KmsKeyId, KmsClient, GrantTokens}} +} + +func (_this CreateAwsKmsKeyringInput) Is_CreateAwsKmsKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsKeyringInput_) Default() CreateAwsKmsKeyringInput { + return Companion_CreateAwsKmsKeyringInput_.Create_CreateAwsKmsKeyringInput_(_dafny.EmptySeq.SetString(), (m_ComAmazonawsKmsTypes.IKMSClient)(nil), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsKeyringInput) Dtor_kmsKeyId() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput).KmsKeyId +} + +func (_this CreateAwsKmsKeyringInput) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput).KmsClient +} + +func (_this CreateAwsKmsKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput.CreateAwsKmsKeyringInput" + "(" + _dafny.String(data.KmsKeyId) + ", " + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsKeyringInput) Equals(other CreateAwsKmsKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsKeyringInput_CreateAwsKmsKeyringInput) + return ok && data1.KmsKeyId.Equals(data2.KmsKeyId) && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsKeyringInput_{} +} + +type type_CreateAwsKmsKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput" +} +func (_this CreateAwsKmsKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsKeyringInput{} + +// End of datatype CreateAwsKmsKeyringInput + +// Definition of datatype CreateAwsKmsMrkDiscoveryKeyringInput +type CreateAwsKmsMrkDiscoveryKeyringInput struct { + Data_CreateAwsKmsMrkDiscoveryKeyringInput_ +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Get_() Data_CreateAwsKmsMrkDiscoveryKeyringInput_ { + return _this.Data_CreateAwsKmsMrkDiscoveryKeyringInput_ +} + +type Data_CreateAwsKmsMrkDiscoveryKeyringInput_ interface { + isCreateAwsKmsMrkDiscoveryKeyringInput() +} + +type CompanionStruct_CreateAwsKmsMrkDiscoveryKeyringInput_ struct { +} + +var Companion_CreateAwsKmsMrkDiscoveryKeyringInput_ = CompanionStruct_CreateAwsKmsMrkDiscoveryKeyringInput_{} + +type CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput struct { + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + DiscoveryFilter m_Wrappers.Option + GrantTokens m_Wrappers.Option + Region _dafny.Sequence +} + +func (CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput) isCreateAwsKmsMrkDiscoveryKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsMrkDiscoveryKeyringInput_) Create_CreateAwsKmsMrkDiscoveryKeyringInput_(KmsClient m_ComAmazonawsKmsTypes.IKMSClient, DiscoveryFilter m_Wrappers.Option, GrantTokens m_Wrappers.Option, Region _dafny.Sequence) CreateAwsKmsMrkDiscoveryKeyringInput { + return CreateAwsKmsMrkDiscoveryKeyringInput{CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput{KmsClient, DiscoveryFilter, GrantTokens, Region}} +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Is_CreateAwsKmsMrkDiscoveryKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsMrkDiscoveryKeyringInput_) Default() CreateAwsKmsMrkDiscoveryKeyringInput { + return Companion_CreateAwsKmsMrkDiscoveryKeyringInput_.Create_CreateAwsKmsMrkDiscoveryKeyringInput_((m_ComAmazonawsKmsTypes.IKMSClient)(nil), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), _dafny.EmptySeq.SetString()) +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput).KmsClient +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Dtor_discoveryFilter() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput).DiscoveryFilter +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Dtor_region() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput).Region +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput.CreateAwsKmsMrkDiscoveryKeyringInput" + "(" + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.DiscoveryFilter) + ", " + _dafny.String(data.GrantTokens) + ", " + _dafny.String(data.Region) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) Equals(other CreateAwsKmsMrkDiscoveryKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsMrkDiscoveryKeyringInput_CreateAwsKmsMrkDiscoveryKeyringInput) + return ok && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && data1.DiscoveryFilter.Equals(data2.DiscoveryFilter) && data1.GrantTokens.Equals(data2.GrantTokens) && data1.Region.Equals(data2.Region) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsMrkDiscoveryKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsMrkDiscoveryKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsMrkDiscoveryKeyringInput_{} +} + +type type_CreateAwsKmsMrkDiscoveryKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsMrkDiscoveryKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsMrkDiscoveryKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsMrkDiscoveryKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput" +} +func (_this CreateAwsKmsMrkDiscoveryKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsMrkDiscoveryKeyringInput{} + +// End of datatype CreateAwsKmsMrkDiscoveryKeyringInput + +// Definition of datatype CreateAwsKmsMrkDiscoveryMultiKeyringInput +type CreateAwsKmsMrkDiscoveryMultiKeyringInput struct { + Data_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Get_() Data_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ { + return _this.Data_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ +} + +type Data_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ interface { + isCreateAwsKmsMrkDiscoveryMultiKeyringInput() +} + +type CompanionStruct_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ struct { +} + +var Companion_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ = CompanionStruct_CreateAwsKmsMrkDiscoveryMultiKeyringInput_{} + +type CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput struct { + Regions _dafny.Sequence + DiscoveryFilter m_Wrappers.Option + ClientSupplier m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput) isCreateAwsKmsMrkDiscoveryMultiKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsMrkDiscoveryMultiKeyringInput_) Create_CreateAwsKmsMrkDiscoveryMultiKeyringInput_(Regions _dafny.Sequence, DiscoveryFilter m_Wrappers.Option, ClientSupplier m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsMrkDiscoveryMultiKeyringInput { + return CreateAwsKmsMrkDiscoveryMultiKeyringInput{CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput{Regions, DiscoveryFilter, ClientSupplier, GrantTokens}} +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Is_CreateAwsKmsMrkDiscoveryMultiKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsMrkDiscoveryMultiKeyringInput_) Default() CreateAwsKmsMrkDiscoveryMultiKeyringInput { + return Companion_CreateAwsKmsMrkDiscoveryMultiKeyringInput_.Create_CreateAwsKmsMrkDiscoveryMultiKeyringInput_(_dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Dtor_regions() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput).Regions +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Dtor_discoveryFilter() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput).DiscoveryFilter +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Dtor_clientSupplier() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput).ClientSupplier +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput.CreateAwsKmsMrkDiscoveryMultiKeyringInput" + "(" + _dafny.String(data.Regions) + ", " + _dafny.String(data.DiscoveryFilter) + ", " + _dafny.String(data.ClientSupplier) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) Equals(other CreateAwsKmsMrkDiscoveryMultiKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsMrkDiscoveryMultiKeyringInput_CreateAwsKmsMrkDiscoveryMultiKeyringInput) + return ok && data1.Regions.Equals(data2.Regions) && data1.DiscoveryFilter.Equals(data2.DiscoveryFilter) && data1.ClientSupplier.Equals(data2.ClientSupplier) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsMrkDiscoveryMultiKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsMrkDiscoveryMultiKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsMrkDiscoveryMultiKeyringInput_{} +} + +type type_CreateAwsKmsMrkDiscoveryMultiKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsMrkDiscoveryMultiKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsMrkDiscoveryMultiKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsMrkDiscoveryMultiKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput" +} +func (_this CreateAwsKmsMrkDiscoveryMultiKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsMrkDiscoveryMultiKeyringInput{} + +// End of datatype CreateAwsKmsMrkDiscoveryMultiKeyringInput + +// Definition of datatype CreateAwsKmsMrkKeyringInput +type CreateAwsKmsMrkKeyringInput struct { + Data_CreateAwsKmsMrkKeyringInput_ +} + +func (_this CreateAwsKmsMrkKeyringInput) Get_() Data_CreateAwsKmsMrkKeyringInput_ { + return _this.Data_CreateAwsKmsMrkKeyringInput_ +} + +type Data_CreateAwsKmsMrkKeyringInput_ interface { + isCreateAwsKmsMrkKeyringInput() +} + +type CompanionStruct_CreateAwsKmsMrkKeyringInput_ struct { +} + +var Companion_CreateAwsKmsMrkKeyringInput_ = CompanionStruct_CreateAwsKmsMrkKeyringInput_{} + +type CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput struct { + KmsKeyId _dafny.Sequence + KmsClient m_ComAmazonawsKmsTypes.IKMSClient + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput) isCreateAwsKmsMrkKeyringInput() {} + +func (CompanionStruct_CreateAwsKmsMrkKeyringInput_) Create_CreateAwsKmsMrkKeyringInput_(KmsKeyId _dafny.Sequence, KmsClient m_ComAmazonawsKmsTypes.IKMSClient, GrantTokens m_Wrappers.Option) CreateAwsKmsMrkKeyringInput { + return CreateAwsKmsMrkKeyringInput{CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput{KmsKeyId, KmsClient, GrantTokens}} +} + +func (_this CreateAwsKmsMrkKeyringInput) Is_CreateAwsKmsMrkKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsMrkKeyringInput_) Default() CreateAwsKmsMrkKeyringInput { + return Companion_CreateAwsKmsMrkKeyringInput_.Create_CreateAwsKmsMrkKeyringInput_(_dafny.EmptySeq.SetString(), (m_ComAmazonawsKmsTypes.IKMSClient)(nil), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsMrkKeyringInput) Dtor_kmsKeyId() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput).KmsKeyId +} + +func (_this CreateAwsKmsMrkKeyringInput) Dtor_kmsClient() m_ComAmazonawsKmsTypes.IKMSClient { + return _this.Get_().(CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput).KmsClient +} + +func (_this CreateAwsKmsMrkKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsMrkKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput.CreateAwsKmsMrkKeyringInput" + "(" + _dafny.String(data.KmsKeyId) + ", " + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsMrkKeyringInput) Equals(other CreateAwsKmsMrkKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsMrkKeyringInput_CreateAwsKmsMrkKeyringInput) + return ok && data1.KmsKeyId.Equals(data2.KmsKeyId) && _dafny.AreEqual(data1.KmsClient, data2.KmsClient) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsMrkKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsMrkKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsMrkKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsMrkKeyringInput_{} +} + +type type_CreateAwsKmsMrkKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsMrkKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsMrkKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsMrkKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput" +} +func (_this CreateAwsKmsMrkKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsMrkKeyringInput{} + +// End of datatype CreateAwsKmsMrkKeyringInput + +// Definition of datatype CreateAwsKmsMrkMultiKeyringInput +type CreateAwsKmsMrkMultiKeyringInput struct { + Data_CreateAwsKmsMrkMultiKeyringInput_ +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Get_() Data_CreateAwsKmsMrkMultiKeyringInput_ { + return _this.Data_CreateAwsKmsMrkMultiKeyringInput_ +} + +type Data_CreateAwsKmsMrkMultiKeyringInput_ interface { + isCreateAwsKmsMrkMultiKeyringInput() +} + +type CompanionStruct_CreateAwsKmsMrkMultiKeyringInput_ struct { +} + +var Companion_CreateAwsKmsMrkMultiKeyringInput_ = CompanionStruct_CreateAwsKmsMrkMultiKeyringInput_{} + +type CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput struct { + Generator m_Wrappers.Option + KmsKeyIds m_Wrappers.Option + ClientSupplier m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput) isCreateAwsKmsMrkMultiKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsMrkMultiKeyringInput_) Create_CreateAwsKmsMrkMultiKeyringInput_(Generator m_Wrappers.Option, KmsKeyIds m_Wrappers.Option, ClientSupplier m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsMrkMultiKeyringInput { + return CreateAwsKmsMrkMultiKeyringInput{CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput{Generator, KmsKeyIds, ClientSupplier, GrantTokens}} +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Is_CreateAwsKmsMrkMultiKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsMrkMultiKeyringInput_) Default() CreateAwsKmsMrkMultiKeyringInput { + return Companion_CreateAwsKmsMrkMultiKeyringInput_.Create_CreateAwsKmsMrkMultiKeyringInput_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Dtor_generator() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput).Generator +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Dtor_kmsKeyIds() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput).KmsKeyIds +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Dtor_clientSupplier() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput).ClientSupplier +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput.CreateAwsKmsMrkMultiKeyringInput" + "(" + _dafny.String(data.Generator) + ", " + _dafny.String(data.KmsKeyIds) + ", " + _dafny.String(data.ClientSupplier) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) Equals(other CreateAwsKmsMrkMultiKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsMrkMultiKeyringInput_CreateAwsKmsMrkMultiKeyringInput) + return ok && data1.Generator.Equals(data2.Generator) && data1.KmsKeyIds.Equals(data2.KmsKeyIds) && data1.ClientSupplier.Equals(data2.ClientSupplier) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsMrkMultiKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsMrkMultiKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsMrkMultiKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsMrkMultiKeyringInput_{} +} + +type type_CreateAwsKmsMrkMultiKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsMrkMultiKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsMrkMultiKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsMrkMultiKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput" +} +func (_this CreateAwsKmsMrkMultiKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsMrkMultiKeyringInput{} + +// End of datatype CreateAwsKmsMrkMultiKeyringInput + +// Definition of datatype CreateAwsKmsMultiKeyringInput +type CreateAwsKmsMultiKeyringInput struct { + Data_CreateAwsKmsMultiKeyringInput_ +} + +func (_this CreateAwsKmsMultiKeyringInput) Get_() Data_CreateAwsKmsMultiKeyringInput_ { + return _this.Data_CreateAwsKmsMultiKeyringInput_ +} + +type Data_CreateAwsKmsMultiKeyringInput_ interface { + isCreateAwsKmsMultiKeyringInput() +} + +type CompanionStruct_CreateAwsKmsMultiKeyringInput_ struct { +} + +var Companion_CreateAwsKmsMultiKeyringInput_ = CompanionStruct_CreateAwsKmsMultiKeyringInput_{} + +type CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput struct { + Generator m_Wrappers.Option + KmsKeyIds m_Wrappers.Option + ClientSupplier m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput) isCreateAwsKmsMultiKeyringInput() { +} + +func (CompanionStruct_CreateAwsKmsMultiKeyringInput_) Create_CreateAwsKmsMultiKeyringInput_(Generator m_Wrappers.Option, KmsKeyIds m_Wrappers.Option, ClientSupplier m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsMultiKeyringInput { + return CreateAwsKmsMultiKeyringInput{CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput{Generator, KmsKeyIds, ClientSupplier, GrantTokens}} +} + +func (_this CreateAwsKmsMultiKeyringInput) Is_CreateAwsKmsMultiKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsMultiKeyringInput_) Default() CreateAwsKmsMultiKeyringInput { + return Companion_CreateAwsKmsMultiKeyringInput_.Create_CreateAwsKmsMultiKeyringInput_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsMultiKeyringInput) Dtor_generator() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput).Generator +} + +func (_this CreateAwsKmsMultiKeyringInput) Dtor_kmsKeyIds() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput).KmsKeyIds +} + +func (_this CreateAwsKmsMultiKeyringInput) Dtor_clientSupplier() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput).ClientSupplier +} + +func (_this CreateAwsKmsMultiKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsMultiKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput.CreateAwsKmsMultiKeyringInput" + "(" + _dafny.String(data.Generator) + ", " + _dafny.String(data.KmsKeyIds) + ", " + _dafny.String(data.ClientSupplier) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsMultiKeyringInput) Equals(other CreateAwsKmsMultiKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsMultiKeyringInput_CreateAwsKmsMultiKeyringInput) + return ok && data1.Generator.Equals(data2.Generator) && data1.KmsKeyIds.Equals(data2.KmsKeyIds) && data1.ClientSupplier.Equals(data2.ClientSupplier) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsMultiKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsMultiKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsMultiKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsMultiKeyringInput_{} +} + +type type_CreateAwsKmsMultiKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsMultiKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsMultiKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsMultiKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput" +} +func (_this CreateAwsKmsMultiKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsMultiKeyringInput{} + +// End of datatype CreateAwsKmsMultiKeyringInput + +// Definition of datatype CreateAwsKmsRsaKeyringInput +type CreateAwsKmsRsaKeyringInput struct { + Data_CreateAwsKmsRsaKeyringInput_ +} + +func (_this CreateAwsKmsRsaKeyringInput) Get_() Data_CreateAwsKmsRsaKeyringInput_ { + return _this.Data_CreateAwsKmsRsaKeyringInput_ +} + +type Data_CreateAwsKmsRsaKeyringInput_ interface { + isCreateAwsKmsRsaKeyringInput() +} + +type CompanionStruct_CreateAwsKmsRsaKeyringInput_ struct { +} + +var Companion_CreateAwsKmsRsaKeyringInput_ = CompanionStruct_CreateAwsKmsRsaKeyringInput_{} + +type CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput struct { + PublicKey m_Wrappers.Option + KmsKeyId _dafny.Sequence + EncryptionAlgorithm m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec + KmsClient m_Wrappers.Option + GrantTokens m_Wrappers.Option +} + +func (CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput) isCreateAwsKmsRsaKeyringInput() {} + +func (CompanionStruct_CreateAwsKmsRsaKeyringInput_) Create_CreateAwsKmsRsaKeyringInput_(PublicKey m_Wrappers.Option, KmsKeyId _dafny.Sequence, EncryptionAlgorithm m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, KmsClient m_Wrappers.Option, GrantTokens m_Wrappers.Option) CreateAwsKmsRsaKeyringInput { + return CreateAwsKmsRsaKeyringInput{CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput{PublicKey, KmsKeyId, EncryptionAlgorithm, KmsClient, GrantTokens}} +} + +func (_this CreateAwsKmsRsaKeyringInput) Is_CreateAwsKmsRsaKeyringInput() bool { + _, ok := _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput) + return ok +} + +func (CompanionStruct_CreateAwsKmsRsaKeyringInput_) Default() CreateAwsKmsRsaKeyringInput { + return Companion_CreateAwsKmsRsaKeyringInput_.Create_CreateAwsKmsRsaKeyringInput_(m_Wrappers.Companion_Option_.Default(), _dafny.EmptySeq.SetString(), m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateAwsKmsRsaKeyringInput) Dtor_publicKey() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput).PublicKey +} + +func (_this CreateAwsKmsRsaKeyringInput) Dtor_kmsKeyId() _dafny.Sequence { + return _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput).KmsKeyId +} + +func (_this CreateAwsKmsRsaKeyringInput) Dtor_encryptionAlgorithm() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + return _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput).EncryptionAlgorithm +} + +func (_this CreateAwsKmsRsaKeyringInput) Dtor_kmsClient() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput).KmsClient +} + +func (_this CreateAwsKmsRsaKeyringInput) Dtor_grantTokens() m_Wrappers.Option { + return _this.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput).GrantTokens +} + +func (_this CreateAwsKmsRsaKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput.CreateAwsKmsRsaKeyringInput" + "(" + _dafny.String(data.PublicKey) + ", " + _dafny.String(data.KmsKeyId) + ", " + _dafny.String(data.EncryptionAlgorithm) + ", " + _dafny.String(data.KmsClient) + ", " + _dafny.String(data.GrantTokens) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateAwsKmsRsaKeyringInput) Equals(other CreateAwsKmsRsaKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput: + { + data2, ok := other.Get_().(CreateAwsKmsRsaKeyringInput_CreateAwsKmsRsaKeyringInput) + return ok && data1.PublicKey.Equals(data2.PublicKey) && data1.KmsKeyId.Equals(data2.KmsKeyId) && data1.EncryptionAlgorithm.Equals(data2.EncryptionAlgorithm) && data1.KmsClient.Equals(data2.KmsClient) && data1.GrantTokens.Equals(data2.GrantTokens) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateAwsKmsRsaKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateAwsKmsRsaKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateAwsKmsRsaKeyringInput_() _dafny.TypeDescriptor { + return type_CreateAwsKmsRsaKeyringInput_{} +} + +type type_CreateAwsKmsRsaKeyringInput_ struct { +} + +func (_this type_CreateAwsKmsRsaKeyringInput_) Default() interface{} { + return Companion_CreateAwsKmsRsaKeyringInput_.Default() +} + +func (_this type_CreateAwsKmsRsaKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput" +} +func (_this CreateAwsKmsRsaKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateAwsKmsRsaKeyringInput{} + +// End of datatype CreateAwsKmsRsaKeyringInput + +// Definition of datatype CreateCryptographicMaterialsCacheInput +type CreateCryptographicMaterialsCacheInput struct { + Data_CreateCryptographicMaterialsCacheInput_ +} + +func (_this CreateCryptographicMaterialsCacheInput) Get_() Data_CreateCryptographicMaterialsCacheInput_ { + return _this.Data_CreateCryptographicMaterialsCacheInput_ +} + +type Data_CreateCryptographicMaterialsCacheInput_ interface { + isCreateCryptographicMaterialsCacheInput() +} + +type CompanionStruct_CreateCryptographicMaterialsCacheInput_ struct { +} + +var Companion_CreateCryptographicMaterialsCacheInput_ = CompanionStruct_CreateCryptographicMaterialsCacheInput_{} + +type CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput struct { + Cache CacheType +} + +func (CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput) isCreateCryptographicMaterialsCacheInput() { +} + +func (CompanionStruct_CreateCryptographicMaterialsCacheInput_) Create_CreateCryptographicMaterialsCacheInput_(Cache CacheType) CreateCryptographicMaterialsCacheInput { + return CreateCryptographicMaterialsCacheInput{CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput{Cache}} +} + +func (_this CreateCryptographicMaterialsCacheInput) Is_CreateCryptographicMaterialsCacheInput() bool { + _, ok := _this.Get_().(CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput) + return ok +} + +func (CompanionStruct_CreateCryptographicMaterialsCacheInput_) Default() CreateCryptographicMaterialsCacheInput { + return Companion_CreateCryptographicMaterialsCacheInput_.Create_CreateCryptographicMaterialsCacheInput_(Companion_CacheType_.Default()) +} + +func (_this CreateCryptographicMaterialsCacheInput) Dtor_cache() CacheType { + return _this.Get_().(CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput).Cache +} + +func (_this CreateCryptographicMaterialsCacheInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput.CreateCryptographicMaterialsCacheInput" + "(" + _dafny.String(data.Cache) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateCryptographicMaterialsCacheInput) Equals(other CreateCryptographicMaterialsCacheInput) bool { + switch data1 := _this.Get_().(type) { + case CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput: + { + data2, ok := other.Get_().(CreateCryptographicMaterialsCacheInput_CreateCryptographicMaterialsCacheInput) + return ok && data1.Cache.Equals(data2.Cache) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateCryptographicMaterialsCacheInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateCryptographicMaterialsCacheInput) + return ok && _this.Equals(typed) +} + +func Type_CreateCryptographicMaterialsCacheInput_() _dafny.TypeDescriptor { + return type_CreateCryptographicMaterialsCacheInput_{} +} + +type type_CreateCryptographicMaterialsCacheInput_ struct { +} + +func (_this type_CreateCryptographicMaterialsCacheInput_) Default() interface{} { + return Companion_CreateCryptographicMaterialsCacheInput_.Default() +} + +func (_this type_CreateCryptographicMaterialsCacheInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput" +} +func (_this CreateCryptographicMaterialsCacheInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateCryptographicMaterialsCacheInput{} + +// End of datatype CreateCryptographicMaterialsCacheInput + +// Definition of datatype CreateDefaultClientSupplierInput +type CreateDefaultClientSupplierInput struct { + Data_CreateDefaultClientSupplierInput_ +} + +func (_this CreateDefaultClientSupplierInput) Get_() Data_CreateDefaultClientSupplierInput_ { + return _this.Data_CreateDefaultClientSupplierInput_ +} + +type Data_CreateDefaultClientSupplierInput_ interface { + isCreateDefaultClientSupplierInput() +} + +type CompanionStruct_CreateDefaultClientSupplierInput_ struct { +} + +var Companion_CreateDefaultClientSupplierInput_ = CompanionStruct_CreateDefaultClientSupplierInput_{} + +type CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput struct { +} + +func (CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput) isCreateDefaultClientSupplierInput() { +} + +func (CompanionStruct_CreateDefaultClientSupplierInput_) Create_CreateDefaultClientSupplierInput_() CreateDefaultClientSupplierInput { + return CreateDefaultClientSupplierInput{CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput{}} +} + +func (_this CreateDefaultClientSupplierInput) Is_CreateDefaultClientSupplierInput() bool { + _, ok := _this.Get_().(CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput) + return ok +} + +func (CompanionStruct_CreateDefaultClientSupplierInput_) Default() CreateDefaultClientSupplierInput { + return Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_() +} + +func (_ CompanionStruct_CreateDefaultClientSupplierInput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_(), true + default: + return CreateDefaultClientSupplierInput{}, false + } + } +} + +func (_this CreateDefaultClientSupplierInput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput.CreateDefaultClientSupplierInput" + } + default: + { + return "" + } + } +} + +func (_this CreateDefaultClientSupplierInput) Equals(other CreateDefaultClientSupplierInput) bool { + switch _this.Get_().(type) { + case CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput: + { + _, ok := other.Get_().(CreateDefaultClientSupplierInput_CreateDefaultClientSupplierInput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateDefaultClientSupplierInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateDefaultClientSupplierInput) + return ok && _this.Equals(typed) +} + +func Type_CreateDefaultClientSupplierInput_() _dafny.TypeDescriptor { + return type_CreateDefaultClientSupplierInput_{} +} + +type type_CreateDefaultClientSupplierInput_ struct { +} + +func (_this type_CreateDefaultClientSupplierInput_) Default() interface{} { + return Companion_CreateDefaultClientSupplierInput_.Default() +} + +func (_this type_CreateDefaultClientSupplierInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput" +} +func (_this CreateDefaultClientSupplierInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateDefaultClientSupplierInput{} + +// End of datatype CreateDefaultClientSupplierInput + +// Definition of datatype CreateDefaultCryptographicMaterialsManagerInput +type CreateDefaultCryptographicMaterialsManagerInput struct { + Data_CreateDefaultCryptographicMaterialsManagerInput_ +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) Get_() Data_CreateDefaultCryptographicMaterialsManagerInput_ { + return _this.Data_CreateDefaultCryptographicMaterialsManagerInput_ +} + +type Data_CreateDefaultCryptographicMaterialsManagerInput_ interface { + isCreateDefaultCryptographicMaterialsManagerInput() +} + +type CompanionStruct_CreateDefaultCryptographicMaterialsManagerInput_ struct { +} + +var Companion_CreateDefaultCryptographicMaterialsManagerInput_ = CompanionStruct_CreateDefaultCryptographicMaterialsManagerInput_{} + +type CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput struct { + Keyring IKeyring +} + +func (CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput) isCreateDefaultCryptographicMaterialsManagerInput() { +} + +func (CompanionStruct_CreateDefaultCryptographicMaterialsManagerInput_) Create_CreateDefaultCryptographicMaterialsManagerInput_(Keyring IKeyring) CreateDefaultCryptographicMaterialsManagerInput { + return CreateDefaultCryptographicMaterialsManagerInput{CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput{Keyring}} +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) Is_CreateDefaultCryptographicMaterialsManagerInput() bool { + _, ok := _this.Get_().(CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput) + return ok +} + +func (CompanionStruct_CreateDefaultCryptographicMaterialsManagerInput_) Default() CreateDefaultCryptographicMaterialsManagerInput { + return Companion_CreateDefaultCryptographicMaterialsManagerInput_.Create_CreateDefaultCryptographicMaterialsManagerInput_((IKeyring)(nil)) +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) Dtor_keyring() IKeyring { + return _this.Get_().(CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput).Keyring +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput.CreateDefaultCryptographicMaterialsManagerInput" + "(" + _dafny.String(data.Keyring) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) Equals(other CreateDefaultCryptographicMaterialsManagerInput) bool { + switch data1 := _this.Get_().(type) { + case CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput: + { + data2, ok := other.Get_().(CreateDefaultCryptographicMaterialsManagerInput_CreateDefaultCryptographicMaterialsManagerInput) + return ok && _dafny.AreEqual(data1.Keyring, data2.Keyring) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateDefaultCryptographicMaterialsManagerInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateDefaultCryptographicMaterialsManagerInput) + return ok && _this.Equals(typed) +} + +func Type_CreateDefaultCryptographicMaterialsManagerInput_() _dafny.TypeDescriptor { + return type_CreateDefaultCryptographicMaterialsManagerInput_{} +} + +type type_CreateDefaultCryptographicMaterialsManagerInput_ struct { +} + +func (_this type_CreateDefaultCryptographicMaterialsManagerInput_) Default() interface{} { + return Companion_CreateDefaultCryptographicMaterialsManagerInput_.Default() +} + +func (_this type_CreateDefaultCryptographicMaterialsManagerInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput" +} +func (_this CreateDefaultCryptographicMaterialsManagerInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateDefaultCryptographicMaterialsManagerInput{} + +// End of datatype CreateDefaultCryptographicMaterialsManagerInput + +// Definition of datatype CreateMultiKeyringInput +type CreateMultiKeyringInput struct { + Data_CreateMultiKeyringInput_ +} + +func (_this CreateMultiKeyringInput) Get_() Data_CreateMultiKeyringInput_ { + return _this.Data_CreateMultiKeyringInput_ +} + +type Data_CreateMultiKeyringInput_ interface { + isCreateMultiKeyringInput() +} + +type CompanionStruct_CreateMultiKeyringInput_ struct { +} + +var Companion_CreateMultiKeyringInput_ = CompanionStruct_CreateMultiKeyringInput_{} + +type CreateMultiKeyringInput_CreateMultiKeyringInput struct { + Generator m_Wrappers.Option + ChildKeyrings _dafny.Sequence +} + +func (CreateMultiKeyringInput_CreateMultiKeyringInput) isCreateMultiKeyringInput() {} + +func (CompanionStruct_CreateMultiKeyringInput_) Create_CreateMultiKeyringInput_(Generator m_Wrappers.Option, ChildKeyrings _dafny.Sequence) CreateMultiKeyringInput { + return CreateMultiKeyringInput{CreateMultiKeyringInput_CreateMultiKeyringInput{Generator, ChildKeyrings}} +} + +func (_this CreateMultiKeyringInput) Is_CreateMultiKeyringInput() bool { + _, ok := _this.Get_().(CreateMultiKeyringInput_CreateMultiKeyringInput) + return ok +} + +func (CompanionStruct_CreateMultiKeyringInput_) Default() CreateMultiKeyringInput { + return Companion_CreateMultiKeyringInput_.Create_CreateMultiKeyringInput_(m_Wrappers.Companion_Option_.Default(), _dafny.EmptySeq) +} + +func (_this CreateMultiKeyringInput) Dtor_generator() m_Wrappers.Option { + return _this.Get_().(CreateMultiKeyringInput_CreateMultiKeyringInput).Generator +} + +func (_this CreateMultiKeyringInput) Dtor_childKeyrings() _dafny.Sequence { + return _this.Get_().(CreateMultiKeyringInput_CreateMultiKeyringInput).ChildKeyrings +} + +func (_this CreateMultiKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateMultiKeyringInput_CreateMultiKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput.CreateMultiKeyringInput" + "(" + _dafny.String(data.Generator) + ", " + _dafny.String(data.ChildKeyrings) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateMultiKeyringInput) Equals(other CreateMultiKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateMultiKeyringInput_CreateMultiKeyringInput: + { + data2, ok := other.Get_().(CreateMultiKeyringInput_CreateMultiKeyringInput) + return ok && data1.Generator.Equals(data2.Generator) && data1.ChildKeyrings.Equals(data2.ChildKeyrings) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateMultiKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateMultiKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateMultiKeyringInput_() _dafny.TypeDescriptor { + return type_CreateMultiKeyringInput_{} +} + +type type_CreateMultiKeyringInput_ struct { +} + +func (_this type_CreateMultiKeyringInput_) Default() interface{} { + return Companion_CreateMultiKeyringInput_.Default() +} + +func (_this type_CreateMultiKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput" +} +func (_this CreateMultiKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateMultiKeyringInput{} + +// End of datatype CreateMultiKeyringInput + +// Definition of datatype CreateRawAesKeyringInput +type CreateRawAesKeyringInput struct { + Data_CreateRawAesKeyringInput_ +} + +func (_this CreateRawAesKeyringInput) Get_() Data_CreateRawAesKeyringInput_ { + return _this.Data_CreateRawAesKeyringInput_ +} + +type Data_CreateRawAesKeyringInput_ interface { + isCreateRawAesKeyringInput() +} + +type CompanionStruct_CreateRawAesKeyringInput_ struct { +} + +var Companion_CreateRawAesKeyringInput_ = CompanionStruct_CreateRawAesKeyringInput_{} + +type CreateRawAesKeyringInput_CreateRawAesKeyringInput struct { + KeyNamespace _dafny.Sequence + KeyName _dafny.Sequence + WrappingKey _dafny.Sequence + WrappingAlg AesWrappingAlg +} + +func (CreateRawAesKeyringInput_CreateRawAesKeyringInput) isCreateRawAesKeyringInput() {} + +func (CompanionStruct_CreateRawAesKeyringInput_) Create_CreateRawAesKeyringInput_(KeyNamespace _dafny.Sequence, KeyName _dafny.Sequence, WrappingKey _dafny.Sequence, WrappingAlg AesWrappingAlg) CreateRawAesKeyringInput { + return CreateRawAesKeyringInput{CreateRawAesKeyringInput_CreateRawAesKeyringInput{KeyNamespace, KeyName, WrappingKey, WrappingAlg}} +} + +func (_this CreateRawAesKeyringInput) Is_CreateRawAesKeyringInput() bool { + _, ok := _this.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput) + return ok +} + +func (CompanionStruct_CreateRawAesKeyringInput_) Default() CreateRawAesKeyringInput { + return Companion_CreateRawAesKeyringInput_.Create_CreateRawAesKeyringInput_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), _dafny.EmptySeq, Companion_AesWrappingAlg_.Default()) +} + +func (_this CreateRawAesKeyringInput) Dtor_keyNamespace() _dafny.Sequence { + return _this.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput).KeyNamespace +} + +func (_this CreateRawAesKeyringInput) Dtor_keyName() _dafny.Sequence { + return _this.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput).KeyName +} + +func (_this CreateRawAesKeyringInput) Dtor_wrappingKey() _dafny.Sequence { + return _this.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput).WrappingKey +} + +func (_this CreateRawAesKeyringInput) Dtor_wrappingAlg() AesWrappingAlg { + return _this.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput).WrappingAlg +} + +func (_this CreateRawAesKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateRawAesKeyringInput_CreateRawAesKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput.CreateRawAesKeyringInput" + "(" + _dafny.String(data.KeyNamespace) + ", " + _dafny.String(data.KeyName) + ", " + _dafny.String(data.WrappingKey) + ", " + _dafny.String(data.WrappingAlg) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateRawAesKeyringInput) Equals(other CreateRawAesKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateRawAesKeyringInput_CreateRawAesKeyringInput: + { + data2, ok := other.Get_().(CreateRawAesKeyringInput_CreateRawAesKeyringInput) + return ok && data1.KeyNamespace.Equals(data2.KeyNamespace) && data1.KeyName.Equals(data2.KeyName) && data1.WrappingKey.Equals(data2.WrappingKey) && data1.WrappingAlg.Equals(data2.WrappingAlg) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateRawAesKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateRawAesKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateRawAesKeyringInput_() _dafny.TypeDescriptor { + return type_CreateRawAesKeyringInput_{} +} + +type type_CreateRawAesKeyringInput_ struct { +} + +func (_this type_CreateRawAesKeyringInput_) Default() interface{} { + return Companion_CreateRawAesKeyringInput_.Default() +} + +func (_this type_CreateRawAesKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput" +} +func (_this CreateRawAesKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateRawAesKeyringInput{} + +// End of datatype CreateRawAesKeyringInput + +// Definition of datatype CreateRawEcdhKeyringInput +type CreateRawEcdhKeyringInput struct { + Data_CreateRawEcdhKeyringInput_ +} + +func (_this CreateRawEcdhKeyringInput) Get_() Data_CreateRawEcdhKeyringInput_ { + return _this.Data_CreateRawEcdhKeyringInput_ +} + +type Data_CreateRawEcdhKeyringInput_ interface { + isCreateRawEcdhKeyringInput() +} + +type CompanionStruct_CreateRawEcdhKeyringInput_ struct { +} + +var Companion_CreateRawEcdhKeyringInput_ = CompanionStruct_CreateRawEcdhKeyringInput_{} + +type CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput struct { + KeyAgreementScheme RawEcdhStaticConfigurations + CurveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec +} + +func (CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput) isCreateRawEcdhKeyringInput() {} + +func (CompanionStruct_CreateRawEcdhKeyringInput_) Create_CreateRawEcdhKeyringInput_(KeyAgreementScheme RawEcdhStaticConfigurations, CurveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec) CreateRawEcdhKeyringInput { + return CreateRawEcdhKeyringInput{CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput{KeyAgreementScheme, CurveSpec}} +} + +func (_this CreateRawEcdhKeyringInput) Is_CreateRawEcdhKeyringInput() bool { + _, ok := _this.Get_().(CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput) + return ok +} + +func (CompanionStruct_CreateRawEcdhKeyringInput_) Default() CreateRawEcdhKeyringInput { + return Companion_CreateRawEcdhKeyringInput_.Create_CreateRawEcdhKeyringInput_(Companion_RawEcdhStaticConfigurations_.Default(), m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default()) +} + +func (_this CreateRawEcdhKeyringInput) Dtor_KeyAgreementScheme() RawEcdhStaticConfigurations { + return _this.Get_().(CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput).KeyAgreementScheme +} + +func (_this CreateRawEcdhKeyringInput) Dtor_curveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + return _this.Get_().(CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput).CurveSpec +} + +func (_this CreateRawEcdhKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput.CreateRawEcdhKeyringInput" + "(" + _dafny.String(data.KeyAgreementScheme) + ", " + _dafny.String(data.CurveSpec) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateRawEcdhKeyringInput) Equals(other CreateRawEcdhKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput: + { + data2, ok := other.Get_().(CreateRawEcdhKeyringInput_CreateRawEcdhKeyringInput) + return ok && data1.KeyAgreementScheme.Equals(data2.KeyAgreementScheme) && data1.CurveSpec.Equals(data2.CurveSpec) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateRawEcdhKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateRawEcdhKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateRawEcdhKeyringInput_() _dafny.TypeDescriptor { + return type_CreateRawEcdhKeyringInput_{} +} + +type type_CreateRawEcdhKeyringInput_ struct { +} + +func (_this type_CreateRawEcdhKeyringInput_) Default() interface{} { + return Companion_CreateRawEcdhKeyringInput_.Default() +} + +func (_this type_CreateRawEcdhKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput" +} +func (_this CreateRawEcdhKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateRawEcdhKeyringInput{} + +// End of datatype CreateRawEcdhKeyringInput + +// Definition of datatype CreateRawRsaKeyringInput +type CreateRawRsaKeyringInput struct { + Data_CreateRawRsaKeyringInput_ +} + +func (_this CreateRawRsaKeyringInput) Get_() Data_CreateRawRsaKeyringInput_ { + return _this.Data_CreateRawRsaKeyringInput_ +} + +type Data_CreateRawRsaKeyringInput_ interface { + isCreateRawRsaKeyringInput() +} + +type CompanionStruct_CreateRawRsaKeyringInput_ struct { +} + +var Companion_CreateRawRsaKeyringInput_ = CompanionStruct_CreateRawRsaKeyringInput_{} + +type CreateRawRsaKeyringInput_CreateRawRsaKeyringInput struct { + KeyNamespace _dafny.Sequence + KeyName _dafny.Sequence + PaddingScheme PaddingScheme + PublicKey m_Wrappers.Option + PrivateKey m_Wrappers.Option +} + +func (CreateRawRsaKeyringInput_CreateRawRsaKeyringInput) isCreateRawRsaKeyringInput() {} + +func (CompanionStruct_CreateRawRsaKeyringInput_) Create_CreateRawRsaKeyringInput_(KeyNamespace _dafny.Sequence, KeyName _dafny.Sequence, PaddingScheme PaddingScheme, PublicKey m_Wrappers.Option, PrivateKey m_Wrappers.Option) CreateRawRsaKeyringInput { + return CreateRawRsaKeyringInput{CreateRawRsaKeyringInput_CreateRawRsaKeyringInput{KeyNamespace, KeyName, PaddingScheme, PublicKey, PrivateKey}} +} + +func (_this CreateRawRsaKeyringInput) Is_CreateRawRsaKeyringInput() bool { + _, ok := _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput) + return ok +} + +func (CompanionStruct_CreateRawRsaKeyringInput_) Default() CreateRawRsaKeyringInput { + return Companion_CreateRawRsaKeyringInput_.Create_CreateRawRsaKeyringInput_(_dafny.EmptySeq.SetString(), _dafny.EmptySeq.SetString(), Companion_PaddingScheme_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this CreateRawRsaKeyringInput) Dtor_keyNamespace() _dafny.Sequence { + return _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput).KeyNamespace +} + +func (_this CreateRawRsaKeyringInput) Dtor_keyName() _dafny.Sequence { + return _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput).KeyName +} + +func (_this CreateRawRsaKeyringInput) Dtor_paddingScheme() PaddingScheme { + return _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput).PaddingScheme +} + +func (_this CreateRawRsaKeyringInput) Dtor_publicKey() m_Wrappers.Option { + return _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput).PublicKey +} + +func (_this CreateRawRsaKeyringInput) Dtor_privateKey() m_Wrappers.Option { + return _this.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput).PrivateKey +} + +func (_this CreateRawRsaKeyringInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateRawRsaKeyringInput_CreateRawRsaKeyringInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput.CreateRawRsaKeyringInput" + "(" + _dafny.String(data.KeyNamespace) + ", " + _dafny.String(data.KeyName) + ", " + _dafny.String(data.PaddingScheme) + ", " + _dafny.String(data.PublicKey) + ", " + _dafny.String(data.PrivateKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateRawRsaKeyringInput) Equals(other CreateRawRsaKeyringInput) bool { + switch data1 := _this.Get_().(type) { + case CreateRawRsaKeyringInput_CreateRawRsaKeyringInput: + { + data2, ok := other.Get_().(CreateRawRsaKeyringInput_CreateRawRsaKeyringInput) + return ok && data1.KeyNamespace.Equals(data2.KeyNamespace) && data1.KeyName.Equals(data2.KeyName) && data1.PaddingScheme.Equals(data2.PaddingScheme) && data1.PublicKey.Equals(data2.PublicKey) && data1.PrivateKey.Equals(data2.PrivateKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateRawRsaKeyringInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateRawRsaKeyringInput) + return ok && _this.Equals(typed) +} + +func Type_CreateRawRsaKeyringInput_() _dafny.TypeDescriptor { + return type_CreateRawRsaKeyringInput_{} +} + +type type_CreateRawRsaKeyringInput_ struct { +} + +func (_this type_CreateRawRsaKeyringInput_) Default() interface{} { + return Companion_CreateRawRsaKeyringInput_.Default() +} + +func (_this type_CreateRawRsaKeyringInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput" +} +func (_this CreateRawRsaKeyringInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateRawRsaKeyringInput{} + +// End of datatype CreateRawRsaKeyringInput + +// Definition of datatype CreateRequiredEncryptionContextCMMInput +type CreateRequiredEncryptionContextCMMInput struct { + Data_CreateRequiredEncryptionContextCMMInput_ +} + +func (_this CreateRequiredEncryptionContextCMMInput) Get_() Data_CreateRequiredEncryptionContextCMMInput_ { + return _this.Data_CreateRequiredEncryptionContextCMMInput_ +} + +type Data_CreateRequiredEncryptionContextCMMInput_ interface { + isCreateRequiredEncryptionContextCMMInput() +} + +type CompanionStruct_CreateRequiredEncryptionContextCMMInput_ struct { +} + +var Companion_CreateRequiredEncryptionContextCMMInput_ = CompanionStruct_CreateRequiredEncryptionContextCMMInput_{} + +type CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput struct { + UnderlyingCMM m_Wrappers.Option + Keyring m_Wrappers.Option + RequiredEncryptionContextKeys _dafny.Sequence +} + +func (CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput) isCreateRequiredEncryptionContextCMMInput() { +} + +func (CompanionStruct_CreateRequiredEncryptionContextCMMInput_) Create_CreateRequiredEncryptionContextCMMInput_(UnderlyingCMM m_Wrappers.Option, Keyring m_Wrappers.Option, RequiredEncryptionContextKeys _dafny.Sequence) CreateRequiredEncryptionContextCMMInput { + return CreateRequiredEncryptionContextCMMInput{CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput{UnderlyingCMM, Keyring, RequiredEncryptionContextKeys}} +} + +func (_this CreateRequiredEncryptionContextCMMInput) Is_CreateRequiredEncryptionContextCMMInput() bool { + _, ok := _this.Get_().(CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput) + return ok +} + +func (CompanionStruct_CreateRequiredEncryptionContextCMMInput_) Default() CreateRequiredEncryptionContextCMMInput { + return Companion_CreateRequiredEncryptionContextCMMInput_.Create_CreateRequiredEncryptionContextCMMInput_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), _dafny.EmptySeq) +} + +func (_this CreateRequiredEncryptionContextCMMInput) Dtor_underlyingCMM() m_Wrappers.Option { + return _this.Get_().(CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput).UnderlyingCMM +} + +func (_this CreateRequiredEncryptionContextCMMInput) Dtor_keyring() m_Wrappers.Option { + return _this.Get_().(CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput).Keyring +} + +func (_this CreateRequiredEncryptionContextCMMInput) Dtor_requiredEncryptionContextKeys() _dafny.Sequence { + return _this.Get_().(CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput).RequiredEncryptionContextKeys +} + +func (_this CreateRequiredEncryptionContextCMMInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput: + { + return "AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput.CreateRequiredEncryptionContextCMMInput" + "(" + _dafny.String(data.UnderlyingCMM) + ", " + _dafny.String(data.Keyring) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this CreateRequiredEncryptionContextCMMInput) Equals(other CreateRequiredEncryptionContextCMMInput) bool { + switch data1 := _this.Get_().(type) { + case CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput: + { + data2, ok := other.Get_().(CreateRequiredEncryptionContextCMMInput_CreateRequiredEncryptionContextCMMInput) + return ok && data1.UnderlyingCMM.Equals(data2.UnderlyingCMM) && data1.Keyring.Equals(data2.Keyring) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateRequiredEncryptionContextCMMInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateRequiredEncryptionContextCMMInput) + return ok && _this.Equals(typed) +} + +func Type_CreateRequiredEncryptionContextCMMInput_() _dafny.TypeDescriptor { + return type_CreateRequiredEncryptionContextCMMInput_{} +} + +type type_CreateRequiredEncryptionContextCMMInput_ struct { +} + +func (_this type_CreateRequiredEncryptionContextCMMInput_) Default() interface{} { + return Companion_CreateRequiredEncryptionContextCMMInput_.Default() +} + +func (_this type_CreateRequiredEncryptionContextCMMInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput" +} +func (_this CreateRequiredEncryptionContextCMMInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateRequiredEncryptionContextCMMInput{} + +// End of datatype CreateRequiredEncryptionContextCMMInput + +// Definition of class ICryptographicMaterialsCacheCallHistory +type ICryptographicMaterialsCacheCallHistory struct { + dummy byte +} + +func New_ICryptographicMaterialsCacheCallHistory_() *ICryptographicMaterialsCacheCallHistory { + _this := ICryptographicMaterialsCacheCallHistory{} + + return &_this +} + +type CompanionStruct_ICryptographicMaterialsCacheCallHistory_ struct { +} + +var Companion_ICryptographicMaterialsCacheCallHistory_ = CompanionStruct_ICryptographicMaterialsCacheCallHistory_{} + +func (_this *ICryptographicMaterialsCacheCallHistory) Equals(other *ICryptographicMaterialsCacheCallHistory) bool { + return _this == other +} + +func (_this *ICryptographicMaterialsCacheCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*ICryptographicMaterialsCacheCallHistory) + return ok && _this.Equals(other) +} + +func (*ICryptographicMaterialsCacheCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCacheCallHistory" +} + +func Type_ICryptographicMaterialsCacheCallHistory_() _dafny.TypeDescriptor { + return type_ICryptographicMaterialsCacheCallHistory_{} +} + +type type_ICryptographicMaterialsCacheCallHistory_ struct { +} + +func (_this type_ICryptographicMaterialsCacheCallHistory_) Default() interface{} { + return (*ICryptographicMaterialsCacheCallHistory)(nil) +} + +func (_this type_ICryptographicMaterialsCacheCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCacheCallHistory" +} +func (_this *ICryptographicMaterialsCacheCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &ICryptographicMaterialsCacheCallHistory{} + +// End of class ICryptographicMaterialsCacheCallHistory + +// Definition of trait ICryptographicMaterialsCache +type ICryptographicMaterialsCache interface { + String() string + PutCacheEntry(input PutCacheEntryInput) m_Wrappers.Result + PutCacheEntry_k(input PutCacheEntryInput) m_Wrappers.Result + UpdateUsageMetadata(input UpdateUsageMetadataInput) m_Wrappers.Result + UpdateUsageMetadata_k(input UpdateUsageMetadataInput) m_Wrappers.Result + GetCacheEntry(input GetCacheEntryInput) m_Wrappers.Result + GetCacheEntry_k(input GetCacheEntryInput) m_Wrappers.Result + DeleteCacheEntry(input DeleteCacheEntryInput) m_Wrappers.Result + DeleteCacheEntry_k(input DeleteCacheEntryInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_ICryptographicMaterialsCache_) PutCacheEntry(_this ICryptographicMaterialsCache, input PutCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).PutCacheEntry_k(input) + output = _out0 + return output + } +} +func (_static *CompanionStruct_ICryptographicMaterialsCache_) UpdateUsageMetadata(_this ICryptographicMaterialsCache, input UpdateUsageMetadataInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).UpdateUsageMetadata_k(input) + output = _out0 + return output + } +} +func (_static *CompanionStruct_ICryptographicMaterialsCache_) GetCacheEntry(_this ICryptographicMaterialsCache, input GetCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetCacheEntry_k(input) + output = _out0 + return output + } +} +func (_static *CompanionStruct_ICryptographicMaterialsCache_) DeleteCacheEntry(_this ICryptographicMaterialsCache, input DeleteCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).DeleteCacheEntry_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_ICryptographicMaterialsCache_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_ICryptographicMaterialsCache_ = CompanionStruct_ICryptographicMaterialsCache_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_ICryptographicMaterialsCache_) CastTo_(x interface{}) ICryptographicMaterialsCache { + var t ICryptographicMaterialsCache + t, _ = x.(ICryptographicMaterialsCache) + return t +} + +// End of trait ICryptographicMaterialsCache + +// Definition of class ICryptographicMaterialsManagerCallHistory +type ICryptographicMaterialsManagerCallHistory struct { + dummy byte +} + +func New_ICryptographicMaterialsManagerCallHistory_() *ICryptographicMaterialsManagerCallHistory { + _this := ICryptographicMaterialsManagerCallHistory{} + + return &_this +} + +type CompanionStruct_ICryptographicMaterialsManagerCallHistory_ struct { +} + +var Companion_ICryptographicMaterialsManagerCallHistory_ = CompanionStruct_ICryptographicMaterialsManagerCallHistory_{} + +func (_this *ICryptographicMaterialsManagerCallHistory) Equals(other *ICryptographicMaterialsManagerCallHistory) bool { + return _this == other +} + +func (_this *ICryptographicMaterialsManagerCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*ICryptographicMaterialsManagerCallHistory) + return ok && _this.Equals(other) +} + +func (*ICryptographicMaterialsManagerCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManagerCallHistory" +} + +func Type_ICryptographicMaterialsManagerCallHistory_() _dafny.TypeDescriptor { + return type_ICryptographicMaterialsManagerCallHistory_{} +} + +type type_ICryptographicMaterialsManagerCallHistory_ struct { +} + +func (_this type_ICryptographicMaterialsManagerCallHistory_) Default() interface{} { + return (*ICryptographicMaterialsManagerCallHistory)(nil) +} + +func (_this type_ICryptographicMaterialsManagerCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManagerCallHistory" +} +func (_this *ICryptographicMaterialsManagerCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &ICryptographicMaterialsManagerCallHistory{} + +// End of class ICryptographicMaterialsManagerCallHistory + +// Definition of trait ICryptographicMaterialsManager +type ICryptographicMaterialsManager interface { + String() string + GetEncryptionMaterials(input GetEncryptionMaterialsInput) m_Wrappers.Result + GetEncryptionMaterials_k(input GetEncryptionMaterialsInput) m_Wrappers.Result + DecryptMaterials(input DecryptMaterialsInput) m_Wrappers.Result + DecryptMaterials_k(input DecryptMaterialsInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_ICryptographicMaterialsManager_) GetEncryptionMaterials(_this ICryptographicMaterialsManager, input GetEncryptionMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetEncryptionMaterials_k(input) + output = _out0 + return output + } +} +func (_static *CompanionStruct_ICryptographicMaterialsManager_) DecryptMaterials(_this ICryptographicMaterialsManager, input DecryptMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).DecryptMaterials_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_ICryptographicMaterialsManager_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_ICryptographicMaterialsManager_ = CompanionStruct_ICryptographicMaterialsManager_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_ICryptographicMaterialsManager_) CastTo_(x interface{}) ICryptographicMaterialsManager { + var t ICryptographicMaterialsManager + t, _ = x.(ICryptographicMaterialsManager) + return t +} + +// End of trait ICryptographicMaterialsManager + +// Definition of datatype DBEAlgorithmSuiteId +type DBEAlgorithmSuiteId struct { + Data_DBEAlgorithmSuiteId_ +} + +func (_this DBEAlgorithmSuiteId) Get_() Data_DBEAlgorithmSuiteId_ { + return _this.Data_DBEAlgorithmSuiteId_ +} + +type Data_DBEAlgorithmSuiteId_ interface { + isDBEAlgorithmSuiteId() +} + +type CompanionStruct_DBEAlgorithmSuiteId_ struct { +} + +var Companion_DBEAlgorithmSuiteId_ = CompanionStruct_DBEAlgorithmSuiteId_{} + +type DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384 struct { +} + +func (DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384) isDBEAlgorithmSuiteId() { +} + +func (CompanionStruct_DBEAlgorithmSuiteId_) Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384_() DBEAlgorithmSuiteId { + return DBEAlgorithmSuiteId{DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384{}} +} + +func (_this DBEAlgorithmSuiteId) Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384() bool { + _, ok := _this.Get_().(DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384) + return ok +} + +type DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384 struct { +} + +func (DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384) isDBEAlgorithmSuiteId() { +} + +func (CompanionStruct_DBEAlgorithmSuiteId_) Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384_() DBEAlgorithmSuiteId { + return DBEAlgorithmSuiteId{DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384{}} +} + +func (_this DBEAlgorithmSuiteId) Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384() bool { + _, ok := _this.Get_().(DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384) + return ok +} + +func (CompanionStruct_DBEAlgorithmSuiteId_) Default() DBEAlgorithmSuiteId { + return Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384_() +} + +func (_ CompanionStruct_DBEAlgorithmSuiteId_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384_(), true + case 1: + return Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384_(), true + default: + return DBEAlgorithmSuiteId{}, false + } + } +} + +func (_this DBEAlgorithmSuiteId) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384: + { + return "AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384" + } + case DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384: + { + return "AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384" + } + default: + { + return "" + } + } +} + +func (_this DBEAlgorithmSuiteId) Equals(other DBEAlgorithmSuiteId) bool { + switch _this.Get_().(type) { + case DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384: + { + _, ok := other.Get_().(DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__SYMSIG__HMAC__SHA384) + return ok + } + case DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384: + { + _, ok := other.Get_().(DBEAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this DBEAlgorithmSuiteId) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DBEAlgorithmSuiteId) + return ok && _this.Equals(typed) +} + +func Type_DBEAlgorithmSuiteId_() _dafny.TypeDescriptor { + return type_DBEAlgorithmSuiteId_{} +} + +type type_DBEAlgorithmSuiteId_ struct { +} + +func (_this type_DBEAlgorithmSuiteId_) Default() interface{} { + return Companion_DBEAlgorithmSuiteId_.Default() +} + +func (_this type_DBEAlgorithmSuiteId_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId" +} +func (_this DBEAlgorithmSuiteId) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DBEAlgorithmSuiteId{} + +// End of datatype DBEAlgorithmSuiteId + +// Definition of datatype DBECommitmentPolicy +type DBECommitmentPolicy struct { + Data_DBECommitmentPolicy_ +} + +func (_this DBECommitmentPolicy) Get_() Data_DBECommitmentPolicy_ { + return _this.Data_DBECommitmentPolicy_ +} + +type Data_DBECommitmentPolicy_ interface { + isDBECommitmentPolicy() +} + +type CompanionStruct_DBECommitmentPolicy_ struct { +} + +var Companion_DBECommitmentPolicy_ = CompanionStruct_DBECommitmentPolicy_{} + +type DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT struct { +} + +func (DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) isDBECommitmentPolicy() {} + +func (CompanionStruct_DBECommitmentPolicy_) Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_() DBECommitmentPolicy { + return DBECommitmentPolicy{DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT{}} +} + +func (_this DBECommitmentPolicy) Is_REQUIRE__ENCRYPT__REQUIRE__DECRYPT() bool { + _, ok := _this.Get_().(DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) + return ok +} + +func (CompanionStruct_DBECommitmentPolicy_) Default() DBECommitmentPolicy { + return Companion_DBECommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_() +} + +func (_ CompanionStruct_DBECommitmentPolicy_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_DBECommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_(), true + default: + return DBECommitmentPolicy{}, false + } + } +} + +func (_this DBECommitmentPolicy) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT: + { + return "AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT" + } + default: + { + return "" + } + } +} + +func (_this DBECommitmentPolicy) Equals(other DBECommitmentPolicy) bool { + switch _this.Get_().(type) { + case DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT: + { + _, ok := other.Get_().(DBECommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this DBECommitmentPolicy) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DBECommitmentPolicy) + return ok && _this.Equals(typed) +} + +func Type_DBECommitmentPolicy_() _dafny.TypeDescriptor { + return type_DBECommitmentPolicy_{} +} + +type type_DBECommitmentPolicy_ struct { +} + +func (_this type_DBECommitmentPolicy_) Default() interface{} { + return Companion_DBECommitmentPolicy_.Default() +} + +func (_this type_DBECommitmentPolicy_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy" +} +func (_this DBECommitmentPolicy) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DBECommitmentPolicy{} + +// End of datatype DBECommitmentPolicy + +// Definition of datatype DecryptionMaterials +type DecryptionMaterials struct { + Data_DecryptionMaterials_ +} + +func (_this DecryptionMaterials) Get_() Data_DecryptionMaterials_ { + return _this.Data_DecryptionMaterials_ +} + +type Data_DecryptionMaterials_ interface { + isDecryptionMaterials() +} + +type CompanionStruct_DecryptionMaterials_ struct { +} + +var Companion_DecryptionMaterials_ = CompanionStruct_DecryptionMaterials_{} + +type DecryptionMaterials_DecryptionMaterials struct { + AlgorithmSuite AlgorithmSuiteInfo + EncryptionContext _dafny.Map + RequiredEncryptionContextKeys _dafny.Sequence + PlaintextDataKey m_Wrappers.Option + VerificationKey m_Wrappers.Option + SymmetricSigningKey m_Wrappers.Option +} + +func (DecryptionMaterials_DecryptionMaterials) isDecryptionMaterials() {} + +func (CompanionStruct_DecryptionMaterials_) Create_DecryptionMaterials_(AlgorithmSuite AlgorithmSuiteInfo, EncryptionContext _dafny.Map, RequiredEncryptionContextKeys _dafny.Sequence, PlaintextDataKey m_Wrappers.Option, VerificationKey m_Wrappers.Option, SymmetricSigningKey m_Wrappers.Option) DecryptionMaterials { + return DecryptionMaterials{DecryptionMaterials_DecryptionMaterials{AlgorithmSuite, EncryptionContext, RequiredEncryptionContextKeys, PlaintextDataKey, VerificationKey, SymmetricSigningKey}} +} + +func (_this DecryptionMaterials) Is_DecryptionMaterials() bool { + _, ok := _this.Get_().(DecryptionMaterials_DecryptionMaterials) + return ok +} + +func (CompanionStruct_DecryptionMaterials_) Default() DecryptionMaterials { + return Companion_DecryptionMaterials_.Create_DecryptionMaterials_(Companion_AlgorithmSuiteInfo_.Default(), _dafny.EmptyMap, _dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this DecryptionMaterials) Dtor_algorithmSuite() AlgorithmSuiteInfo { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).AlgorithmSuite +} + +func (_this DecryptionMaterials) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).EncryptionContext +} + +func (_this DecryptionMaterials) Dtor_requiredEncryptionContextKeys() _dafny.Sequence { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).RequiredEncryptionContextKeys +} + +func (_this DecryptionMaterials) Dtor_plaintextDataKey() m_Wrappers.Option { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).PlaintextDataKey +} + +func (_this DecryptionMaterials) Dtor_verificationKey() m_Wrappers.Option { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).VerificationKey +} + +func (_this DecryptionMaterials) Dtor_symmetricSigningKey() m_Wrappers.Option { + return _this.Get_().(DecryptionMaterials_DecryptionMaterials).SymmetricSigningKey +} + +func (_this DecryptionMaterials) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DecryptionMaterials_DecryptionMaterials: + { + return "AwsCryptographyMaterialProvidersTypes.DecryptionMaterials.DecryptionMaterials" + "(" + _dafny.String(data.AlgorithmSuite) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ", " + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.VerificationKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this DecryptionMaterials) Equals(other DecryptionMaterials) bool { + switch data1 := _this.Get_().(type) { + case DecryptionMaterials_DecryptionMaterials: + { + data2, ok := other.Get_().(DecryptionMaterials_DecryptionMaterials) + return ok && data1.AlgorithmSuite.Equals(data2.AlgorithmSuite) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.VerificationKey.Equals(data2.VerificationKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this DecryptionMaterials) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DecryptionMaterials) + return ok && _this.Equals(typed) +} + +func Type_DecryptionMaterials_() _dafny.TypeDescriptor { + return type_DecryptionMaterials_{} +} + +type type_DecryptionMaterials_ struct { +} + +func (_this type_DecryptionMaterials_) Default() interface{} { + return Companion_DecryptionMaterials_.Default() +} + +func (_this type_DecryptionMaterials_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DecryptionMaterials" +} +func (_this DecryptionMaterials) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DecryptionMaterials{} + +// End of datatype DecryptionMaterials + +// Definition of datatype DecryptMaterialsInput +type DecryptMaterialsInput struct { + Data_DecryptMaterialsInput_ +} + +func (_this DecryptMaterialsInput) Get_() Data_DecryptMaterialsInput_ { + return _this.Data_DecryptMaterialsInput_ +} + +type Data_DecryptMaterialsInput_ interface { + isDecryptMaterialsInput() +} + +type CompanionStruct_DecryptMaterialsInput_ struct { +} + +var Companion_DecryptMaterialsInput_ = CompanionStruct_DecryptMaterialsInput_{} + +type DecryptMaterialsInput_DecryptMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + CommitmentPolicy CommitmentPolicy + EncryptedDataKeys _dafny.Sequence + EncryptionContext _dafny.Map + ReproducedEncryptionContext m_Wrappers.Option +} + +func (DecryptMaterialsInput_DecryptMaterialsInput) isDecryptMaterialsInput() {} + +func (CompanionStruct_DecryptMaterialsInput_) Create_DecryptMaterialsInput_(AlgorithmSuiteId AlgorithmSuiteId, CommitmentPolicy CommitmentPolicy, EncryptedDataKeys _dafny.Sequence, EncryptionContext _dafny.Map, ReproducedEncryptionContext m_Wrappers.Option) DecryptMaterialsInput { + return DecryptMaterialsInput{DecryptMaterialsInput_DecryptMaterialsInput{AlgorithmSuiteId, CommitmentPolicy, EncryptedDataKeys, EncryptionContext, ReproducedEncryptionContext}} +} + +func (_this DecryptMaterialsInput) Is_DecryptMaterialsInput() bool { + _, ok := _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput) + return ok +} + +func (CompanionStruct_DecryptMaterialsInput_) Default() DecryptMaterialsInput { + return Companion_DecryptMaterialsInput_.Create_DecryptMaterialsInput_(Companion_AlgorithmSuiteId_.Default(), Companion_CommitmentPolicy_.Default(), _dafny.EmptySeq, _dafny.EmptyMap, m_Wrappers.Companion_Option_.Default()) +} + +func (_this DecryptMaterialsInput) Dtor_algorithmSuiteId() AlgorithmSuiteId { + return _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput).AlgorithmSuiteId +} + +func (_this DecryptMaterialsInput) Dtor_commitmentPolicy() CommitmentPolicy { + return _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput).CommitmentPolicy +} + +func (_this DecryptMaterialsInput) Dtor_encryptedDataKeys() _dafny.Sequence { + return _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput).EncryptedDataKeys +} + +func (_this DecryptMaterialsInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput).EncryptionContext +} + +func (_this DecryptMaterialsInput) Dtor_reproducedEncryptionContext() m_Wrappers.Option { + return _this.Get_().(DecryptMaterialsInput_DecryptMaterialsInput).ReproducedEncryptionContext +} + +func (_this DecryptMaterialsInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DecryptMaterialsInput_DecryptMaterialsInput: + { + return "AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput.DecryptMaterialsInput" + "(" + _dafny.String(data.AlgorithmSuiteId) + ", " + _dafny.String(data.CommitmentPolicy) + ", " + _dafny.String(data.EncryptedDataKeys) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.ReproducedEncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this DecryptMaterialsInput) Equals(other DecryptMaterialsInput) bool { + switch data1 := _this.Get_().(type) { + case DecryptMaterialsInput_DecryptMaterialsInput: + { + data2, ok := other.Get_().(DecryptMaterialsInput_DecryptMaterialsInput) + return ok && data1.AlgorithmSuiteId.Equals(data2.AlgorithmSuiteId) && data1.CommitmentPolicy.Equals(data2.CommitmentPolicy) && data1.EncryptedDataKeys.Equals(data2.EncryptedDataKeys) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.ReproducedEncryptionContext.Equals(data2.ReproducedEncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this DecryptMaterialsInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DecryptMaterialsInput) + return ok && _this.Equals(typed) +} + +func Type_DecryptMaterialsInput_() _dafny.TypeDescriptor { + return type_DecryptMaterialsInput_{} +} + +type type_DecryptMaterialsInput_ struct { +} + +func (_this type_DecryptMaterialsInput_) Default() interface{} { + return Companion_DecryptMaterialsInput_.Default() +} + +func (_this type_DecryptMaterialsInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput" +} +func (_this DecryptMaterialsInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DecryptMaterialsInput{} + +// End of datatype DecryptMaterialsInput + +// Definition of datatype DecryptMaterialsOutput +type DecryptMaterialsOutput struct { + Data_DecryptMaterialsOutput_ +} + +func (_this DecryptMaterialsOutput) Get_() Data_DecryptMaterialsOutput_ { + return _this.Data_DecryptMaterialsOutput_ +} + +type Data_DecryptMaterialsOutput_ interface { + isDecryptMaterialsOutput() +} + +type CompanionStruct_DecryptMaterialsOutput_ struct { +} + +var Companion_DecryptMaterialsOutput_ = CompanionStruct_DecryptMaterialsOutput_{} + +type DecryptMaterialsOutput_DecryptMaterialsOutput struct { + DecryptionMaterials DecryptionMaterials +} + +func (DecryptMaterialsOutput_DecryptMaterialsOutput) isDecryptMaterialsOutput() {} + +func (CompanionStruct_DecryptMaterialsOutput_) Create_DecryptMaterialsOutput_(DecryptionMaterials DecryptionMaterials) DecryptMaterialsOutput { + return DecryptMaterialsOutput{DecryptMaterialsOutput_DecryptMaterialsOutput{DecryptionMaterials}} +} + +func (_this DecryptMaterialsOutput) Is_DecryptMaterialsOutput() bool { + _, ok := _this.Get_().(DecryptMaterialsOutput_DecryptMaterialsOutput) + return ok +} + +func (CompanionStruct_DecryptMaterialsOutput_) Default() DecryptMaterialsOutput { + return Companion_DecryptMaterialsOutput_.Create_DecryptMaterialsOutput_(Companion_DecryptionMaterials_.Default()) +} + +func (_this DecryptMaterialsOutput) Dtor_decryptionMaterials() DecryptionMaterials { + return _this.Get_().(DecryptMaterialsOutput_DecryptMaterialsOutput).DecryptionMaterials +} + +func (_this DecryptMaterialsOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DecryptMaterialsOutput_DecryptMaterialsOutput: + { + return "AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput.DecryptMaterialsOutput" + "(" + _dafny.String(data.DecryptionMaterials) + ")" + } + default: + { + return "" + } + } +} + +func (_this DecryptMaterialsOutput) Equals(other DecryptMaterialsOutput) bool { + switch data1 := _this.Get_().(type) { + case DecryptMaterialsOutput_DecryptMaterialsOutput: + { + data2, ok := other.Get_().(DecryptMaterialsOutput_DecryptMaterialsOutput) + return ok && data1.DecryptionMaterials.Equals(data2.DecryptionMaterials) + } + default: + { + return false // unexpected + } + } +} + +func (_this DecryptMaterialsOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DecryptMaterialsOutput) + return ok && _this.Equals(typed) +} + +func Type_DecryptMaterialsOutput_() _dafny.TypeDescriptor { + return type_DecryptMaterialsOutput_{} +} + +type type_DecryptMaterialsOutput_ struct { +} + +func (_this type_DecryptMaterialsOutput_) Default() interface{} { + return Companion_DecryptMaterialsOutput_.Default() +} + +func (_this type_DecryptMaterialsOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput" +} +func (_this DecryptMaterialsOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DecryptMaterialsOutput{} + +// End of datatype DecryptMaterialsOutput + +// Definition of datatype DefaultCache +type DefaultCache struct { + Data_DefaultCache_ +} + +func (_this DefaultCache) Get_() Data_DefaultCache_ { + return _this.Data_DefaultCache_ +} + +type Data_DefaultCache_ interface { + isDefaultCache() +} + +type CompanionStruct_DefaultCache_ struct { +} + +var Companion_DefaultCache_ = CompanionStruct_DefaultCache_{} + +type DefaultCache_DefaultCache struct { + EntryCapacity int32 +} + +func (DefaultCache_DefaultCache) isDefaultCache() {} + +func (CompanionStruct_DefaultCache_) Create_DefaultCache_(EntryCapacity int32) DefaultCache { + return DefaultCache{DefaultCache_DefaultCache{EntryCapacity}} +} + +func (_this DefaultCache) Is_DefaultCache() bool { + _, ok := _this.Get_().(DefaultCache_DefaultCache) + return ok +} + +func (CompanionStruct_DefaultCache_) Default() DefaultCache { + return Companion_DefaultCache_.Create_DefaultCache_(int32(0)) +} + +func (_this DefaultCache) Dtor_entryCapacity() int32 { + return _this.Get_().(DefaultCache_DefaultCache).EntryCapacity +} + +func (_this DefaultCache) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DefaultCache_DefaultCache: + { + return "AwsCryptographyMaterialProvidersTypes.DefaultCache.DefaultCache" + "(" + _dafny.String(data.EntryCapacity) + ")" + } + default: + { + return "" + } + } +} + +func (_this DefaultCache) Equals(other DefaultCache) bool { + switch data1 := _this.Get_().(type) { + case DefaultCache_DefaultCache: + { + data2, ok := other.Get_().(DefaultCache_DefaultCache) + return ok && data1.EntryCapacity == data2.EntryCapacity + } + default: + { + return false // unexpected + } + } +} + +func (_this DefaultCache) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DefaultCache) + return ok && _this.Equals(typed) +} + +func Type_DefaultCache_() _dafny.TypeDescriptor { + return type_DefaultCache_{} +} + +type type_DefaultCache_ struct { +} + +func (_this type_DefaultCache_) Default() interface{} { + return Companion_DefaultCache_.Default() +} + +func (_this type_DefaultCache_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DefaultCache" +} +func (_this DefaultCache) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DefaultCache{} + +// End of datatype DefaultCache + +// Definition of datatype DeleteCacheEntryInput +type DeleteCacheEntryInput struct { + Data_DeleteCacheEntryInput_ +} + +func (_this DeleteCacheEntryInput) Get_() Data_DeleteCacheEntryInput_ { + return _this.Data_DeleteCacheEntryInput_ +} + +type Data_DeleteCacheEntryInput_ interface { + isDeleteCacheEntryInput() +} + +type CompanionStruct_DeleteCacheEntryInput_ struct { +} + +var Companion_DeleteCacheEntryInput_ = CompanionStruct_DeleteCacheEntryInput_{} + +type DeleteCacheEntryInput_DeleteCacheEntryInput struct { + Identifier _dafny.Sequence +} + +func (DeleteCacheEntryInput_DeleteCacheEntryInput) isDeleteCacheEntryInput() {} + +func (CompanionStruct_DeleteCacheEntryInput_) Create_DeleteCacheEntryInput_(Identifier _dafny.Sequence) DeleteCacheEntryInput { + return DeleteCacheEntryInput{DeleteCacheEntryInput_DeleteCacheEntryInput{Identifier}} +} + +func (_this DeleteCacheEntryInput) Is_DeleteCacheEntryInput() bool { + _, ok := _this.Get_().(DeleteCacheEntryInput_DeleteCacheEntryInput) + return ok +} + +func (CompanionStruct_DeleteCacheEntryInput_) Default() DeleteCacheEntryInput { + return Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_(_dafny.EmptySeq) +} + +func (_this DeleteCacheEntryInput) Dtor_identifier() _dafny.Sequence { + return _this.Get_().(DeleteCacheEntryInput_DeleteCacheEntryInput).Identifier +} + +func (_this DeleteCacheEntryInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DeleteCacheEntryInput_DeleteCacheEntryInput: + { + return "AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput.DeleteCacheEntryInput" + "(" + _dafny.String(data.Identifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this DeleteCacheEntryInput) Equals(other DeleteCacheEntryInput) bool { + switch data1 := _this.Get_().(type) { + case DeleteCacheEntryInput_DeleteCacheEntryInput: + { + data2, ok := other.Get_().(DeleteCacheEntryInput_DeleteCacheEntryInput) + return ok && data1.Identifier.Equals(data2.Identifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this DeleteCacheEntryInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DeleteCacheEntryInput) + return ok && _this.Equals(typed) +} + +func Type_DeleteCacheEntryInput_() _dafny.TypeDescriptor { + return type_DeleteCacheEntryInput_{} +} + +type type_DeleteCacheEntryInput_ struct { +} + +func (_this type_DeleteCacheEntryInput_) Default() interface{} { + return Companion_DeleteCacheEntryInput_.Default() +} + +func (_this type_DeleteCacheEntryInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput" +} +func (_this DeleteCacheEntryInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DeleteCacheEntryInput{} + +// End of datatype DeleteCacheEntryInput + +// Definition of datatype DerivationAlgorithm +type DerivationAlgorithm struct { + Data_DerivationAlgorithm_ +} + +func (_this DerivationAlgorithm) Get_() Data_DerivationAlgorithm_ { + return _this.Data_DerivationAlgorithm_ +} + +type Data_DerivationAlgorithm_ interface { + isDerivationAlgorithm() +} + +type CompanionStruct_DerivationAlgorithm_ struct { +} + +var Companion_DerivationAlgorithm_ = CompanionStruct_DerivationAlgorithm_{} + +type DerivationAlgorithm_HKDF struct { + HKDF HKDF +} + +func (DerivationAlgorithm_HKDF) isDerivationAlgorithm() {} + +func (CompanionStruct_DerivationAlgorithm_) Create_HKDF_(HKDF HKDF) DerivationAlgorithm { + return DerivationAlgorithm{DerivationAlgorithm_HKDF{HKDF}} +} + +func (_this DerivationAlgorithm) Is_HKDF() bool { + _, ok := _this.Get_().(DerivationAlgorithm_HKDF) + return ok +} + +type DerivationAlgorithm_IDENTITY struct { + IDENTITY IDENTITY +} + +func (DerivationAlgorithm_IDENTITY) isDerivationAlgorithm() {} + +func (CompanionStruct_DerivationAlgorithm_) Create_IDENTITY_(IDENTITY IDENTITY) DerivationAlgorithm { + return DerivationAlgorithm{DerivationAlgorithm_IDENTITY{IDENTITY}} +} + +func (_this DerivationAlgorithm) Is_IDENTITY() bool { + _, ok := _this.Get_().(DerivationAlgorithm_IDENTITY) + return ok +} + +type DerivationAlgorithm_None struct { + None None +} + +func (DerivationAlgorithm_None) isDerivationAlgorithm() {} + +func (CompanionStruct_DerivationAlgorithm_) Create_None_(None None) DerivationAlgorithm { + return DerivationAlgorithm{DerivationAlgorithm_None{None}} +} + +func (_this DerivationAlgorithm) Is_None() bool { + _, ok := _this.Get_().(DerivationAlgorithm_None) + return ok +} + +func (CompanionStruct_DerivationAlgorithm_) Default() DerivationAlgorithm { + return Companion_DerivationAlgorithm_.Create_HKDF_(Companion_HKDF_.Default()) +} + +func (_this DerivationAlgorithm) Dtor_HKDF() HKDF { + return _this.Get_().(DerivationAlgorithm_HKDF).HKDF +} + +func (_this DerivationAlgorithm) Dtor_IDENTITY() IDENTITY { + return _this.Get_().(DerivationAlgorithm_IDENTITY).IDENTITY +} + +func (_this DerivationAlgorithm) Dtor_None() None { + return _this.Get_().(DerivationAlgorithm_None).None +} + +func (_this DerivationAlgorithm) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DerivationAlgorithm_HKDF: + { + return "AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm.HKDF" + "(" + _dafny.String(data.HKDF) + ")" + } + case DerivationAlgorithm_IDENTITY: + { + return "AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm.IDENTITY" + "(" + _dafny.String(data.IDENTITY) + ")" + } + case DerivationAlgorithm_None: + { + return "AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm.None" + "(" + _dafny.String(data.None) + ")" + } + default: + { + return "" + } + } +} + +func (_this DerivationAlgorithm) Equals(other DerivationAlgorithm) bool { + switch data1 := _this.Get_().(type) { + case DerivationAlgorithm_HKDF: + { + data2, ok := other.Get_().(DerivationAlgorithm_HKDF) + return ok && data1.HKDF.Equals(data2.HKDF) + } + case DerivationAlgorithm_IDENTITY: + { + data2, ok := other.Get_().(DerivationAlgorithm_IDENTITY) + return ok && data1.IDENTITY.Equals(data2.IDENTITY) + } + case DerivationAlgorithm_None: + { + data2, ok := other.Get_().(DerivationAlgorithm_None) + return ok && data1.None.Equals(data2.None) + } + default: + { + return false // unexpected + } + } +} + +func (_this DerivationAlgorithm) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DerivationAlgorithm) + return ok && _this.Equals(typed) +} + +func Type_DerivationAlgorithm_() _dafny.TypeDescriptor { + return type_DerivationAlgorithm_{} +} + +type type_DerivationAlgorithm_ struct { +} + +func (_this type_DerivationAlgorithm_) Default() interface{} { + return Companion_DerivationAlgorithm_.Default() +} + +func (_this type_DerivationAlgorithm_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm" +} +func (_this DerivationAlgorithm) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DerivationAlgorithm{} + +// End of datatype DerivationAlgorithm + +// Definition of datatype DIRECT__KEY__WRAPPING +type DIRECT__KEY__WRAPPING struct { + Data_DIRECT__KEY__WRAPPING_ +} + +func (_this DIRECT__KEY__WRAPPING) Get_() Data_DIRECT__KEY__WRAPPING_ { + return _this.Data_DIRECT__KEY__WRAPPING_ +} + +type Data_DIRECT__KEY__WRAPPING_ interface { + isDIRECT__KEY__WRAPPING() +} + +type CompanionStruct_DIRECT__KEY__WRAPPING_ struct { +} + +var Companion_DIRECT__KEY__WRAPPING_ = CompanionStruct_DIRECT__KEY__WRAPPING_{} + +type DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING struct { +} + +func (DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING) isDIRECT__KEY__WRAPPING() {} + +func (CompanionStruct_DIRECT__KEY__WRAPPING_) Create_DIRECT__KEY__WRAPPING_() DIRECT__KEY__WRAPPING { + return DIRECT__KEY__WRAPPING{DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING{}} +} + +func (_this DIRECT__KEY__WRAPPING) Is_DIRECT__KEY__WRAPPING() bool { + _, ok := _this.Get_().(DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING) + return ok +} + +func (CompanionStruct_DIRECT__KEY__WRAPPING_) Default() DIRECT__KEY__WRAPPING { + return Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_() +} + +func (_ CompanionStruct_DIRECT__KEY__WRAPPING_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_(), true + default: + return DIRECT__KEY__WRAPPING{}, false + } + } +} + +func (_this DIRECT__KEY__WRAPPING) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING: + { + return "AwsCryptographyMaterialProvidersTypes.DIRECT_KEY_WRAPPING.DIRECT_KEY_WRAPPING" + } + default: + { + return "" + } + } +} + +func (_this DIRECT__KEY__WRAPPING) Equals(other DIRECT__KEY__WRAPPING) bool { + switch _this.Get_().(type) { + case DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING: + { + _, ok := other.Get_().(DIRECT__KEY__WRAPPING_DIRECT__KEY__WRAPPING) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this DIRECT__KEY__WRAPPING) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DIRECT__KEY__WRAPPING) + return ok && _this.Equals(typed) +} + +func Type_DIRECT__KEY__WRAPPING_() _dafny.TypeDescriptor { + return type_DIRECT__KEY__WRAPPING_{} +} + +type type_DIRECT__KEY__WRAPPING_ struct { +} + +func (_this type_DIRECT__KEY__WRAPPING_) Default() interface{} { + return Companion_DIRECT__KEY__WRAPPING_.Default() +} + +func (_this type_DIRECT__KEY__WRAPPING_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DIRECT__KEY__WRAPPING" +} +func (_this DIRECT__KEY__WRAPPING) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DIRECT__KEY__WRAPPING{} + +// End of datatype DIRECT__KEY__WRAPPING + +// Definition of datatype DiscoveryFilter +type DiscoveryFilter struct { + Data_DiscoveryFilter_ +} + +func (_this DiscoveryFilter) Get_() Data_DiscoveryFilter_ { + return _this.Data_DiscoveryFilter_ +} + +type Data_DiscoveryFilter_ interface { + isDiscoveryFilter() +} + +type CompanionStruct_DiscoveryFilter_ struct { +} + +var Companion_DiscoveryFilter_ = CompanionStruct_DiscoveryFilter_{} + +type DiscoveryFilter_DiscoveryFilter struct { + AccountIds _dafny.Sequence + Partition _dafny.Sequence +} + +func (DiscoveryFilter_DiscoveryFilter) isDiscoveryFilter() {} + +func (CompanionStruct_DiscoveryFilter_) Create_DiscoveryFilter_(AccountIds _dafny.Sequence, Partition _dafny.Sequence) DiscoveryFilter { + return DiscoveryFilter{DiscoveryFilter_DiscoveryFilter{AccountIds, Partition}} +} + +func (_this DiscoveryFilter) Is_DiscoveryFilter() bool { + _, ok := _this.Get_().(DiscoveryFilter_DiscoveryFilter) + return ok +} + +func (CompanionStruct_DiscoveryFilter_) Default() DiscoveryFilter { + return Companion_DiscoveryFilter_.Create_DiscoveryFilter_(_dafny.EmptySeq, _dafny.EmptySeq.SetString()) +} + +func (_this DiscoveryFilter) Dtor_accountIds() _dafny.Sequence { + return _this.Get_().(DiscoveryFilter_DiscoveryFilter).AccountIds +} + +func (_this DiscoveryFilter) Dtor_partition() _dafny.Sequence { + return _this.Get_().(DiscoveryFilter_DiscoveryFilter).Partition +} + +func (_this DiscoveryFilter) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DiscoveryFilter_DiscoveryFilter: + { + return "AwsCryptographyMaterialProvidersTypes.DiscoveryFilter.DiscoveryFilter" + "(" + _dafny.String(data.AccountIds) + ", " + _dafny.String(data.Partition) + ")" + } + default: + { + return "" + } + } +} + +func (_this DiscoveryFilter) Equals(other DiscoveryFilter) bool { + switch data1 := _this.Get_().(type) { + case DiscoveryFilter_DiscoveryFilter: + { + data2, ok := other.Get_().(DiscoveryFilter_DiscoveryFilter) + return ok && data1.AccountIds.Equals(data2.AccountIds) && data1.Partition.Equals(data2.Partition) + } + default: + { + return false // unexpected + } + } +} + +func (_this DiscoveryFilter) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DiscoveryFilter) + return ok && _this.Equals(typed) +} + +func Type_DiscoveryFilter_() _dafny.TypeDescriptor { + return type_DiscoveryFilter_{} +} + +type type_DiscoveryFilter_ struct { +} + +func (_this type_DiscoveryFilter_) Default() interface{} { + return Companion_DiscoveryFilter_.Default() +} + +func (_this type_DiscoveryFilter_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DiscoveryFilter" +} +func (_this DiscoveryFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DiscoveryFilter{} + +// End of datatype DiscoveryFilter + +// Definition of datatype ECDSA +type ECDSA struct { + Data_ECDSA_ +} + +func (_this ECDSA) Get_() Data_ECDSA_ { + return _this.Data_ECDSA_ +} + +type Data_ECDSA_ interface { + isECDSA() +} + +type CompanionStruct_ECDSA_ struct { +} + +var Companion_ECDSA_ = CompanionStruct_ECDSA_{} + +type ECDSA_ECDSA struct { + Curve m_AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm +} + +func (ECDSA_ECDSA) isECDSA() {} + +func (CompanionStruct_ECDSA_) Create_ECDSA_(Curve m_AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm) ECDSA { + return ECDSA{ECDSA_ECDSA{Curve}} +} + +func (_this ECDSA) Is_ECDSA() bool { + _, ok := _this.Get_().(ECDSA_ECDSA) + return ok +} + +func (CompanionStruct_ECDSA_) Default() ECDSA { + return Companion_ECDSA_.Create_ECDSA_(m_AwsCryptographyPrimitivesTypes.Companion_ECDSASignatureAlgorithm_.Default()) +} + +func (_this ECDSA) Dtor_curve() m_AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm { + return _this.Get_().(ECDSA_ECDSA).Curve +} + +func (_this ECDSA) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case ECDSA_ECDSA: + { + return "AwsCryptographyMaterialProvidersTypes.ECDSA.ECDSA" + "(" + _dafny.String(data.Curve) + ")" + } + default: + { + return "" + } + } +} + +func (_this ECDSA) Equals(other ECDSA) bool { + switch data1 := _this.Get_().(type) { + case ECDSA_ECDSA: + { + data2, ok := other.Get_().(ECDSA_ECDSA) + return ok && data1.Curve.Equals(data2.Curve) + } + default: + { + return false // unexpected + } + } +} + +func (_this ECDSA) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ECDSA) + return ok && _this.Equals(typed) +} + +func Type_ECDSA_() _dafny.TypeDescriptor { + return type_ECDSA_{} +} + +type type_ECDSA_ struct { +} + +func (_this type_ECDSA_) Default() interface{} { + return Companion_ECDSA_.Default() +} + +func (_this type_ECDSA_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ECDSA" +} +func (_this ECDSA) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ECDSA{} + +// End of datatype ECDSA + +// Definition of datatype EdkWrappingAlgorithm +type EdkWrappingAlgorithm struct { + Data_EdkWrappingAlgorithm_ +} + +func (_this EdkWrappingAlgorithm) Get_() Data_EdkWrappingAlgorithm_ { + return _this.Data_EdkWrappingAlgorithm_ +} + +type Data_EdkWrappingAlgorithm_ interface { + isEdkWrappingAlgorithm() +} + +type CompanionStruct_EdkWrappingAlgorithm_ struct { +} + +var Companion_EdkWrappingAlgorithm_ = CompanionStruct_EdkWrappingAlgorithm_{} + +type EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING struct { + DIRECT__KEY__WRAPPING DIRECT__KEY__WRAPPING +} + +func (EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING) isEdkWrappingAlgorithm() {} + +func (CompanionStruct_EdkWrappingAlgorithm_) Create_DIRECT__KEY__WRAPPING_(DIRECT__KEY__WRAPPING DIRECT__KEY__WRAPPING) EdkWrappingAlgorithm { + return EdkWrappingAlgorithm{EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING{DIRECT__KEY__WRAPPING}} +} + +func (_this EdkWrappingAlgorithm) Is_DIRECT__KEY__WRAPPING() bool { + _, ok := _this.Get_().(EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING) + return ok +} + +type EdkWrappingAlgorithm_IntermediateKeyWrapping struct { + IntermediateKeyWrapping IntermediateKeyWrapping +} + +func (EdkWrappingAlgorithm_IntermediateKeyWrapping) isEdkWrappingAlgorithm() {} + +func (CompanionStruct_EdkWrappingAlgorithm_) Create_IntermediateKeyWrapping_(IntermediateKeyWrapping IntermediateKeyWrapping) EdkWrappingAlgorithm { + return EdkWrappingAlgorithm{EdkWrappingAlgorithm_IntermediateKeyWrapping{IntermediateKeyWrapping}} +} + +func (_this EdkWrappingAlgorithm) Is_IntermediateKeyWrapping() bool { + _, ok := _this.Get_().(EdkWrappingAlgorithm_IntermediateKeyWrapping) + return ok +} + +func (CompanionStruct_EdkWrappingAlgorithm_) Default() EdkWrappingAlgorithm { + return Companion_EdkWrappingAlgorithm_.Create_DIRECT__KEY__WRAPPING_(Companion_DIRECT__KEY__WRAPPING_.Default()) +} + +func (_this EdkWrappingAlgorithm) Dtor_DIRECT__KEY__WRAPPING() DIRECT__KEY__WRAPPING { + return _this.Get_().(EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING).DIRECT__KEY__WRAPPING +} + +func (_this EdkWrappingAlgorithm) Dtor_IntermediateKeyWrapping() IntermediateKeyWrapping { + return _this.Get_().(EdkWrappingAlgorithm_IntermediateKeyWrapping).IntermediateKeyWrapping +} + +func (_this EdkWrappingAlgorithm) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING: + { + return "AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm.DIRECT_KEY_WRAPPING" + "(" + _dafny.String(data.DIRECT__KEY__WRAPPING) + ")" + } + case EdkWrappingAlgorithm_IntermediateKeyWrapping: + { + return "AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm.IntermediateKeyWrapping" + "(" + _dafny.String(data.IntermediateKeyWrapping) + ")" + } + default: + { + return "" + } + } +} + +func (_this EdkWrappingAlgorithm) Equals(other EdkWrappingAlgorithm) bool { + switch data1 := _this.Get_().(type) { + case EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING: + { + data2, ok := other.Get_().(EdkWrappingAlgorithm_DIRECT__KEY__WRAPPING) + return ok && data1.DIRECT__KEY__WRAPPING.Equals(data2.DIRECT__KEY__WRAPPING) + } + case EdkWrappingAlgorithm_IntermediateKeyWrapping: + { + data2, ok := other.Get_().(EdkWrappingAlgorithm_IntermediateKeyWrapping) + return ok && data1.IntermediateKeyWrapping.Equals(data2.IntermediateKeyWrapping) + } + default: + { + return false // unexpected + } + } +} + +func (_this EdkWrappingAlgorithm) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EdkWrappingAlgorithm) + return ok && _this.Equals(typed) +} + +func Type_EdkWrappingAlgorithm_() _dafny.TypeDescriptor { + return type_EdkWrappingAlgorithm_{} +} + +type type_EdkWrappingAlgorithm_ struct { +} + +func (_this type_EdkWrappingAlgorithm_) Default() interface{} { + return Companion_EdkWrappingAlgorithm_.Default() +} + +func (_this type_EdkWrappingAlgorithm_) String() string { + return "AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm" +} +func (_this EdkWrappingAlgorithm) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EdkWrappingAlgorithm{} + +// End of datatype EdkWrappingAlgorithm + +// Definition of datatype Encrypt +type Encrypt struct { + Data_Encrypt_ +} + +func (_this Encrypt) Get_() Data_Encrypt_ { + return _this.Data_Encrypt_ +} + +type Data_Encrypt_ interface { + isEncrypt() +} + +type CompanionStruct_Encrypt_ struct { +} + +var Companion_Encrypt_ = CompanionStruct_Encrypt_{} + +type Encrypt_AES__GCM struct { + AES__GCM m_AwsCryptographyPrimitivesTypes.AES__GCM +} + +func (Encrypt_AES__GCM) isEncrypt() {} + +func (CompanionStruct_Encrypt_) Create_AES__GCM_(AES__GCM m_AwsCryptographyPrimitivesTypes.AES__GCM) Encrypt { + return Encrypt{Encrypt_AES__GCM{AES__GCM}} +} + +func (_this Encrypt) Is_AES__GCM() bool { + _, ok := _this.Get_().(Encrypt_AES__GCM) + return ok +} + +func (CompanionStruct_Encrypt_) Default() Encrypt { + return Companion_Encrypt_.Create_AES__GCM_(m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Default()) +} + +func (_this Encrypt) Dtor_AES__GCM() m_AwsCryptographyPrimitivesTypes.AES__GCM { + return _this.Get_().(Encrypt_AES__GCM).AES__GCM +} + +func (_this Encrypt) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Encrypt_AES__GCM: + { + return "AwsCryptographyMaterialProvidersTypes.Encrypt.AES_GCM" + "(" + _dafny.String(data.AES__GCM) + ")" + } + default: + { + return "" + } + } +} + +func (_this Encrypt) Equals(other Encrypt) bool { + switch data1 := _this.Get_().(type) { + case Encrypt_AES__GCM: + { + data2, ok := other.Get_().(Encrypt_AES__GCM) + return ok && data1.AES__GCM.Equals(data2.AES__GCM) + } + default: + { + return false // unexpected + } + } +} + +func (_this Encrypt) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Encrypt) + return ok && _this.Equals(typed) +} + +func Type_Encrypt_() _dafny.TypeDescriptor { + return type_Encrypt_{} +} + +type type_Encrypt_ struct { +} + +func (_this type_Encrypt_) Default() interface{} { + return Companion_Encrypt_.Default() +} + +func (_this type_Encrypt_) String() string { + return "AwsCryptographyMaterialProvidersTypes.Encrypt" +} +func (_this Encrypt) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Encrypt{} + +// End of datatype Encrypt + +// Definition of datatype EncryptedDataKey +type EncryptedDataKey struct { + Data_EncryptedDataKey_ +} + +func (_this EncryptedDataKey) Get_() Data_EncryptedDataKey_ { + return _this.Data_EncryptedDataKey_ +} + +type Data_EncryptedDataKey_ interface { + isEncryptedDataKey() +} + +type CompanionStruct_EncryptedDataKey_ struct { +} + +var Companion_EncryptedDataKey_ = CompanionStruct_EncryptedDataKey_{} + +type EncryptedDataKey_EncryptedDataKey struct { + KeyProviderId _dafny.Sequence + KeyProviderInfo _dafny.Sequence + Ciphertext _dafny.Sequence +} + +func (EncryptedDataKey_EncryptedDataKey) isEncryptedDataKey() {} + +func (CompanionStruct_EncryptedDataKey_) Create_EncryptedDataKey_(KeyProviderId _dafny.Sequence, KeyProviderInfo _dafny.Sequence, Ciphertext _dafny.Sequence) EncryptedDataKey { + return EncryptedDataKey{EncryptedDataKey_EncryptedDataKey{KeyProviderId, KeyProviderInfo, Ciphertext}} +} + +func (_this EncryptedDataKey) Is_EncryptedDataKey() bool { + _, ok := _this.Get_().(EncryptedDataKey_EncryptedDataKey) + return ok +} + +func (CompanionStruct_EncryptedDataKey_) Default() EncryptedDataKey { + return Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_UTF8.Companion_ValidUTF8Bytes_.Witness(), _dafny.EmptySeq, _dafny.EmptySeq) +} + +func (_this EncryptedDataKey) Dtor_keyProviderId() _dafny.Sequence { + return _this.Get_().(EncryptedDataKey_EncryptedDataKey).KeyProviderId +} + +func (_this EncryptedDataKey) Dtor_keyProviderInfo() _dafny.Sequence { + return _this.Get_().(EncryptedDataKey_EncryptedDataKey).KeyProviderInfo +} + +func (_this EncryptedDataKey) Dtor_ciphertext() _dafny.Sequence { + return _this.Get_().(EncryptedDataKey_EncryptedDataKey).Ciphertext +} + +func (_this EncryptedDataKey) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case EncryptedDataKey_EncryptedDataKey: + { + return "AwsCryptographyMaterialProvidersTypes.EncryptedDataKey.EncryptedDataKey" + "(" + _dafny.String(data.KeyProviderId) + ", " + _dafny.String(data.KeyProviderInfo) + ", " + _dafny.String(data.Ciphertext) + ")" + } + default: + { + return "" + } + } +} + +func (_this EncryptedDataKey) Equals(other EncryptedDataKey) bool { + switch data1 := _this.Get_().(type) { + case EncryptedDataKey_EncryptedDataKey: + { + data2, ok := other.Get_().(EncryptedDataKey_EncryptedDataKey) + return ok && data1.KeyProviderId.Equals(data2.KeyProviderId) && data1.KeyProviderInfo.Equals(data2.KeyProviderInfo) && data1.Ciphertext.Equals(data2.Ciphertext) + } + default: + { + return false // unexpected + } + } +} + +func (_this EncryptedDataKey) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EncryptedDataKey) + return ok && _this.Equals(typed) +} + +func Type_EncryptedDataKey_() _dafny.TypeDescriptor { + return type_EncryptedDataKey_{} +} + +type type_EncryptedDataKey_ struct { +} + +func (_this type_EncryptedDataKey_) Default() interface{} { + return Companion_EncryptedDataKey_.Default() +} + +func (_this type_EncryptedDataKey_) String() string { + return "AwsCryptographyMaterialProvidersTypes.EncryptedDataKey" +} +func (_this EncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EncryptedDataKey{} + +// End of datatype EncryptedDataKey + +// Definition of datatype EncryptionMaterials +type EncryptionMaterials struct { + Data_EncryptionMaterials_ +} + +func (_this EncryptionMaterials) Get_() Data_EncryptionMaterials_ { + return _this.Data_EncryptionMaterials_ +} + +type Data_EncryptionMaterials_ interface { + isEncryptionMaterials() +} + +type CompanionStruct_EncryptionMaterials_ struct { +} + +var Companion_EncryptionMaterials_ = CompanionStruct_EncryptionMaterials_{} + +type EncryptionMaterials_EncryptionMaterials struct { + AlgorithmSuite AlgorithmSuiteInfo + EncryptionContext _dafny.Map + EncryptedDataKeys _dafny.Sequence + RequiredEncryptionContextKeys _dafny.Sequence + PlaintextDataKey m_Wrappers.Option + SigningKey m_Wrappers.Option + SymmetricSigningKeys m_Wrappers.Option +} + +func (EncryptionMaterials_EncryptionMaterials) isEncryptionMaterials() {} + +func (CompanionStruct_EncryptionMaterials_) Create_EncryptionMaterials_(AlgorithmSuite AlgorithmSuiteInfo, EncryptionContext _dafny.Map, EncryptedDataKeys _dafny.Sequence, RequiredEncryptionContextKeys _dafny.Sequence, PlaintextDataKey m_Wrappers.Option, SigningKey m_Wrappers.Option, SymmetricSigningKeys m_Wrappers.Option) EncryptionMaterials { + return EncryptionMaterials{EncryptionMaterials_EncryptionMaterials{AlgorithmSuite, EncryptionContext, EncryptedDataKeys, RequiredEncryptionContextKeys, PlaintextDataKey, SigningKey, SymmetricSigningKeys}} +} + +func (_this EncryptionMaterials) Is_EncryptionMaterials() bool { + _, ok := _this.Get_().(EncryptionMaterials_EncryptionMaterials) + return ok +} + +func (CompanionStruct_EncryptionMaterials_) Default() EncryptionMaterials { + return Companion_EncryptionMaterials_.Create_EncryptionMaterials_(Companion_AlgorithmSuiteInfo_.Default(), _dafny.EmptyMap, _dafny.EmptySeq, _dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this EncryptionMaterials) Dtor_algorithmSuite() AlgorithmSuiteInfo { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).AlgorithmSuite +} + +func (_this EncryptionMaterials) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).EncryptionContext +} + +func (_this EncryptionMaterials) Dtor_encryptedDataKeys() _dafny.Sequence { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).EncryptedDataKeys +} + +func (_this EncryptionMaterials) Dtor_requiredEncryptionContextKeys() _dafny.Sequence { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).RequiredEncryptionContextKeys +} + +func (_this EncryptionMaterials) Dtor_plaintextDataKey() m_Wrappers.Option { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).PlaintextDataKey +} + +func (_this EncryptionMaterials) Dtor_signingKey() m_Wrappers.Option { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).SigningKey +} + +func (_this EncryptionMaterials) Dtor_symmetricSigningKeys() m_Wrappers.Option { + return _this.Get_().(EncryptionMaterials_EncryptionMaterials).SymmetricSigningKeys +} + +func (_this EncryptionMaterials) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case EncryptionMaterials_EncryptionMaterials: + { + return "AwsCryptographyMaterialProvidersTypes.EncryptionMaterials.EncryptionMaterials" + "(" + _dafny.String(data.AlgorithmSuite) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.EncryptedDataKeys) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ", " + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.SigningKey) + ", " + _dafny.String(data.SymmetricSigningKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this EncryptionMaterials) Equals(other EncryptionMaterials) bool { + switch data1 := _this.Get_().(type) { + case EncryptionMaterials_EncryptionMaterials: + { + data2, ok := other.Get_().(EncryptionMaterials_EncryptionMaterials) + return ok && data1.AlgorithmSuite.Equals(data2.AlgorithmSuite) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.EncryptedDataKeys.Equals(data2.EncryptedDataKeys) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.SigningKey.Equals(data2.SigningKey) && data1.SymmetricSigningKeys.Equals(data2.SymmetricSigningKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this EncryptionMaterials) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EncryptionMaterials) + return ok && _this.Equals(typed) +} + +func Type_EncryptionMaterials_() _dafny.TypeDescriptor { + return type_EncryptionMaterials_{} +} + +type type_EncryptionMaterials_ struct { +} + +func (_this type_EncryptionMaterials_) Default() interface{} { + return Companion_EncryptionMaterials_.Default() +} + +func (_this type_EncryptionMaterials_) String() string { + return "AwsCryptographyMaterialProvidersTypes.EncryptionMaterials" +} +func (_this EncryptionMaterials) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EncryptionMaterials{} + +// End of datatype EncryptionMaterials + +// Definition of datatype EphemeralPrivateKeyToStaticPublicKeyInput +type EphemeralPrivateKeyToStaticPublicKeyInput struct { + Data_EphemeralPrivateKeyToStaticPublicKeyInput_ +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) Get_() Data_EphemeralPrivateKeyToStaticPublicKeyInput_ { + return _this.Data_EphemeralPrivateKeyToStaticPublicKeyInput_ +} + +type Data_EphemeralPrivateKeyToStaticPublicKeyInput_ interface { + isEphemeralPrivateKeyToStaticPublicKeyInput() +} + +type CompanionStruct_EphemeralPrivateKeyToStaticPublicKeyInput_ struct { +} + +var Companion_EphemeralPrivateKeyToStaticPublicKeyInput_ = CompanionStruct_EphemeralPrivateKeyToStaticPublicKeyInput_{} + +type EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput struct { + RecipientPublicKey _dafny.Sequence +} + +func (EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput) isEphemeralPrivateKeyToStaticPublicKeyInput() { +} + +func (CompanionStruct_EphemeralPrivateKeyToStaticPublicKeyInput_) Create_EphemeralPrivateKeyToStaticPublicKeyInput_(RecipientPublicKey _dafny.Sequence) EphemeralPrivateKeyToStaticPublicKeyInput { + return EphemeralPrivateKeyToStaticPublicKeyInput{EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput{RecipientPublicKey}} +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) Is_EphemeralPrivateKeyToStaticPublicKeyInput() bool { + _, ok := _this.Get_().(EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput) + return ok +} + +func (CompanionStruct_EphemeralPrivateKeyToStaticPublicKeyInput_) Default() EphemeralPrivateKeyToStaticPublicKeyInput { + return Companion_EphemeralPrivateKeyToStaticPublicKeyInput_.Create_EphemeralPrivateKeyToStaticPublicKeyInput_(_dafny.EmptySeq) +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) Dtor_recipientPublicKey() _dafny.Sequence { + return _this.Get_().(EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput).RecipientPublicKey +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput: + { + return "AwsCryptographyMaterialProvidersTypes.EphemeralPrivateKeyToStaticPublicKeyInput.EphemeralPrivateKeyToStaticPublicKeyInput" + "(" + _dafny.String(data.RecipientPublicKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) Equals(other EphemeralPrivateKeyToStaticPublicKeyInput) bool { + switch data1 := _this.Get_().(type) { + case EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput: + { + data2, ok := other.Get_().(EphemeralPrivateKeyToStaticPublicKeyInput_EphemeralPrivateKeyToStaticPublicKeyInput) + return ok && data1.RecipientPublicKey.Equals(data2.RecipientPublicKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EphemeralPrivateKeyToStaticPublicKeyInput) + return ok && _this.Equals(typed) +} + +func Type_EphemeralPrivateKeyToStaticPublicKeyInput_() _dafny.TypeDescriptor { + return type_EphemeralPrivateKeyToStaticPublicKeyInput_{} +} + +type type_EphemeralPrivateKeyToStaticPublicKeyInput_ struct { +} + +func (_this type_EphemeralPrivateKeyToStaticPublicKeyInput_) Default() interface{} { + return Companion_EphemeralPrivateKeyToStaticPublicKeyInput_.Default() +} + +func (_this type_EphemeralPrivateKeyToStaticPublicKeyInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.EphemeralPrivateKeyToStaticPublicKeyInput" +} +func (_this EphemeralPrivateKeyToStaticPublicKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EphemeralPrivateKeyToStaticPublicKeyInput{} + +// End of datatype EphemeralPrivateKeyToStaticPublicKeyInput + +// Definition of datatype ESDKAlgorithmSuiteId +type ESDKAlgorithmSuiteId struct { + Data_ESDKAlgorithmSuiteId_ +} + +func (_this ESDKAlgorithmSuiteId) Get_() Data_ESDKAlgorithmSuiteId_ { + return _this.Data_ESDKAlgorithmSuiteId_ +} + +type Data_ESDKAlgorithmSuiteId_ interface { + isESDKAlgorithmSuiteId() +} + +type CompanionStruct_ESDKAlgorithmSuiteId_ struct { +} + +var Companion_ESDKAlgorithmSuiteId_ = CompanionStruct_ESDKAlgorithmSuiteId_{} + +type ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__128__GCM__IV12__TAG16__NO__KDF_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__128__GCM__IV12__TAG16__NO__KDF() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__192__GCM__IV12__TAG16__NO__KDF_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__192__GCM__IV12__TAG16__NO__KDF() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__256__GCM__IV12__TAG16__NO__KDF_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__256__GCM__IV12__TAG16__NO__KDF() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256) isESDKAlgorithmSuiteId() { +} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) isESDKAlgorithmSuiteId() { +} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) isESDKAlgorithmSuiteId() { +} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY) isESDKAlgorithmSuiteId() {} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY) + return ok +} + +type ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384 struct { +} + +func (ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384) isESDKAlgorithmSuiteId() { +} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384_() ESDKAlgorithmSuiteId { + return ESDKAlgorithmSuiteId{ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384{}} +} + +func (_this ESDKAlgorithmSuiteId) Is_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384() bool { + _, ok := _this.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384) + return ok +} + +func (CompanionStruct_ESDKAlgorithmSuiteId_) Default() ESDKAlgorithmSuiteId { + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__NO__KDF_() +} + +func (_ CompanionStruct_ESDKAlgorithmSuiteId_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__NO__KDF_(), true + case 1: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__NO__KDF_(), true + case 2: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__NO__KDF_(), true + case 3: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256_(), true + case 4: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256_(), true + case 5: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256_(), true + case 6: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256_(), true + case 7: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_(), true + case 8: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_(), true + case 9: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY_(), true + case 10: + return Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384_(), true + default: + return ESDKAlgorithmSuiteId{}, false + } + } +} + +func (_this ESDKAlgorithmSuiteId) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_128_GCM_IV12_TAG16_NO_KDF" + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_192_GCM_IV12_TAG16_NO_KDF" + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_256_GCM_IV12_TAG16_NO_KDF" + } + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_128_GCM_IV12_TAG16_HKDF_SHA256" + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_192_GCM_IV12_TAG16_HKDF_SHA256" + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_256_GCM_IV12_TAG16_HKDF_SHA256" + } + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_128_GCM_IV12_TAG16_HKDF_SHA256_ECDSA_P256" + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_192_GCM_IV12_TAG16_HKDF_SHA384_ECDSA_P384" + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_256_GCM_IV12_TAG16_HKDF_SHA384_ECDSA_P384" + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY" + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384" + } + default: + { + return "" + } + } +} + +func (_this ESDKAlgorithmSuiteId) Equals(other ESDKAlgorithmSuiteId) bool { + switch _this.Get_().(type) { + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__NO__KDF) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__NO__KDF) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__NO__KDF) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA256) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA256) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__128__GCM__IV12__TAG16__HKDF__SHA256__ECDSA__P256) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__192__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY) + return ok + } + case ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384: + { + _, ok := other.Get_().(ESDKAlgorithmSuiteId_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this ESDKAlgorithmSuiteId) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ESDKAlgorithmSuiteId) + return ok && _this.Equals(typed) +} + +func Type_ESDKAlgorithmSuiteId_() _dafny.TypeDescriptor { + return type_ESDKAlgorithmSuiteId_{} +} + +type type_ESDKAlgorithmSuiteId_ struct { +} + +func (_this type_ESDKAlgorithmSuiteId_) Default() interface{} { + return Companion_ESDKAlgorithmSuiteId_.Default() +} + +func (_this type_ESDKAlgorithmSuiteId_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId" +} +func (_this ESDKAlgorithmSuiteId) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ESDKAlgorithmSuiteId{} + +// End of datatype ESDKAlgorithmSuiteId + +// Definition of datatype ESDKCommitmentPolicy +type ESDKCommitmentPolicy struct { + Data_ESDKCommitmentPolicy_ +} + +func (_this ESDKCommitmentPolicy) Get_() Data_ESDKCommitmentPolicy_ { + return _this.Data_ESDKCommitmentPolicy_ +} + +type Data_ESDKCommitmentPolicy_ interface { + isESDKCommitmentPolicy() +} + +type CompanionStruct_ESDKCommitmentPolicy_ struct { +} + +var Companion_ESDKCommitmentPolicy_ = CompanionStruct_ESDKCommitmentPolicy_{} + +type ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT struct { +} + +func (ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT) isESDKCommitmentPolicy() {} + +func (CompanionStruct_ESDKCommitmentPolicy_) Create_FORBID__ENCRYPT__ALLOW__DECRYPT_() ESDKCommitmentPolicy { + return ESDKCommitmentPolicy{ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT{}} +} + +func (_this ESDKCommitmentPolicy) Is_FORBID__ENCRYPT__ALLOW__DECRYPT() bool { + _, ok := _this.Get_().(ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT) + return ok +} + +type ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT struct { +} + +func (ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT) isESDKCommitmentPolicy() {} + +func (CompanionStruct_ESDKCommitmentPolicy_) Create_REQUIRE__ENCRYPT__ALLOW__DECRYPT_() ESDKCommitmentPolicy { + return ESDKCommitmentPolicy{ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT{}} +} + +func (_this ESDKCommitmentPolicy) Is_REQUIRE__ENCRYPT__ALLOW__DECRYPT() bool { + _, ok := _this.Get_().(ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT) + return ok +} + +type ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT struct { +} + +func (ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) isESDKCommitmentPolicy() {} + +func (CompanionStruct_ESDKCommitmentPolicy_) Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_() ESDKCommitmentPolicy { + return ESDKCommitmentPolicy{ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT{}} +} + +func (_this ESDKCommitmentPolicy) Is_REQUIRE__ENCRYPT__REQUIRE__DECRYPT() bool { + _, ok := _this.Get_().(ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) + return ok +} + +func (CompanionStruct_ESDKCommitmentPolicy_) Default() ESDKCommitmentPolicy { + return Companion_ESDKCommitmentPolicy_.Create_FORBID__ENCRYPT__ALLOW__DECRYPT_() +} + +func (_ CompanionStruct_ESDKCommitmentPolicy_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_ESDKCommitmentPolicy_.Create_FORBID__ENCRYPT__ALLOW__DECRYPT_(), true + case 1: + return Companion_ESDKCommitmentPolicy_.Create_REQUIRE__ENCRYPT__ALLOW__DECRYPT_(), true + case 2: + return Companion_ESDKCommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_(), true + default: + return ESDKCommitmentPolicy{}, false + } + } +} + +func (_this ESDKCommitmentPolicy) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT" + } + case ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.REQUIRE_ENCRYPT_ALLOW_DECRYPT" + } + case ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT: + { + return "AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT" + } + default: + { + return "" + } + } +} + +func (_this ESDKCommitmentPolicy) Equals(other ESDKCommitmentPolicy) bool { + switch _this.Get_().(type) { + case ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT: + { + _, ok := other.Get_().(ESDKCommitmentPolicy_FORBID__ENCRYPT__ALLOW__DECRYPT) + return ok + } + case ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT: + { + _, ok := other.Get_().(ESDKCommitmentPolicy_REQUIRE__ENCRYPT__ALLOW__DECRYPT) + return ok + } + case ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT: + { + _, ok := other.Get_().(ESDKCommitmentPolicy_REQUIRE__ENCRYPT__REQUIRE__DECRYPT) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this ESDKCommitmentPolicy) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ESDKCommitmentPolicy) + return ok && _this.Equals(typed) +} + +func Type_ESDKCommitmentPolicy_() _dafny.TypeDescriptor { + return type_ESDKCommitmentPolicy_{} +} + +type type_ESDKCommitmentPolicy_ struct { +} + +func (_this type_ESDKCommitmentPolicy_) Default() interface{} { + return Companion_ESDKCommitmentPolicy_.Default() +} + +func (_this type_ESDKCommitmentPolicy_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy" +} +func (_this ESDKCommitmentPolicy) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ESDKCommitmentPolicy{} + +// End of datatype ESDKCommitmentPolicy + +// Definition of datatype GetBranchKeyIdInput +type GetBranchKeyIdInput struct { + Data_GetBranchKeyIdInput_ +} + +func (_this GetBranchKeyIdInput) Get_() Data_GetBranchKeyIdInput_ { + return _this.Data_GetBranchKeyIdInput_ +} + +type Data_GetBranchKeyIdInput_ interface { + isGetBranchKeyIdInput() +} + +type CompanionStruct_GetBranchKeyIdInput_ struct { +} + +var Companion_GetBranchKeyIdInput_ = CompanionStruct_GetBranchKeyIdInput_{} + +type GetBranchKeyIdInput_GetBranchKeyIdInput struct { + EncryptionContext _dafny.Map +} + +func (GetBranchKeyIdInput_GetBranchKeyIdInput) isGetBranchKeyIdInput() {} + +func (CompanionStruct_GetBranchKeyIdInput_) Create_GetBranchKeyIdInput_(EncryptionContext _dafny.Map) GetBranchKeyIdInput { + return GetBranchKeyIdInput{GetBranchKeyIdInput_GetBranchKeyIdInput{EncryptionContext}} +} + +func (_this GetBranchKeyIdInput) Is_GetBranchKeyIdInput() bool { + _, ok := _this.Get_().(GetBranchKeyIdInput_GetBranchKeyIdInput) + return ok +} + +func (CompanionStruct_GetBranchKeyIdInput_) Default() GetBranchKeyIdInput { + return Companion_GetBranchKeyIdInput_.Create_GetBranchKeyIdInput_(_dafny.EmptyMap) +} + +func (_this GetBranchKeyIdInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(GetBranchKeyIdInput_GetBranchKeyIdInput).EncryptionContext +} + +func (_this GetBranchKeyIdInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBranchKeyIdInput_GetBranchKeyIdInput: + { + return "AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput.GetBranchKeyIdInput" + "(" + _dafny.String(data.EncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBranchKeyIdInput) Equals(other GetBranchKeyIdInput) bool { + switch data1 := _this.Get_().(type) { + case GetBranchKeyIdInput_GetBranchKeyIdInput: + { + data2, ok := other.Get_().(GetBranchKeyIdInput_GetBranchKeyIdInput) + return ok && data1.EncryptionContext.Equals(data2.EncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBranchKeyIdInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBranchKeyIdInput) + return ok && _this.Equals(typed) +} + +func Type_GetBranchKeyIdInput_() _dafny.TypeDescriptor { + return type_GetBranchKeyIdInput_{} +} + +type type_GetBranchKeyIdInput_ struct { +} + +func (_this type_GetBranchKeyIdInput_) Default() interface{} { + return Companion_GetBranchKeyIdInput_.Default() +} + +func (_this type_GetBranchKeyIdInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput" +} +func (_this GetBranchKeyIdInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBranchKeyIdInput{} + +// End of datatype GetBranchKeyIdInput + +// Definition of datatype GetBranchKeyIdOutput +type GetBranchKeyIdOutput struct { + Data_GetBranchKeyIdOutput_ +} + +func (_this GetBranchKeyIdOutput) Get_() Data_GetBranchKeyIdOutput_ { + return _this.Data_GetBranchKeyIdOutput_ +} + +type Data_GetBranchKeyIdOutput_ interface { + isGetBranchKeyIdOutput() +} + +type CompanionStruct_GetBranchKeyIdOutput_ struct { +} + +var Companion_GetBranchKeyIdOutput_ = CompanionStruct_GetBranchKeyIdOutput_{} + +type GetBranchKeyIdOutput_GetBranchKeyIdOutput struct { + BranchKeyId _dafny.Sequence +} + +func (GetBranchKeyIdOutput_GetBranchKeyIdOutput) isGetBranchKeyIdOutput() {} + +func (CompanionStruct_GetBranchKeyIdOutput_) Create_GetBranchKeyIdOutput_(BranchKeyId _dafny.Sequence) GetBranchKeyIdOutput { + return GetBranchKeyIdOutput{GetBranchKeyIdOutput_GetBranchKeyIdOutput{BranchKeyId}} +} + +func (_this GetBranchKeyIdOutput) Is_GetBranchKeyIdOutput() bool { + _, ok := _this.Get_().(GetBranchKeyIdOutput_GetBranchKeyIdOutput) + return ok +} + +func (CompanionStruct_GetBranchKeyIdOutput_) Default() GetBranchKeyIdOutput { + return Companion_GetBranchKeyIdOutput_.Create_GetBranchKeyIdOutput_(_dafny.EmptySeq.SetString()) +} + +func (_this GetBranchKeyIdOutput) Dtor_branchKeyId() _dafny.Sequence { + return _this.Get_().(GetBranchKeyIdOutput_GetBranchKeyIdOutput).BranchKeyId +} + +func (_this GetBranchKeyIdOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetBranchKeyIdOutput_GetBranchKeyIdOutput: + { + return "AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput.GetBranchKeyIdOutput" + "(" + _dafny.String(data.BranchKeyId) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetBranchKeyIdOutput) Equals(other GetBranchKeyIdOutput) bool { + switch data1 := _this.Get_().(type) { + case GetBranchKeyIdOutput_GetBranchKeyIdOutput: + { + data2, ok := other.Get_().(GetBranchKeyIdOutput_GetBranchKeyIdOutput) + return ok && data1.BranchKeyId.Equals(data2.BranchKeyId) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetBranchKeyIdOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetBranchKeyIdOutput) + return ok && _this.Equals(typed) +} + +func Type_GetBranchKeyIdOutput_() _dafny.TypeDescriptor { + return type_GetBranchKeyIdOutput_{} +} + +type type_GetBranchKeyIdOutput_ struct { +} + +func (_this type_GetBranchKeyIdOutput_) Default() interface{} { + return Companion_GetBranchKeyIdOutput_.Default() +} + +func (_this type_GetBranchKeyIdOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput" +} +func (_this GetBranchKeyIdOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetBranchKeyIdOutput{} + +// End of datatype GetBranchKeyIdOutput + +// Definition of datatype GetCacheEntryInput +type GetCacheEntryInput struct { + Data_GetCacheEntryInput_ +} + +func (_this GetCacheEntryInput) Get_() Data_GetCacheEntryInput_ { + return _this.Data_GetCacheEntryInput_ +} + +type Data_GetCacheEntryInput_ interface { + isGetCacheEntryInput() +} + +type CompanionStruct_GetCacheEntryInput_ struct { +} + +var Companion_GetCacheEntryInput_ = CompanionStruct_GetCacheEntryInput_{} + +type GetCacheEntryInput_GetCacheEntryInput struct { + Identifier _dafny.Sequence + BytesUsed m_Wrappers.Option +} + +func (GetCacheEntryInput_GetCacheEntryInput) isGetCacheEntryInput() {} + +func (CompanionStruct_GetCacheEntryInput_) Create_GetCacheEntryInput_(Identifier _dafny.Sequence, BytesUsed m_Wrappers.Option) GetCacheEntryInput { + return GetCacheEntryInput{GetCacheEntryInput_GetCacheEntryInput{Identifier, BytesUsed}} +} + +func (_this GetCacheEntryInput) Is_GetCacheEntryInput() bool { + _, ok := _this.Get_().(GetCacheEntryInput_GetCacheEntryInput) + return ok +} + +func (CompanionStruct_GetCacheEntryInput_) Default() GetCacheEntryInput { + return Companion_GetCacheEntryInput_.Create_GetCacheEntryInput_(_dafny.EmptySeq, m_Wrappers.Companion_Option_.Default()) +} + +func (_this GetCacheEntryInput) Dtor_identifier() _dafny.Sequence { + return _this.Get_().(GetCacheEntryInput_GetCacheEntryInput).Identifier +} + +func (_this GetCacheEntryInput) Dtor_bytesUsed() m_Wrappers.Option { + return _this.Get_().(GetCacheEntryInput_GetCacheEntryInput).BytesUsed +} + +func (_this GetCacheEntryInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetCacheEntryInput_GetCacheEntryInput: + { + return "AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput.GetCacheEntryInput" + "(" + _dafny.String(data.Identifier) + ", " + _dafny.String(data.BytesUsed) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetCacheEntryInput) Equals(other GetCacheEntryInput) bool { + switch data1 := _this.Get_().(type) { + case GetCacheEntryInput_GetCacheEntryInput: + { + data2, ok := other.Get_().(GetCacheEntryInput_GetCacheEntryInput) + return ok && data1.Identifier.Equals(data2.Identifier) && data1.BytesUsed.Equals(data2.BytesUsed) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetCacheEntryInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetCacheEntryInput) + return ok && _this.Equals(typed) +} + +func Type_GetCacheEntryInput_() _dafny.TypeDescriptor { + return type_GetCacheEntryInput_{} +} + +type type_GetCacheEntryInput_ struct { +} + +func (_this type_GetCacheEntryInput_) Default() interface{} { + return Companion_GetCacheEntryInput_.Default() +} + +func (_this type_GetCacheEntryInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput" +} +func (_this GetCacheEntryInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetCacheEntryInput{} + +// End of datatype GetCacheEntryInput + +// Definition of datatype GetCacheEntryOutput +type GetCacheEntryOutput struct { + Data_GetCacheEntryOutput_ +} + +func (_this GetCacheEntryOutput) Get_() Data_GetCacheEntryOutput_ { + return _this.Data_GetCacheEntryOutput_ +} + +type Data_GetCacheEntryOutput_ interface { + isGetCacheEntryOutput() +} + +type CompanionStruct_GetCacheEntryOutput_ struct { +} + +var Companion_GetCacheEntryOutput_ = CompanionStruct_GetCacheEntryOutput_{} + +type GetCacheEntryOutput_GetCacheEntryOutput struct { + Materials Materials + CreationTime int64 + ExpiryTime int64 + MessagesUsed int32 + BytesUsed int32 +} + +func (GetCacheEntryOutput_GetCacheEntryOutput) isGetCacheEntryOutput() {} + +func (CompanionStruct_GetCacheEntryOutput_) Create_GetCacheEntryOutput_(Materials Materials, CreationTime int64, ExpiryTime int64, MessagesUsed int32, BytesUsed int32) GetCacheEntryOutput { + return GetCacheEntryOutput{GetCacheEntryOutput_GetCacheEntryOutput{Materials, CreationTime, ExpiryTime, MessagesUsed, BytesUsed}} +} + +func (_this GetCacheEntryOutput) Is_GetCacheEntryOutput() bool { + _, ok := _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput) + return ok +} + +func (CompanionStruct_GetCacheEntryOutput_) Default() GetCacheEntryOutput { + return Companion_GetCacheEntryOutput_.Create_GetCacheEntryOutput_(Companion_Materials_.Default(), int64(0), int64(0), int32(0), int32(0)) +} + +func (_this GetCacheEntryOutput) Dtor_materials() Materials { + return _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput).Materials +} + +func (_this GetCacheEntryOutput) Dtor_creationTime() int64 { + return _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput).CreationTime +} + +func (_this GetCacheEntryOutput) Dtor_expiryTime() int64 { + return _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput).ExpiryTime +} + +func (_this GetCacheEntryOutput) Dtor_messagesUsed() int32 { + return _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput).MessagesUsed +} + +func (_this GetCacheEntryOutput) Dtor_bytesUsed() int32 { + return _this.Get_().(GetCacheEntryOutput_GetCacheEntryOutput).BytesUsed +} + +func (_this GetCacheEntryOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetCacheEntryOutput_GetCacheEntryOutput: + { + return "AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput.GetCacheEntryOutput" + "(" + _dafny.String(data.Materials) + ", " + _dafny.String(data.CreationTime) + ", " + _dafny.String(data.ExpiryTime) + ", " + _dafny.String(data.MessagesUsed) + ", " + _dafny.String(data.BytesUsed) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetCacheEntryOutput) Equals(other GetCacheEntryOutput) bool { + switch data1 := _this.Get_().(type) { + case GetCacheEntryOutput_GetCacheEntryOutput: + { + data2, ok := other.Get_().(GetCacheEntryOutput_GetCacheEntryOutput) + return ok && data1.Materials.Equals(data2.Materials) && data1.CreationTime == data2.CreationTime && data1.ExpiryTime == data2.ExpiryTime && data1.MessagesUsed == data2.MessagesUsed && data1.BytesUsed == data2.BytesUsed + } + default: + { + return false // unexpected + } + } +} + +func (_this GetCacheEntryOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetCacheEntryOutput) + return ok && _this.Equals(typed) +} + +func Type_GetCacheEntryOutput_() _dafny.TypeDescriptor { + return type_GetCacheEntryOutput_{} +} + +type type_GetCacheEntryOutput_ struct { +} + +func (_this type_GetCacheEntryOutput_) Default() interface{} { + return Companion_GetCacheEntryOutput_.Default() +} + +func (_this type_GetCacheEntryOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput" +} +func (_this GetCacheEntryOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetCacheEntryOutput{} + +// End of datatype GetCacheEntryOutput + +// Definition of datatype GetClientInput +type GetClientInput struct { + Data_GetClientInput_ +} + +func (_this GetClientInput) Get_() Data_GetClientInput_ { + return _this.Data_GetClientInput_ +} + +type Data_GetClientInput_ interface { + isGetClientInput() +} + +type CompanionStruct_GetClientInput_ struct { +} + +var Companion_GetClientInput_ = CompanionStruct_GetClientInput_{} + +type GetClientInput_GetClientInput struct { + Region _dafny.Sequence +} + +func (GetClientInput_GetClientInput) isGetClientInput() {} + +func (CompanionStruct_GetClientInput_) Create_GetClientInput_(Region _dafny.Sequence) GetClientInput { + return GetClientInput{GetClientInput_GetClientInput{Region}} +} + +func (_this GetClientInput) Is_GetClientInput() bool { + _, ok := _this.Get_().(GetClientInput_GetClientInput) + return ok +} + +func (CompanionStruct_GetClientInput_) Default() GetClientInput { + return Companion_GetClientInput_.Create_GetClientInput_(_dafny.EmptySeq.SetString()) +} + +func (_this GetClientInput) Dtor_region() _dafny.Sequence { + return _this.Get_().(GetClientInput_GetClientInput).Region +} + +func (_this GetClientInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetClientInput_GetClientInput: + { + return "AwsCryptographyMaterialProvidersTypes.GetClientInput.GetClientInput" + "(" + _dafny.String(data.Region) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetClientInput) Equals(other GetClientInput) bool { + switch data1 := _this.Get_().(type) { + case GetClientInput_GetClientInput: + { + data2, ok := other.Get_().(GetClientInput_GetClientInput) + return ok && data1.Region.Equals(data2.Region) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetClientInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetClientInput) + return ok && _this.Equals(typed) +} + +func Type_GetClientInput_() _dafny.TypeDescriptor { + return type_GetClientInput_{} +} + +type type_GetClientInput_ struct { +} + +func (_this type_GetClientInput_) Default() interface{} { + return Companion_GetClientInput_.Default() +} + +func (_this type_GetClientInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetClientInput" +} +func (_this GetClientInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetClientInput{} + +// End of datatype GetClientInput + +// Definition of datatype GetEncryptionMaterialsInput +type GetEncryptionMaterialsInput struct { + Data_GetEncryptionMaterialsInput_ +} + +func (_this GetEncryptionMaterialsInput) Get_() Data_GetEncryptionMaterialsInput_ { + return _this.Data_GetEncryptionMaterialsInput_ +} + +type Data_GetEncryptionMaterialsInput_ interface { + isGetEncryptionMaterialsInput() +} + +type CompanionStruct_GetEncryptionMaterialsInput_ struct { +} + +var Companion_GetEncryptionMaterialsInput_ = CompanionStruct_GetEncryptionMaterialsInput_{} + +type GetEncryptionMaterialsInput_GetEncryptionMaterialsInput struct { + EncryptionContext _dafny.Map + CommitmentPolicy CommitmentPolicy + AlgorithmSuiteId m_Wrappers.Option + MaxPlaintextLength m_Wrappers.Option + RequiredEncryptionContextKeys m_Wrappers.Option +} + +func (GetEncryptionMaterialsInput_GetEncryptionMaterialsInput) isGetEncryptionMaterialsInput() {} + +func (CompanionStruct_GetEncryptionMaterialsInput_) Create_GetEncryptionMaterialsInput_(EncryptionContext _dafny.Map, CommitmentPolicy CommitmentPolicy, AlgorithmSuiteId m_Wrappers.Option, MaxPlaintextLength m_Wrappers.Option, RequiredEncryptionContextKeys m_Wrappers.Option) GetEncryptionMaterialsInput { + return GetEncryptionMaterialsInput{GetEncryptionMaterialsInput_GetEncryptionMaterialsInput{EncryptionContext, CommitmentPolicy, AlgorithmSuiteId, MaxPlaintextLength, RequiredEncryptionContextKeys}} +} + +func (_this GetEncryptionMaterialsInput) Is_GetEncryptionMaterialsInput() bool { + _, ok := _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput) + return ok +} + +func (CompanionStruct_GetEncryptionMaterialsInput_) Default() GetEncryptionMaterialsInput { + return Companion_GetEncryptionMaterialsInput_.Create_GetEncryptionMaterialsInput_(_dafny.EmptyMap, Companion_CommitmentPolicy_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this GetEncryptionMaterialsInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput).EncryptionContext +} + +func (_this GetEncryptionMaterialsInput) Dtor_commitmentPolicy() CommitmentPolicy { + return _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput).CommitmentPolicy +} + +func (_this GetEncryptionMaterialsInput) Dtor_algorithmSuiteId() m_Wrappers.Option { + return _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput).AlgorithmSuiteId +} + +func (_this GetEncryptionMaterialsInput) Dtor_maxPlaintextLength() m_Wrappers.Option { + return _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput).MaxPlaintextLength +} + +func (_this GetEncryptionMaterialsInput) Dtor_requiredEncryptionContextKeys() m_Wrappers.Option { + return _this.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput).RequiredEncryptionContextKeys +} + +func (_this GetEncryptionMaterialsInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetEncryptionMaterialsInput_GetEncryptionMaterialsInput: + { + return "AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput.GetEncryptionMaterialsInput" + "(" + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.CommitmentPolicy) + ", " + _dafny.String(data.AlgorithmSuiteId) + ", " + _dafny.String(data.MaxPlaintextLength) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetEncryptionMaterialsInput) Equals(other GetEncryptionMaterialsInput) bool { + switch data1 := _this.Get_().(type) { + case GetEncryptionMaterialsInput_GetEncryptionMaterialsInput: + { + data2, ok := other.Get_().(GetEncryptionMaterialsInput_GetEncryptionMaterialsInput) + return ok && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.CommitmentPolicy.Equals(data2.CommitmentPolicy) && data1.AlgorithmSuiteId.Equals(data2.AlgorithmSuiteId) && data1.MaxPlaintextLength.Equals(data2.MaxPlaintextLength) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetEncryptionMaterialsInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetEncryptionMaterialsInput) + return ok && _this.Equals(typed) +} + +func Type_GetEncryptionMaterialsInput_() _dafny.TypeDescriptor { + return type_GetEncryptionMaterialsInput_{} +} + +type type_GetEncryptionMaterialsInput_ struct { +} + +func (_this type_GetEncryptionMaterialsInput_) Default() interface{} { + return Companion_GetEncryptionMaterialsInput_.Default() +} + +func (_this type_GetEncryptionMaterialsInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput" +} +func (_this GetEncryptionMaterialsInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetEncryptionMaterialsInput{} + +// End of datatype GetEncryptionMaterialsInput + +// Definition of datatype GetEncryptionMaterialsOutput +type GetEncryptionMaterialsOutput struct { + Data_GetEncryptionMaterialsOutput_ +} + +func (_this GetEncryptionMaterialsOutput) Get_() Data_GetEncryptionMaterialsOutput_ { + return _this.Data_GetEncryptionMaterialsOutput_ +} + +type Data_GetEncryptionMaterialsOutput_ interface { + isGetEncryptionMaterialsOutput() +} + +type CompanionStruct_GetEncryptionMaterialsOutput_ struct { +} + +var Companion_GetEncryptionMaterialsOutput_ = CompanionStruct_GetEncryptionMaterialsOutput_{} + +type GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput struct { + EncryptionMaterials EncryptionMaterials +} + +func (GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput) isGetEncryptionMaterialsOutput() {} + +func (CompanionStruct_GetEncryptionMaterialsOutput_) Create_GetEncryptionMaterialsOutput_(EncryptionMaterials EncryptionMaterials) GetEncryptionMaterialsOutput { + return GetEncryptionMaterialsOutput{GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput{EncryptionMaterials}} +} + +func (_this GetEncryptionMaterialsOutput) Is_GetEncryptionMaterialsOutput() bool { + _, ok := _this.Get_().(GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput) + return ok +} + +func (CompanionStruct_GetEncryptionMaterialsOutput_) Default() GetEncryptionMaterialsOutput { + return Companion_GetEncryptionMaterialsOutput_.Create_GetEncryptionMaterialsOutput_(Companion_EncryptionMaterials_.Default()) +} + +func (_this GetEncryptionMaterialsOutput) Dtor_encryptionMaterials() EncryptionMaterials { + return _this.Get_().(GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput).EncryptionMaterials +} + +func (_this GetEncryptionMaterialsOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput: + { + return "AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput.GetEncryptionMaterialsOutput" + "(" + _dafny.String(data.EncryptionMaterials) + ")" + } + default: + { + return "" + } + } +} + +func (_this GetEncryptionMaterialsOutput) Equals(other GetEncryptionMaterialsOutput) bool { + switch data1 := _this.Get_().(type) { + case GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput: + { + data2, ok := other.Get_().(GetEncryptionMaterialsOutput_GetEncryptionMaterialsOutput) + return ok && data1.EncryptionMaterials.Equals(data2.EncryptionMaterials) + } + default: + { + return false // unexpected + } + } +} + +func (_this GetEncryptionMaterialsOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GetEncryptionMaterialsOutput) + return ok && _this.Equals(typed) +} + +func Type_GetEncryptionMaterialsOutput_() _dafny.TypeDescriptor { + return type_GetEncryptionMaterialsOutput_{} +} + +type type_GetEncryptionMaterialsOutput_ struct { +} + +func (_this type_GetEncryptionMaterialsOutput_) Default() interface{} { + return Companion_GetEncryptionMaterialsOutput_.Default() +} + +func (_this type_GetEncryptionMaterialsOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput" +} +func (_this GetEncryptionMaterialsOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GetEncryptionMaterialsOutput{} + +// End of datatype GetEncryptionMaterialsOutput + +// Definition of datatype HKDF +type HKDF struct { + Data_HKDF_ +} + +func (_this HKDF) Get_() Data_HKDF_ { + return _this.Data_HKDF_ +} + +type Data_HKDF_ interface { + isHKDF() +} + +type CompanionStruct_HKDF_ struct { +} + +var Companion_HKDF_ = CompanionStruct_HKDF_{} + +type HKDF_HKDF struct { + Hmac m_AwsCryptographyPrimitivesTypes.DigestAlgorithm + SaltLength int32 + InputKeyLength int32 + OutputKeyLength int32 +} + +func (HKDF_HKDF) isHKDF() {} + +func (CompanionStruct_HKDF_) Create_HKDF_(Hmac m_AwsCryptographyPrimitivesTypes.DigestAlgorithm, SaltLength int32, InputKeyLength int32, OutputKeyLength int32) HKDF { + return HKDF{HKDF_HKDF{Hmac, SaltLength, InputKeyLength, OutputKeyLength}} +} + +func (_this HKDF) Is_HKDF() bool { + _, ok := _this.Get_().(HKDF_HKDF) + return ok +} + +func (CompanionStruct_HKDF_) Default() HKDF { + return Companion_HKDF_.Create_HKDF_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Default(), int32(0), int32(0), int32(0)) +} + +func (_this HKDF) Dtor_hmac() m_AwsCryptographyPrimitivesTypes.DigestAlgorithm { + return _this.Get_().(HKDF_HKDF).Hmac +} + +func (_this HKDF) Dtor_saltLength() int32 { + return _this.Get_().(HKDF_HKDF).SaltLength +} + +func (_this HKDF) Dtor_inputKeyLength() int32 { + return _this.Get_().(HKDF_HKDF).InputKeyLength +} + +func (_this HKDF) Dtor_outputKeyLength() int32 { + return _this.Get_().(HKDF_HKDF).OutputKeyLength +} + +func (_this HKDF) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case HKDF_HKDF: + { + return "AwsCryptographyMaterialProvidersTypes.HKDF.HKDF" + "(" + _dafny.String(data.Hmac) + ", " + _dafny.String(data.SaltLength) + ", " + _dafny.String(data.InputKeyLength) + ", " + _dafny.String(data.OutputKeyLength) + ")" + } + default: + { + return "" + } + } +} + +func (_this HKDF) Equals(other HKDF) bool { + switch data1 := _this.Get_().(type) { + case HKDF_HKDF: + { + data2, ok := other.Get_().(HKDF_HKDF) + return ok && data1.Hmac.Equals(data2.Hmac) && data1.SaltLength == data2.SaltLength && data1.InputKeyLength == data2.InputKeyLength && data1.OutputKeyLength == data2.OutputKeyLength + } + default: + { + return false // unexpected + } + } +} + +func (_this HKDF) EqualsGeneric(other interface{}) bool { + typed, ok := other.(HKDF) + return ok && _this.Equals(typed) +} + +func Type_HKDF_() _dafny.TypeDescriptor { + return type_HKDF_{} +} + +type type_HKDF_ struct { +} + +func (_this type_HKDF_) Default() interface{} { + return Companion_HKDF_.Default() +} + +func (_this type_HKDF_) String() string { + return "AwsCryptographyMaterialProvidersTypes.HKDF" +} +func (_this HKDF) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = HKDF{} + +// End of datatype HKDF + +// Definition of datatype IDENTITY +type IDENTITY struct { + Data_IDENTITY_ +} + +func (_this IDENTITY) Get_() Data_IDENTITY_ { + return _this.Data_IDENTITY_ +} + +type Data_IDENTITY_ interface { + isIDENTITY() +} + +type CompanionStruct_IDENTITY_ struct { +} + +var Companion_IDENTITY_ = CompanionStruct_IDENTITY_{} + +type IDENTITY_IDENTITY struct { +} + +func (IDENTITY_IDENTITY) isIDENTITY() {} + +func (CompanionStruct_IDENTITY_) Create_IDENTITY_() IDENTITY { + return IDENTITY{IDENTITY_IDENTITY{}} +} + +func (_this IDENTITY) Is_IDENTITY() bool { + _, ok := _this.Get_().(IDENTITY_IDENTITY) + return ok +} + +func (CompanionStruct_IDENTITY_) Default() IDENTITY { + return Companion_IDENTITY_.Create_IDENTITY_() +} + +func (_ CompanionStruct_IDENTITY_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_IDENTITY_.Create_IDENTITY_(), true + default: + return IDENTITY{}, false + } + } +} + +func (_this IDENTITY) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case IDENTITY_IDENTITY: + { + return "AwsCryptographyMaterialProvidersTypes.IDENTITY.IDENTITY" + } + default: + { + return "" + } + } +} + +func (_this IDENTITY) Equals(other IDENTITY) bool { + switch _this.Get_().(type) { + case IDENTITY_IDENTITY: + { + _, ok := other.Get_().(IDENTITY_IDENTITY) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this IDENTITY) EqualsGeneric(other interface{}) bool { + typed, ok := other.(IDENTITY) + return ok && _this.Equals(typed) +} + +func Type_IDENTITY_() _dafny.TypeDescriptor { + return type_IDENTITY_{} +} + +type type_IDENTITY_ struct { +} + +func (_this type_IDENTITY_) Default() interface{} { + return Companion_IDENTITY_.Default() +} + +func (_this type_IDENTITY_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IDENTITY" +} +func (_this IDENTITY) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = IDENTITY{} + +// End of datatype IDENTITY + +// Definition of datatype InitializeDecryptionMaterialsInput +type InitializeDecryptionMaterialsInput struct { + Data_InitializeDecryptionMaterialsInput_ +} + +func (_this InitializeDecryptionMaterialsInput) Get_() Data_InitializeDecryptionMaterialsInput_ { + return _this.Data_InitializeDecryptionMaterialsInput_ +} + +type Data_InitializeDecryptionMaterialsInput_ interface { + isInitializeDecryptionMaterialsInput() +} + +type CompanionStruct_InitializeDecryptionMaterialsInput_ struct { +} + +var Companion_InitializeDecryptionMaterialsInput_ = CompanionStruct_InitializeDecryptionMaterialsInput_{} + +type InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + EncryptionContext _dafny.Map + RequiredEncryptionContextKeys _dafny.Sequence +} + +func (InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput) isInitializeDecryptionMaterialsInput() { +} + +func (CompanionStruct_InitializeDecryptionMaterialsInput_) Create_InitializeDecryptionMaterialsInput_(AlgorithmSuiteId AlgorithmSuiteId, EncryptionContext _dafny.Map, RequiredEncryptionContextKeys _dafny.Sequence) InitializeDecryptionMaterialsInput { + return InitializeDecryptionMaterialsInput{InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput{AlgorithmSuiteId, EncryptionContext, RequiredEncryptionContextKeys}} +} + +func (_this InitializeDecryptionMaterialsInput) Is_InitializeDecryptionMaterialsInput() bool { + _, ok := _this.Get_().(InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput) + return ok +} + +func (CompanionStruct_InitializeDecryptionMaterialsInput_) Default() InitializeDecryptionMaterialsInput { + return Companion_InitializeDecryptionMaterialsInput_.Create_InitializeDecryptionMaterialsInput_(Companion_AlgorithmSuiteId_.Default(), _dafny.EmptyMap, _dafny.EmptySeq) +} + +func (_this InitializeDecryptionMaterialsInput) Dtor_algorithmSuiteId() AlgorithmSuiteId { + return _this.Get_().(InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput).AlgorithmSuiteId +} + +func (_this InitializeDecryptionMaterialsInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput).EncryptionContext +} + +func (_this InitializeDecryptionMaterialsInput) Dtor_requiredEncryptionContextKeys() _dafny.Sequence { + return _this.Get_().(InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput).RequiredEncryptionContextKeys +} + +func (_this InitializeDecryptionMaterialsInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput: + { + return "AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput.InitializeDecryptionMaterialsInput" + "(" + _dafny.String(data.AlgorithmSuiteId) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this InitializeDecryptionMaterialsInput) Equals(other InitializeDecryptionMaterialsInput) bool { + switch data1 := _this.Get_().(type) { + case InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput: + { + data2, ok := other.Get_().(InitializeDecryptionMaterialsInput_InitializeDecryptionMaterialsInput) + return ok && data1.AlgorithmSuiteId.Equals(data2.AlgorithmSuiteId) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this InitializeDecryptionMaterialsInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(InitializeDecryptionMaterialsInput) + return ok && _this.Equals(typed) +} + +func Type_InitializeDecryptionMaterialsInput_() _dafny.TypeDescriptor { + return type_InitializeDecryptionMaterialsInput_{} +} + +type type_InitializeDecryptionMaterialsInput_ struct { +} + +func (_this type_InitializeDecryptionMaterialsInput_) Default() interface{} { + return Companion_InitializeDecryptionMaterialsInput_.Default() +} + +func (_this type_InitializeDecryptionMaterialsInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput" +} +func (_this InitializeDecryptionMaterialsInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = InitializeDecryptionMaterialsInput{} + +// End of datatype InitializeDecryptionMaterialsInput + +// Definition of datatype InitializeEncryptionMaterialsInput +type InitializeEncryptionMaterialsInput struct { + Data_InitializeEncryptionMaterialsInput_ +} + +func (_this InitializeEncryptionMaterialsInput) Get_() Data_InitializeEncryptionMaterialsInput_ { + return _this.Data_InitializeEncryptionMaterialsInput_ +} + +type Data_InitializeEncryptionMaterialsInput_ interface { + isInitializeEncryptionMaterialsInput() +} + +type CompanionStruct_InitializeEncryptionMaterialsInput_ struct { +} + +var Companion_InitializeEncryptionMaterialsInput_ = CompanionStruct_InitializeEncryptionMaterialsInput_{} + +type InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + EncryptionContext _dafny.Map + RequiredEncryptionContextKeys _dafny.Sequence + SigningKey m_Wrappers.Option + VerificationKey m_Wrappers.Option +} + +func (InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput) isInitializeEncryptionMaterialsInput() { +} + +func (CompanionStruct_InitializeEncryptionMaterialsInput_) Create_InitializeEncryptionMaterialsInput_(AlgorithmSuiteId AlgorithmSuiteId, EncryptionContext _dafny.Map, RequiredEncryptionContextKeys _dafny.Sequence, SigningKey m_Wrappers.Option, VerificationKey m_Wrappers.Option) InitializeEncryptionMaterialsInput { + return InitializeEncryptionMaterialsInput{InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput{AlgorithmSuiteId, EncryptionContext, RequiredEncryptionContextKeys, SigningKey, VerificationKey}} +} + +func (_this InitializeEncryptionMaterialsInput) Is_InitializeEncryptionMaterialsInput() bool { + _, ok := _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput) + return ok +} + +func (CompanionStruct_InitializeEncryptionMaterialsInput_) Default() InitializeEncryptionMaterialsInput { + return Companion_InitializeEncryptionMaterialsInput_.Create_InitializeEncryptionMaterialsInput_(Companion_AlgorithmSuiteId_.Default(), _dafny.EmptyMap, _dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this InitializeEncryptionMaterialsInput) Dtor_algorithmSuiteId() AlgorithmSuiteId { + return _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput).AlgorithmSuiteId +} + +func (_this InitializeEncryptionMaterialsInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput).EncryptionContext +} + +func (_this InitializeEncryptionMaterialsInput) Dtor_requiredEncryptionContextKeys() _dafny.Sequence { + return _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput).RequiredEncryptionContextKeys +} + +func (_this InitializeEncryptionMaterialsInput) Dtor_signingKey() m_Wrappers.Option { + return _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput).SigningKey +} + +func (_this InitializeEncryptionMaterialsInput) Dtor_verificationKey() m_Wrappers.Option { + return _this.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput).VerificationKey +} + +func (_this InitializeEncryptionMaterialsInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput: + { + return "AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput.InitializeEncryptionMaterialsInput" + "(" + _dafny.String(data.AlgorithmSuiteId) + ", " + _dafny.String(data.EncryptionContext) + ", " + _dafny.String(data.RequiredEncryptionContextKeys) + ", " + _dafny.String(data.SigningKey) + ", " + _dafny.String(data.VerificationKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this InitializeEncryptionMaterialsInput) Equals(other InitializeEncryptionMaterialsInput) bool { + switch data1 := _this.Get_().(type) { + case InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput: + { + data2, ok := other.Get_().(InitializeEncryptionMaterialsInput_InitializeEncryptionMaterialsInput) + return ok && data1.AlgorithmSuiteId.Equals(data2.AlgorithmSuiteId) && data1.EncryptionContext.Equals(data2.EncryptionContext) && data1.RequiredEncryptionContextKeys.Equals(data2.RequiredEncryptionContextKeys) && data1.SigningKey.Equals(data2.SigningKey) && data1.VerificationKey.Equals(data2.VerificationKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this InitializeEncryptionMaterialsInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(InitializeEncryptionMaterialsInput) + return ok && _this.Equals(typed) +} + +func Type_InitializeEncryptionMaterialsInput_() _dafny.TypeDescriptor { + return type_InitializeEncryptionMaterialsInput_{} +} + +type type_InitializeEncryptionMaterialsInput_ struct { +} + +func (_this type_InitializeEncryptionMaterialsInput_) Default() interface{} { + return Companion_InitializeEncryptionMaterialsInput_.Default() +} + +func (_this type_InitializeEncryptionMaterialsInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput" +} +func (_this InitializeEncryptionMaterialsInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = InitializeEncryptionMaterialsInput{} + +// End of datatype InitializeEncryptionMaterialsInput + +// Definition of datatype IntermediateKeyWrapping +type IntermediateKeyWrapping struct { + Data_IntermediateKeyWrapping_ +} + +func (_this IntermediateKeyWrapping) Get_() Data_IntermediateKeyWrapping_ { + return _this.Data_IntermediateKeyWrapping_ +} + +type Data_IntermediateKeyWrapping_ interface { + isIntermediateKeyWrapping() +} + +type CompanionStruct_IntermediateKeyWrapping_ struct { +} + +var Companion_IntermediateKeyWrapping_ = CompanionStruct_IntermediateKeyWrapping_{} + +type IntermediateKeyWrapping_IntermediateKeyWrapping struct { + KeyEncryptionKeyKdf DerivationAlgorithm + MacKeyKdf DerivationAlgorithm + PdkEncryptAlgorithm Encrypt +} + +func (IntermediateKeyWrapping_IntermediateKeyWrapping) isIntermediateKeyWrapping() {} + +func (CompanionStruct_IntermediateKeyWrapping_) Create_IntermediateKeyWrapping_(KeyEncryptionKeyKdf DerivationAlgorithm, MacKeyKdf DerivationAlgorithm, PdkEncryptAlgorithm Encrypt) IntermediateKeyWrapping { + return IntermediateKeyWrapping{IntermediateKeyWrapping_IntermediateKeyWrapping{KeyEncryptionKeyKdf, MacKeyKdf, PdkEncryptAlgorithm}} +} + +func (_this IntermediateKeyWrapping) Is_IntermediateKeyWrapping() bool { + _, ok := _this.Get_().(IntermediateKeyWrapping_IntermediateKeyWrapping) + return ok +} + +func (CompanionStruct_IntermediateKeyWrapping_) Default() IntermediateKeyWrapping { + return Companion_IntermediateKeyWrapping_.Create_IntermediateKeyWrapping_(Companion_DerivationAlgorithm_.Default(), Companion_DerivationAlgorithm_.Default(), Companion_Encrypt_.Default()) +} + +func (_this IntermediateKeyWrapping) Dtor_keyEncryptionKeyKdf() DerivationAlgorithm { + return _this.Get_().(IntermediateKeyWrapping_IntermediateKeyWrapping).KeyEncryptionKeyKdf +} + +func (_this IntermediateKeyWrapping) Dtor_macKeyKdf() DerivationAlgorithm { + return _this.Get_().(IntermediateKeyWrapping_IntermediateKeyWrapping).MacKeyKdf +} + +func (_this IntermediateKeyWrapping) Dtor_pdkEncryptAlgorithm() Encrypt { + return _this.Get_().(IntermediateKeyWrapping_IntermediateKeyWrapping).PdkEncryptAlgorithm +} + +func (_this IntermediateKeyWrapping) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case IntermediateKeyWrapping_IntermediateKeyWrapping: + { + return "AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping.IntermediateKeyWrapping" + "(" + _dafny.String(data.KeyEncryptionKeyKdf) + ", " + _dafny.String(data.MacKeyKdf) + ", " + _dafny.String(data.PdkEncryptAlgorithm) + ")" + } + default: + { + return "" + } + } +} + +func (_this IntermediateKeyWrapping) Equals(other IntermediateKeyWrapping) bool { + switch data1 := _this.Get_().(type) { + case IntermediateKeyWrapping_IntermediateKeyWrapping: + { + data2, ok := other.Get_().(IntermediateKeyWrapping_IntermediateKeyWrapping) + return ok && data1.KeyEncryptionKeyKdf.Equals(data2.KeyEncryptionKeyKdf) && data1.MacKeyKdf.Equals(data2.MacKeyKdf) && data1.PdkEncryptAlgorithm.Equals(data2.PdkEncryptAlgorithm) + } + default: + { + return false // unexpected + } + } +} + +func (_this IntermediateKeyWrapping) EqualsGeneric(other interface{}) bool { + typed, ok := other.(IntermediateKeyWrapping) + return ok && _this.Equals(typed) +} + +func Type_IntermediateKeyWrapping_() _dafny.TypeDescriptor { + return type_IntermediateKeyWrapping_{} +} + +type type_IntermediateKeyWrapping_ struct { +} + +func (_this type_IntermediateKeyWrapping_) Default() interface{} { + return Companion_IntermediateKeyWrapping_.Default() +} + +func (_this type_IntermediateKeyWrapping_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping" +} +func (_this IntermediateKeyWrapping) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = IntermediateKeyWrapping{} + +// End of datatype IntermediateKeyWrapping + +// Definition of datatype KeyAgreementScheme +type KeyAgreementScheme struct { + Data_KeyAgreementScheme_ +} + +func (_this KeyAgreementScheme) Get_() Data_KeyAgreementScheme_ { + return _this.Data_KeyAgreementScheme_ +} + +type Data_KeyAgreementScheme_ interface { + isKeyAgreementScheme() +} + +type CompanionStruct_KeyAgreementScheme_ struct { +} + +var Companion_KeyAgreementScheme_ = CompanionStruct_KeyAgreementScheme_{} + +type KeyAgreementScheme_StaticConfiguration struct { + StaticConfiguration StaticConfigurations +} + +func (KeyAgreementScheme_StaticConfiguration) isKeyAgreementScheme() {} + +func (CompanionStruct_KeyAgreementScheme_) Create_StaticConfiguration_(StaticConfiguration StaticConfigurations) KeyAgreementScheme { + return KeyAgreementScheme{KeyAgreementScheme_StaticConfiguration{StaticConfiguration}} +} + +func (_this KeyAgreementScheme) Is_StaticConfiguration() bool { + _, ok := _this.Get_().(KeyAgreementScheme_StaticConfiguration) + return ok +} + +func (CompanionStruct_KeyAgreementScheme_) Default() KeyAgreementScheme { + return Companion_KeyAgreementScheme_.Create_StaticConfiguration_(Companion_StaticConfigurations_.Default()) +} + +func (_this KeyAgreementScheme) Dtor_StaticConfiguration() StaticConfigurations { + return _this.Get_().(KeyAgreementScheme_StaticConfiguration).StaticConfiguration +} + +func (_this KeyAgreementScheme) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KeyAgreementScheme_StaticConfiguration: + { + return "AwsCryptographyMaterialProvidersTypes.KeyAgreementScheme.StaticConfiguration" + "(" + _dafny.String(data.StaticConfiguration) + ")" + } + default: + { + return "" + } + } +} + +func (_this KeyAgreementScheme) Equals(other KeyAgreementScheme) bool { + switch data1 := _this.Get_().(type) { + case KeyAgreementScheme_StaticConfiguration: + { + data2, ok := other.Get_().(KeyAgreementScheme_StaticConfiguration) + return ok && data1.StaticConfiguration.Equals(data2.StaticConfiguration) + } + default: + { + return false // unexpected + } + } +} + +func (_this KeyAgreementScheme) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KeyAgreementScheme) + return ok && _this.Equals(typed) +} + +func Type_KeyAgreementScheme_() _dafny.TypeDescriptor { + return type_KeyAgreementScheme_{} +} + +type type_KeyAgreementScheme_ struct { +} + +func (_this type_KeyAgreementScheme_) Default() interface{} { + return Companion_KeyAgreementScheme_.Default() +} + +func (_this type_KeyAgreementScheme_) String() string { + return "AwsCryptographyMaterialProvidersTypes.KeyAgreementScheme" +} +func (_this KeyAgreementScheme) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KeyAgreementScheme{} + +// End of datatype KeyAgreementScheme + +// Definition of class IKeyringCallHistory +type IKeyringCallHistory struct { + dummy byte +} + +func New_IKeyringCallHistory_() *IKeyringCallHistory { + _this := IKeyringCallHistory{} + + return &_this +} + +type CompanionStruct_IKeyringCallHistory_ struct { +} + +var Companion_IKeyringCallHistory_ = CompanionStruct_IKeyringCallHistory_{} + +func (_this *IKeyringCallHistory) Equals(other *IKeyringCallHistory) bool { + return _this == other +} + +func (_this *IKeyringCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IKeyringCallHistory) + return ok && _this.Equals(other) +} + +func (*IKeyringCallHistory) String() string { + return "AwsCryptographyMaterialProvidersTypes.IKeyringCallHistory" +} + +func Type_IKeyringCallHistory_() _dafny.TypeDescriptor { + return type_IKeyringCallHistory_{} +} + +type type_IKeyringCallHistory_ struct { +} + +func (_this type_IKeyringCallHistory_) Default() interface{} { + return (*IKeyringCallHistory)(nil) +} + +func (_this type_IKeyringCallHistory_) String() string { + return "AwsCryptographyMaterialProvidersTypes.IKeyringCallHistory" +} +func (_this *IKeyringCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IKeyringCallHistory{} + +// End of class IKeyringCallHistory + +// Definition of trait IKeyring +type IKeyring interface { + String() string + OnEncrypt(input OnEncryptInput) m_Wrappers.Result + OnEncrypt_k(input OnEncryptInput) m_Wrappers.Result + OnDecrypt(input OnDecryptInput) m_Wrappers.Result + OnDecrypt_k(input OnDecryptInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_IKeyring_) OnEncrypt(_this IKeyring, input OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).OnEncrypt_k(input) + output = _out0 + return output + } +} +func (_static *CompanionStruct_IKeyring_) OnDecrypt(_this IKeyring, input OnDecryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).OnDecrypt_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_IKeyring_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IKeyring_ = CompanionStruct_IKeyring_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IKeyring_) CastTo_(x interface{}) IKeyring { + var t IKeyring + t, _ = x.(IKeyring) + return t +} + +// End of trait IKeyring + +// Definition of datatype KmsEcdhStaticConfigurations +type KmsEcdhStaticConfigurations struct { + Data_KmsEcdhStaticConfigurations_ +} + +func (_this KmsEcdhStaticConfigurations) Get_() Data_KmsEcdhStaticConfigurations_ { + return _this.Data_KmsEcdhStaticConfigurations_ +} + +type Data_KmsEcdhStaticConfigurations_ interface { + isKmsEcdhStaticConfigurations() +} + +type CompanionStruct_KmsEcdhStaticConfigurations_ struct { +} + +var Companion_KmsEcdhStaticConfigurations_ = CompanionStruct_KmsEcdhStaticConfigurations_{} + +type KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery struct { + KmsPublicKeyDiscovery KmsPublicKeyDiscoveryInput +} + +func (KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery) isKmsEcdhStaticConfigurations() {} + +func (CompanionStruct_KmsEcdhStaticConfigurations_) Create_KmsPublicKeyDiscovery_(KmsPublicKeyDiscovery KmsPublicKeyDiscoveryInput) KmsEcdhStaticConfigurations { + return KmsEcdhStaticConfigurations{KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery{KmsPublicKeyDiscovery}} +} + +func (_this KmsEcdhStaticConfigurations) Is_KmsPublicKeyDiscovery() bool { + _, ok := _this.Get_().(KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery) + return ok +} + +type KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey struct { + KmsPrivateKeyToStaticPublicKey KmsPrivateKeyToStaticPublicKeyInput +} + +func (KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey) isKmsEcdhStaticConfigurations() {} + +func (CompanionStruct_KmsEcdhStaticConfigurations_) Create_KmsPrivateKeyToStaticPublicKey_(KmsPrivateKeyToStaticPublicKey KmsPrivateKeyToStaticPublicKeyInput) KmsEcdhStaticConfigurations { + return KmsEcdhStaticConfigurations{KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey{KmsPrivateKeyToStaticPublicKey}} +} + +func (_this KmsEcdhStaticConfigurations) Is_KmsPrivateKeyToStaticPublicKey() bool { + _, ok := _this.Get_().(KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey) + return ok +} + +func (CompanionStruct_KmsEcdhStaticConfigurations_) Default() KmsEcdhStaticConfigurations { + return Companion_KmsEcdhStaticConfigurations_.Create_KmsPublicKeyDiscovery_(Companion_KmsPublicKeyDiscoveryInput_.Default()) +} + +func (_this KmsEcdhStaticConfigurations) Dtor_KmsPublicKeyDiscovery() KmsPublicKeyDiscoveryInput { + return _this.Get_().(KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery).KmsPublicKeyDiscovery +} + +func (_this KmsEcdhStaticConfigurations) Dtor_KmsPrivateKeyToStaticPublicKey() KmsPrivateKeyToStaticPublicKeyInput { + return _this.Get_().(KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey).KmsPrivateKeyToStaticPublicKey +} + +func (_this KmsEcdhStaticConfigurations) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery: + { + return "AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations.KmsPublicKeyDiscovery" + "(" + _dafny.String(data.KmsPublicKeyDiscovery) + ")" + } + case KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey: + { + return "AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations.KmsPrivateKeyToStaticPublicKey" + "(" + _dafny.String(data.KmsPrivateKeyToStaticPublicKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this KmsEcdhStaticConfigurations) Equals(other KmsEcdhStaticConfigurations) bool { + switch data1 := _this.Get_().(type) { + case KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery: + { + data2, ok := other.Get_().(KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery) + return ok && data1.KmsPublicKeyDiscovery.Equals(data2.KmsPublicKeyDiscovery) + } + case KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey: + { + data2, ok := other.Get_().(KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey) + return ok && data1.KmsPrivateKeyToStaticPublicKey.Equals(data2.KmsPrivateKeyToStaticPublicKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsEcdhStaticConfigurations) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsEcdhStaticConfigurations) + return ok && _this.Equals(typed) +} + +func Type_KmsEcdhStaticConfigurations_() _dafny.TypeDescriptor { + return type_KmsEcdhStaticConfigurations_{} +} + +type type_KmsEcdhStaticConfigurations_ struct { +} + +func (_this type_KmsEcdhStaticConfigurations_) Default() interface{} { + return Companion_KmsEcdhStaticConfigurations_.Default() +} + +func (_this type_KmsEcdhStaticConfigurations_) String() string { + return "AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations" +} +func (_this KmsEcdhStaticConfigurations) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsEcdhStaticConfigurations{} + +// End of datatype KmsEcdhStaticConfigurations + +// Definition of datatype KmsPrivateKeyToStaticPublicKeyInput +type KmsPrivateKeyToStaticPublicKeyInput struct { + Data_KmsPrivateKeyToStaticPublicKeyInput_ +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Get_() Data_KmsPrivateKeyToStaticPublicKeyInput_ { + return _this.Data_KmsPrivateKeyToStaticPublicKeyInput_ +} + +type Data_KmsPrivateKeyToStaticPublicKeyInput_ interface { + isKmsPrivateKeyToStaticPublicKeyInput() +} + +type CompanionStruct_KmsPrivateKeyToStaticPublicKeyInput_ struct { +} + +var Companion_KmsPrivateKeyToStaticPublicKeyInput_ = CompanionStruct_KmsPrivateKeyToStaticPublicKeyInput_{} + +type KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput struct { + SenderKmsIdentifier _dafny.Sequence + SenderPublicKey m_Wrappers.Option + RecipientPublicKey _dafny.Sequence +} + +func (KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput) isKmsPrivateKeyToStaticPublicKeyInput() { +} + +func (CompanionStruct_KmsPrivateKeyToStaticPublicKeyInput_) Create_KmsPrivateKeyToStaticPublicKeyInput_(SenderKmsIdentifier _dafny.Sequence, SenderPublicKey m_Wrappers.Option, RecipientPublicKey _dafny.Sequence) KmsPrivateKeyToStaticPublicKeyInput { + return KmsPrivateKeyToStaticPublicKeyInput{KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput{SenderKmsIdentifier, SenderPublicKey, RecipientPublicKey}} +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Is_KmsPrivateKeyToStaticPublicKeyInput() bool { + _, ok := _this.Get_().(KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput) + return ok +} + +func (CompanionStruct_KmsPrivateKeyToStaticPublicKeyInput_) Default() KmsPrivateKeyToStaticPublicKeyInput { + return Companion_KmsPrivateKeyToStaticPublicKeyInput_.Create_KmsPrivateKeyToStaticPublicKeyInput_(_dafny.EmptySeq.SetString(), m_Wrappers.Companion_Option_.Default(), _dafny.EmptySeq) +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Dtor_senderKmsIdentifier() _dafny.Sequence { + return _this.Get_().(KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput).SenderKmsIdentifier +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Dtor_senderPublicKey() m_Wrappers.Option { + return _this.Get_().(KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput).SenderPublicKey +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Dtor_recipientPublicKey() _dafny.Sequence { + return _this.Get_().(KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput).RecipientPublicKey +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput: + { + return "AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput.KmsPrivateKeyToStaticPublicKeyInput" + "(" + _dafny.String(data.SenderKmsIdentifier) + ", " + _dafny.String(data.SenderPublicKey) + ", " + _dafny.String(data.RecipientPublicKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) Equals(other KmsPrivateKeyToStaticPublicKeyInput) bool { + switch data1 := _this.Get_().(type) { + case KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput: + { + data2, ok := other.Get_().(KmsPrivateKeyToStaticPublicKeyInput_KmsPrivateKeyToStaticPublicKeyInput) + return ok && data1.SenderKmsIdentifier.Equals(data2.SenderKmsIdentifier) && data1.SenderPublicKey.Equals(data2.SenderPublicKey) && data1.RecipientPublicKey.Equals(data2.RecipientPublicKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsPrivateKeyToStaticPublicKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsPrivateKeyToStaticPublicKeyInput) + return ok && _this.Equals(typed) +} + +func Type_KmsPrivateKeyToStaticPublicKeyInput_() _dafny.TypeDescriptor { + return type_KmsPrivateKeyToStaticPublicKeyInput_{} +} + +type type_KmsPrivateKeyToStaticPublicKeyInput_ struct { +} + +func (_this type_KmsPrivateKeyToStaticPublicKeyInput_) Default() interface{} { + return Companion_KmsPrivateKeyToStaticPublicKeyInput_.Default() +} + +func (_this type_KmsPrivateKeyToStaticPublicKeyInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput" +} +func (_this KmsPrivateKeyToStaticPublicKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsPrivateKeyToStaticPublicKeyInput{} + +// End of datatype KmsPrivateKeyToStaticPublicKeyInput + +// Definition of datatype KmsPublicKeyDiscoveryInput +type KmsPublicKeyDiscoveryInput struct { + Data_KmsPublicKeyDiscoveryInput_ +} + +func (_this KmsPublicKeyDiscoveryInput) Get_() Data_KmsPublicKeyDiscoveryInput_ { + return _this.Data_KmsPublicKeyDiscoveryInput_ +} + +type Data_KmsPublicKeyDiscoveryInput_ interface { + isKmsPublicKeyDiscoveryInput() +} + +type CompanionStruct_KmsPublicKeyDiscoveryInput_ struct { +} + +var Companion_KmsPublicKeyDiscoveryInput_ = CompanionStruct_KmsPublicKeyDiscoveryInput_{} + +type KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput struct { + RecipientKmsIdentifier _dafny.Sequence +} + +func (KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput) isKmsPublicKeyDiscoveryInput() {} + +func (CompanionStruct_KmsPublicKeyDiscoveryInput_) Create_KmsPublicKeyDiscoveryInput_(RecipientKmsIdentifier _dafny.Sequence) KmsPublicKeyDiscoveryInput { + return KmsPublicKeyDiscoveryInput{KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput{RecipientKmsIdentifier}} +} + +func (_this KmsPublicKeyDiscoveryInput) Is_KmsPublicKeyDiscoveryInput() bool { + _, ok := _this.Get_().(KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput) + return ok +} + +func (CompanionStruct_KmsPublicKeyDiscoveryInput_) Default() KmsPublicKeyDiscoveryInput { + return Companion_KmsPublicKeyDiscoveryInput_.Create_KmsPublicKeyDiscoveryInput_(_dafny.EmptySeq.SetString()) +} + +func (_this KmsPublicKeyDiscoveryInput) Dtor_recipientKmsIdentifier() _dafny.Sequence { + return _this.Get_().(KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput).RecipientKmsIdentifier +} + +func (_this KmsPublicKeyDiscoveryInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput: + { + return "AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput.KmsPublicKeyDiscoveryInput" + "(" + _dafny.String(data.RecipientKmsIdentifier) + ")" + } + default: + { + return "" + } + } +} + +func (_this KmsPublicKeyDiscoveryInput) Equals(other KmsPublicKeyDiscoveryInput) bool { + switch data1 := _this.Get_().(type) { + case KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput: + { + data2, ok := other.Get_().(KmsPublicKeyDiscoveryInput_KmsPublicKeyDiscoveryInput) + return ok && data1.RecipientKmsIdentifier.Equals(data2.RecipientKmsIdentifier) + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsPublicKeyDiscoveryInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsPublicKeyDiscoveryInput) + return ok && _this.Equals(typed) +} + +func Type_KmsPublicKeyDiscoveryInput_() _dafny.TypeDescriptor { + return type_KmsPublicKeyDiscoveryInput_{} +} + +type type_KmsPublicKeyDiscoveryInput_ struct { +} + +func (_this type_KmsPublicKeyDiscoveryInput_) Default() interface{} { + return Companion_KmsPublicKeyDiscoveryInput_.Default() +} + +func (_this type_KmsPublicKeyDiscoveryInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput" +} +func (_this KmsPublicKeyDiscoveryInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsPublicKeyDiscoveryInput{} + +// End of datatype KmsPublicKeyDiscoveryInput + +// Definition of datatype MaterialProvidersConfig +type MaterialProvidersConfig struct { + Data_MaterialProvidersConfig_ +} + +func (_this MaterialProvidersConfig) Get_() Data_MaterialProvidersConfig_ { + return _this.Data_MaterialProvidersConfig_ +} + +type Data_MaterialProvidersConfig_ interface { + isMaterialProvidersConfig() +} + +type CompanionStruct_MaterialProvidersConfig_ struct { +} + +var Companion_MaterialProvidersConfig_ = CompanionStruct_MaterialProvidersConfig_{} + +type MaterialProvidersConfig_MaterialProvidersConfig struct { +} + +func (MaterialProvidersConfig_MaterialProvidersConfig) isMaterialProvidersConfig() {} + +func (CompanionStruct_MaterialProvidersConfig_) Create_MaterialProvidersConfig_() MaterialProvidersConfig { + return MaterialProvidersConfig{MaterialProvidersConfig_MaterialProvidersConfig{}} +} + +func (_this MaterialProvidersConfig) Is_MaterialProvidersConfig() bool { + _, ok := _this.Get_().(MaterialProvidersConfig_MaterialProvidersConfig) + return ok +} + +func (CompanionStruct_MaterialProvidersConfig_) Default() MaterialProvidersConfig { + return Companion_MaterialProvidersConfig_.Create_MaterialProvidersConfig_() +} + +func (_ CompanionStruct_MaterialProvidersConfig_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_MaterialProvidersConfig_.Create_MaterialProvidersConfig_(), true + default: + return MaterialProvidersConfig{}, false + } + } +} + +func (_this MaterialProvidersConfig) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case MaterialProvidersConfig_MaterialProvidersConfig: + { + return "AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig.MaterialProvidersConfig" + } + default: + { + return "" + } + } +} + +func (_this MaterialProvidersConfig) Equals(other MaterialProvidersConfig) bool { + switch _this.Get_().(type) { + case MaterialProvidersConfig_MaterialProvidersConfig: + { + _, ok := other.Get_().(MaterialProvidersConfig_MaterialProvidersConfig) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this MaterialProvidersConfig) EqualsGeneric(other interface{}) bool { + typed, ok := other.(MaterialProvidersConfig) + return ok && _this.Equals(typed) +} + +func Type_MaterialProvidersConfig_() _dafny.TypeDescriptor { + return type_MaterialProvidersConfig_{} +} + +type type_MaterialProvidersConfig_ struct { +} + +func (_this type_MaterialProvidersConfig_) Default() interface{} { + return Companion_MaterialProvidersConfig_.Default() +} + +func (_this type_MaterialProvidersConfig_) String() string { + return "AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig" +} +func (_this MaterialProvidersConfig) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = MaterialProvidersConfig{} + +// End of datatype MaterialProvidersConfig + +// Definition of datatype Materials +type Materials struct { + Data_Materials_ +} + +func (_this Materials) Get_() Data_Materials_ { + return _this.Data_Materials_ +} + +type Data_Materials_ interface { + isMaterials() +} + +type CompanionStruct_Materials_ struct { +} + +var Companion_Materials_ = CompanionStruct_Materials_{} + +type Materials_Encryption struct { + Encryption EncryptionMaterials +} + +func (Materials_Encryption) isMaterials() {} + +func (CompanionStruct_Materials_) Create_Encryption_(Encryption EncryptionMaterials) Materials { + return Materials{Materials_Encryption{Encryption}} +} + +func (_this Materials) Is_Encryption() bool { + _, ok := _this.Get_().(Materials_Encryption) + return ok +} + +type Materials_Decryption struct { + Decryption DecryptionMaterials +} + +func (Materials_Decryption) isMaterials() {} + +func (CompanionStruct_Materials_) Create_Decryption_(Decryption DecryptionMaterials) Materials { + return Materials{Materials_Decryption{Decryption}} +} + +func (_this Materials) Is_Decryption() bool { + _, ok := _this.Get_().(Materials_Decryption) + return ok +} + +type Materials_BranchKey struct { + BranchKey m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials +} + +func (Materials_BranchKey) isMaterials() {} + +func (CompanionStruct_Materials_) Create_BranchKey_(BranchKey m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials) Materials { + return Materials{Materials_BranchKey{BranchKey}} +} + +func (_this Materials) Is_BranchKey() bool { + _, ok := _this.Get_().(Materials_BranchKey) + return ok +} + +type Materials_BeaconKey struct { + BeaconKey m_AwsCryptographyKeyStoreTypes.BeaconKeyMaterials +} + +func (Materials_BeaconKey) isMaterials() {} + +func (CompanionStruct_Materials_) Create_BeaconKey_(BeaconKey m_AwsCryptographyKeyStoreTypes.BeaconKeyMaterials) Materials { + return Materials{Materials_BeaconKey{BeaconKey}} +} + +func (_this Materials) Is_BeaconKey() bool { + _, ok := _this.Get_().(Materials_BeaconKey) + return ok +} + +func (CompanionStruct_Materials_) Default() Materials { + return Companion_Materials_.Create_Encryption_(Companion_EncryptionMaterials_.Default()) +} + +func (_this Materials) Dtor_Encryption() EncryptionMaterials { + return _this.Get_().(Materials_Encryption).Encryption +} + +func (_this Materials) Dtor_Decryption() DecryptionMaterials { + return _this.Get_().(Materials_Decryption).Decryption +} + +func (_this Materials) Dtor_BranchKey() m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials { + return _this.Get_().(Materials_BranchKey).BranchKey +} + +func (_this Materials) Dtor_BeaconKey() m_AwsCryptographyKeyStoreTypes.BeaconKeyMaterials { + return _this.Get_().(Materials_BeaconKey).BeaconKey +} + +func (_this Materials) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Materials_Encryption: + { + return "AwsCryptographyMaterialProvidersTypes.Materials.Encryption" + "(" + _dafny.String(data.Encryption) + ")" + } + case Materials_Decryption: + { + return "AwsCryptographyMaterialProvidersTypes.Materials.Decryption" + "(" + _dafny.String(data.Decryption) + ")" + } + case Materials_BranchKey: + { + return "AwsCryptographyMaterialProvidersTypes.Materials.BranchKey" + "(" + _dafny.String(data.BranchKey) + ")" + } + case Materials_BeaconKey: + { + return "AwsCryptographyMaterialProvidersTypes.Materials.BeaconKey" + "(" + _dafny.String(data.BeaconKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this Materials) Equals(other Materials) bool { + switch data1 := _this.Get_().(type) { + case Materials_Encryption: + { + data2, ok := other.Get_().(Materials_Encryption) + return ok && data1.Encryption.Equals(data2.Encryption) + } + case Materials_Decryption: + { + data2, ok := other.Get_().(Materials_Decryption) + return ok && data1.Decryption.Equals(data2.Decryption) + } + case Materials_BranchKey: + { + data2, ok := other.Get_().(Materials_BranchKey) + return ok && data1.BranchKey.Equals(data2.BranchKey) + } + case Materials_BeaconKey: + { + data2, ok := other.Get_().(Materials_BeaconKey) + return ok && data1.BeaconKey.Equals(data2.BeaconKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this Materials) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Materials) + return ok && _this.Equals(typed) +} + +func Type_Materials_() _dafny.TypeDescriptor { + return type_Materials_{} +} + +type type_Materials_ struct { +} + +func (_this type_Materials_) Default() interface{} { + return Companion_Materials_.Default() +} + +func (_this type_Materials_) String() string { + return "AwsCryptographyMaterialProvidersTypes.Materials" +} +func (_this Materials) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Materials{} + +// End of datatype Materials + +// Definition of datatype MultiThreadedCache +type MultiThreadedCache struct { + Data_MultiThreadedCache_ +} + +func (_this MultiThreadedCache) Get_() Data_MultiThreadedCache_ { + return _this.Data_MultiThreadedCache_ +} + +type Data_MultiThreadedCache_ interface { + isMultiThreadedCache() +} + +type CompanionStruct_MultiThreadedCache_ struct { +} + +var Companion_MultiThreadedCache_ = CompanionStruct_MultiThreadedCache_{} + +type MultiThreadedCache_MultiThreadedCache struct { + EntryCapacity int32 + EntryPruningTailSize m_Wrappers.Option +} + +func (MultiThreadedCache_MultiThreadedCache) isMultiThreadedCache() {} + +func (CompanionStruct_MultiThreadedCache_) Create_MultiThreadedCache_(EntryCapacity int32, EntryPruningTailSize m_Wrappers.Option) MultiThreadedCache { + return MultiThreadedCache{MultiThreadedCache_MultiThreadedCache{EntryCapacity, EntryPruningTailSize}} +} + +func (_this MultiThreadedCache) Is_MultiThreadedCache() bool { + _, ok := _this.Get_().(MultiThreadedCache_MultiThreadedCache) + return ok +} + +func (CompanionStruct_MultiThreadedCache_) Default() MultiThreadedCache { + return Companion_MultiThreadedCache_.Create_MultiThreadedCache_(int32(0), m_Wrappers.Companion_Option_.Default()) +} + +func (_this MultiThreadedCache) Dtor_entryCapacity() int32 { + return _this.Get_().(MultiThreadedCache_MultiThreadedCache).EntryCapacity +} + +func (_this MultiThreadedCache) Dtor_entryPruningTailSize() m_Wrappers.Option { + return _this.Get_().(MultiThreadedCache_MultiThreadedCache).EntryPruningTailSize +} + +func (_this MultiThreadedCache) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case MultiThreadedCache_MultiThreadedCache: + { + return "AwsCryptographyMaterialProvidersTypes.MultiThreadedCache.MultiThreadedCache" + "(" + _dafny.String(data.EntryCapacity) + ", " + _dafny.String(data.EntryPruningTailSize) + ")" + } + default: + { + return "" + } + } +} + +func (_this MultiThreadedCache) Equals(other MultiThreadedCache) bool { + switch data1 := _this.Get_().(type) { + case MultiThreadedCache_MultiThreadedCache: + { + data2, ok := other.Get_().(MultiThreadedCache_MultiThreadedCache) + return ok && data1.EntryCapacity == data2.EntryCapacity && data1.EntryPruningTailSize.Equals(data2.EntryPruningTailSize) + } + default: + { + return false // unexpected + } + } +} + +func (_this MultiThreadedCache) EqualsGeneric(other interface{}) bool { + typed, ok := other.(MultiThreadedCache) + return ok && _this.Equals(typed) +} + +func Type_MultiThreadedCache_() _dafny.TypeDescriptor { + return type_MultiThreadedCache_{} +} + +type type_MultiThreadedCache_ struct { +} + +func (_this type_MultiThreadedCache_) Default() interface{} { + return Companion_MultiThreadedCache_.Default() +} + +func (_this type_MultiThreadedCache_) String() string { + return "AwsCryptographyMaterialProvidersTypes.MultiThreadedCache" +} +func (_this MultiThreadedCache) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = MultiThreadedCache{} + +// End of datatype MultiThreadedCache + +// Definition of datatype NoCache +type NoCache struct { + Data_NoCache_ +} + +func (_this NoCache) Get_() Data_NoCache_ { + return _this.Data_NoCache_ +} + +type Data_NoCache_ interface { + isNoCache() +} + +type CompanionStruct_NoCache_ struct { +} + +var Companion_NoCache_ = CompanionStruct_NoCache_{} + +type NoCache_NoCache struct { +} + +func (NoCache_NoCache) isNoCache() {} + +func (CompanionStruct_NoCache_) Create_NoCache_() NoCache { + return NoCache{NoCache_NoCache{}} +} + +func (_this NoCache) Is_NoCache() bool { + _, ok := _this.Get_().(NoCache_NoCache) + return ok +} + +func (CompanionStruct_NoCache_) Default() NoCache { + return Companion_NoCache_.Create_NoCache_() +} + +func (_ CompanionStruct_NoCache_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_NoCache_.Create_NoCache_(), true + default: + return NoCache{}, false + } + } +} + +func (_this NoCache) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case NoCache_NoCache: + { + return "AwsCryptographyMaterialProvidersTypes.NoCache.NoCache" + } + default: + { + return "" + } + } +} + +func (_this NoCache) Equals(other NoCache) bool { + switch _this.Get_().(type) { + case NoCache_NoCache: + { + _, ok := other.Get_().(NoCache_NoCache) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this NoCache) EqualsGeneric(other interface{}) bool { + typed, ok := other.(NoCache) + return ok && _this.Equals(typed) +} + +func Type_NoCache_() _dafny.TypeDescriptor { + return type_NoCache_{} +} + +type type_NoCache_ struct { +} + +func (_this type_NoCache_) Default() interface{} { + return Companion_NoCache_.Default() +} + +func (_this type_NoCache_) String() string { + return "AwsCryptographyMaterialProvidersTypes.NoCache" +} +func (_this NoCache) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = NoCache{} + +// End of datatype NoCache + +// Definition of datatype None +type None struct { + Data_None_ +} + +func (_this None) Get_() Data_None_ { + return _this.Data_None_ +} + +type Data_None_ interface { + isNone() +} + +type CompanionStruct_None_ struct { +} + +var Companion_None_ = CompanionStruct_None_{} + +type None_None struct { +} + +func (None_None) isNone() {} + +func (CompanionStruct_None_) Create_None_() None { + return None{None_None{}} +} + +func (_this None) Is_None() bool { + _, ok := _this.Get_().(None_None) + return ok +} + +func (CompanionStruct_None_) Default() None { + return Companion_None_.Create_None_() +} + +func (_ CompanionStruct_None_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_None_.Create_None_(), true + default: + return None{}, false + } + } +} + +func (_this None) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case None_None: + { + return "AwsCryptographyMaterialProvidersTypes.None.None" + } + default: + { + return "" + } + } +} + +func (_this None) Equals(other None) bool { + switch _this.Get_().(type) { + case None_None: + { + _, ok := other.Get_().(None_None) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this None) EqualsGeneric(other interface{}) bool { + typed, ok := other.(None) + return ok && _this.Equals(typed) +} + +func Type_None_() _dafny.TypeDescriptor { + return type_None_{} +} + +type type_None_ struct { +} + +func (_this type_None_) Default() interface{} { + return Companion_None_.Default() +} + +func (_this type_None_) String() string { + return "AwsCryptographyMaterialProvidersTypes.None" +} +func (_this None) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = None{} + +// End of datatype None + +// Definition of datatype OnDecryptInput +type OnDecryptInput struct { + Data_OnDecryptInput_ +} + +func (_this OnDecryptInput) Get_() Data_OnDecryptInput_ { + return _this.Data_OnDecryptInput_ +} + +type Data_OnDecryptInput_ interface { + isOnDecryptInput() +} + +type CompanionStruct_OnDecryptInput_ struct { +} + +var Companion_OnDecryptInput_ = CompanionStruct_OnDecryptInput_{} + +type OnDecryptInput_OnDecryptInput struct { + Materials DecryptionMaterials + EncryptedDataKeys _dafny.Sequence +} + +func (OnDecryptInput_OnDecryptInput) isOnDecryptInput() {} + +func (CompanionStruct_OnDecryptInput_) Create_OnDecryptInput_(Materials DecryptionMaterials, EncryptedDataKeys _dafny.Sequence) OnDecryptInput { + return OnDecryptInput{OnDecryptInput_OnDecryptInput{Materials, EncryptedDataKeys}} +} + +func (_this OnDecryptInput) Is_OnDecryptInput() bool { + _, ok := _this.Get_().(OnDecryptInput_OnDecryptInput) + return ok +} + +func (CompanionStruct_OnDecryptInput_) Default() OnDecryptInput { + return Companion_OnDecryptInput_.Create_OnDecryptInput_(Companion_DecryptionMaterials_.Default(), _dafny.EmptySeq) +} + +func (_this OnDecryptInput) Dtor_materials() DecryptionMaterials { + return _this.Get_().(OnDecryptInput_OnDecryptInput).Materials +} + +func (_this OnDecryptInput) Dtor_encryptedDataKeys() _dafny.Sequence { + return _this.Get_().(OnDecryptInput_OnDecryptInput).EncryptedDataKeys +} + +func (_this OnDecryptInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OnDecryptInput_OnDecryptInput: + { + return "AwsCryptographyMaterialProvidersTypes.OnDecryptInput.OnDecryptInput" + "(" + _dafny.String(data.Materials) + ", " + _dafny.String(data.EncryptedDataKeys) + ")" + } + default: + { + return "" + } + } +} + +func (_this OnDecryptInput) Equals(other OnDecryptInput) bool { + switch data1 := _this.Get_().(type) { + case OnDecryptInput_OnDecryptInput: + { + data2, ok := other.Get_().(OnDecryptInput_OnDecryptInput) + return ok && data1.Materials.Equals(data2.Materials) && data1.EncryptedDataKeys.Equals(data2.EncryptedDataKeys) + } + default: + { + return false // unexpected + } + } +} + +func (_this OnDecryptInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OnDecryptInput) + return ok && _this.Equals(typed) +} + +func Type_OnDecryptInput_() _dafny.TypeDescriptor { + return type_OnDecryptInput_{} +} + +type type_OnDecryptInput_ struct { +} + +func (_this type_OnDecryptInput_) Default() interface{} { + return Companion_OnDecryptInput_.Default() +} + +func (_this type_OnDecryptInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.OnDecryptInput" +} +func (_this OnDecryptInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OnDecryptInput{} + +// End of datatype OnDecryptInput + +// Definition of datatype OnDecryptOutput +type OnDecryptOutput struct { + Data_OnDecryptOutput_ +} + +func (_this OnDecryptOutput) Get_() Data_OnDecryptOutput_ { + return _this.Data_OnDecryptOutput_ +} + +type Data_OnDecryptOutput_ interface { + isOnDecryptOutput() +} + +type CompanionStruct_OnDecryptOutput_ struct { +} + +var Companion_OnDecryptOutput_ = CompanionStruct_OnDecryptOutput_{} + +type OnDecryptOutput_OnDecryptOutput struct { + Materials DecryptionMaterials +} + +func (OnDecryptOutput_OnDecryptOutput) isOnDecryptOutput() {} + +func (CompanionStruct_OnDecryptOutput_) Create_OnDecryptOutput_(Materials DecryptionMaterials) OnDecryptOutput { + return OnDecryptOutput{OnDecryptOutput_OnDecryptOutput{Materials}} +} + +func (_this OnDecryptOutput) Is_OnDecryptOutput() bool { + _, ok := _this.Get_().(OnDecryptOutput_OnDecryptOutput) + return ok +} + +func (CompanionStruct_OnDecryptOutput_) Default() OnDecryptOutput { + return Companion_OnDecryptOutput_.Create_OnDecryptOutput_(Companion_DecryptionMaterials_.Default()) +} + +func (_this OnDecryptOutput) Dtor_materials() DecryptionMaterials { + return _this.Get_().(OnDecryptOutput_OnDecryptOutput).Materials +} + +func (_this OnDecryptOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OnDecryptOutput_OnDecryptOutput: + { + return "AwsCryptographyMaterialProvidersTypes.OnDecryptOutput.OnDecryptOutput" + "(" + _dafny.String(data.Materials) + ")" + } + default: + { + return "" + } + } +} + +func (_this OnDecryptOutput) Equals(other OnDecryptOutput) bool { + switch data1 := _this.Get_().(type) { + case OnDecryptOutput_OnDecryptOutput: + { + data2, ok := other.Get_().(OnDecryptOutput_OnDecryptOutput) + return ok && data1.Materials.Equals(data2.Materials) + } + default: + { + return false // unexpected + } + } +} + +func (_this OnDecryptOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OnDecryptOutput) + return ok && _this.Equals(typed) +} + +func Type_OnDecryptOutput_() _dafny.TypeDescriptor { + return type_OnDecryptOutput_{} +} + +type type_OnDecryptOutput_ struct { +} + +func (_this type_OnDecryptOutput_) Default() interface{} { + return Companion_OnDecryptOutput_.Default() +} + +func (_this type_OnDecryptOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.OnDecryptOutput" +} +func (_this OnDecryptOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OnDecryptOutput{} + +// End of datatype OnDecryptOutput + +// Definition of datatype OnEncryptInput +type OnEncryptInput struct { + Data_OnEncryptInput_ +} + +func (_this OnEncryptInput) Get_() Data_OnEncryptInput_ { + return _this.Data_OnEncryptInput_ +} + +type Data_OnEncryptInput_ interface { + isOnEncryptInput() +} + +type CompanionStruct_OnEncryptInput_ struct { +} + +var Companion_OnEncryptInput_ = CompanionStruct_OnEncryptInput_{} + +type OnEncryptInput_OnEncryptInput struct { + Materials EncryptionMaterials +} + +func (OnEncryptInput_OnEncryptInput) isOnEncryptInput() {} + +func (CompanionStruct_OnEncryptInput_) Create_OnEncryptInput_(Materials EncryptionMaterials) OnEncryptInput { + return OnEncryptInput{OnEncryptInput_OnEncryptInput{Materials}} +} + +func (_this OnEncryptInput) Is_OnEncryptInput() bool { + _, ok := _this.Get_().(OnEncryptInput_OnEncryptInput) + return ok +} + +func (CompanionStruct_OnEncryptInput_) Default() OnEncryptInput { + return Companion_OnEncryptInput_.Create_OnEncryptInput_(Companion_EncryptionMaterials_.Default()) +} + +func (_this OnEncryptInput) Dtor_materials() EncryptionMaterials { + return _this.Get_().(OnEncryptInput_OnEncryptInput).Materials +} + +func (_this OnEncryptInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OnEncryptInput_OnEncryptInput: + { + return "AwsCryptographyMaterialProvidersTypes.OnEncryptInput.OnEncryptInput" + "(" + _dafny.String(data.Materials) + ")" + } + default: + { + return "" + } + } +} + +func (_this OnEncryptInput) Equals(other OnEncryptInput) bool { + switch data1 := _this.Get_().(type) { + case OnEncryptInput_OnEncryptInput: + { + data2, ok := other.Get_().(OnEncryptInput_OnEncryptInput) + return ok && data1.Materials.Equals(data2.Materials) + } + default: + { + return false // unexpected + } + } +} + +func (_this OnEncryptInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OnEncryptInput) + return ok && _this.Equals(typed) +} + +func Type_OnEncryptInput_() _dafny.TypeDescriptor { + return type_OnEncryptInput_{} +} + +type type_OnEncryptInput_ struct { +} + +func (_this type_OnEncryptInput_) Default() interface{} { + return Companion_OnEncryptInput_.Default() +} + +func (_this type_OnEncryptInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.OnEncryptInput" +} +func (_this OnEncryptInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OnEncryptInput{} + +// End of datatype OnEncryptInput + +// Definition of datatype OnEncryptOutput +type OnEncryptOutput struct { + Data_OnEncryptOutput_ +} + +func (_this OnEncryptOutput) Get_() Data_OnEncryptOutput_ { + return _this.Data_OnEncryptOutput_ +} + +type Data_OnEncryptOutput_ interface { + isOnEncryptOutput() +} + +type CompanionStruct_OnEncryptOutput_ struct { +} + +var Companion_OnEncryptOutput_ = CompanionStruct_OnEncryptOutput_{} + +type OnEncryptOutput_OnEncryptOutput struct { + Materials EncryptionMaterials +} + +func (OnEncryptOutput_OnEncryptOutput) isOnEncryptOutput() {} + +func (CompanionStruct_OnEncryptOutput_) Create_OnEncryptOutput_(Materials EncryptionMaterials) OnEncryptOutput { + return OnEncryptOutput{OnEncryptOutput_OnEncryptOutput{Materials}} +} + +func (_this OnEncryptOutput) Is_OnEncryptOutput() bool { + _, ok := _this.Get_().(OnEncryptOutput_OnEncryptOutput) + return ok +} + +func (CompanionStruct_OnEncryptOutput_) Default() OnEncryptOutput { + return Companion_OnEncryptOutput_.Create_OnEncryptOutput_(Companion_EncryptionMaterials_.Default()) +} + +func (_this OnEncryptOutput) Dtor_materials() EncryptionMaterials { + return _this.Get_().(OnEncryptOutput_OnEncryptOutput).Materials +} + +func (_this OnEncryptOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OnEncryptOutput_OnEncryptOutput: + { + return "AwsCryptographyMaterialProvidersTypes.OnEncryptOutput.OnEncryptOutput" + "(" + _dafny.String(data.Materials) + ")" + } + default: + { + return "" + } + } +} + +func (_this OnEncryptOutput) Equals(other OnEncryptOutput) bool { + switch data1 := _this.Get_().(type) { + case OnEncryptOutput_OnEncryptOutput: + { + data2, ok := other.Get_().(OnEncryptOutput_OnEncryptOutput) + return ok && data1.Materials.Equals(data2.Materials) + } + default: + { + return false // unexpected + } + } +} + +func (_this OnEncryptOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OnEncryptOutput) + return ok && _this.Equals(typed) +} + +func Type_OnEncryptOutput_() _dafny.TypeDescriptor { + return type_OnEncryptOutput_{} +} + +type type_OnEncryptOutput_ struct { +} + +func (_this type_OnEncryptOutput_) Default() interface{} { + return Companion_OnEncryptOutput_.Default() +} + +func (_this type_OnEncryptOutput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.OnEncryptOutput" +} +func (_this OnEncryptOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OnEncryptOutput{} + +// End of datatype OnEncryptOutput + +// Definition of datatype PaddingScheme +type PaddingScheme struct { + Data_PaddingScheme_ +} + +func (_this PaddingScheme) Get_() Data_PaddingScheme_ { + return _this.Data_PaddingScheme_ +} + +type Data_PaddingScheme_ interface { + isPaddingScheme() +} + +type CompanionStruct_PaddingScheme_ struct { +} + +var Companion_PaddingScheme_ = CompanionStruct_PaddingScheme_{} + +type PaddingScheme_PKCS1 struct { +} + +func (PaddingScheme_PKCS1) isPaddingScheme() {} + +func (CompanionStruct_PaddingScheme_) Create_PKCS1_() PaddingScheme { + return PaddingScheme{PaddingScheme_PKCS1{}} +} + +func (_this PaddingScheme) Is_PKCS1() bool { + _, ok := _this.Get_().(PaddingScheme_PKCS1) + return ok +} + +type PaddingScheme_OAEP__SHA1__MGF1 struct { +} + +func (PaddingScheme_OAEP__SHA1__MGF1) isPaddingScheme() {} + +func (CompanionStruct_PaddingScheme_) Create_OAEP__SHA1__MGF1_() PaddingScheme { + return PaddingScheme{PaddingScheme_OAEP__SHA1__MGF1{}} +} + +func (_this PaddingScheme) Is_OAEP__SHA1__MGF1() bool { + _, ok := _this.Get_().(PaddingScheme_OAEP__SHA1__MGF1) + return ok +} + +type PaddingScheme_OAEP__SHA256__MGF1 struct { +} + +func (PaddingScheme_OAEP__SHA256__MGF1) isPaddingScheme() {} + +func (CompanionStruct_PaddingScheme_) Create_OAEP__SHA256__MGF1_() PaddingScheme { + return PaddingScheme{PaddingScheme_OAEP__SHA256__MGF1{}} +} + +func (_this PaddingScheme) Is_OAEP__SHA256__MGF1() bool { + _, ok := _this.Get_().(PaddingScheme_OAEP__SHA256__MGF1) + return ok +} + +type PaddingScheme_OAEP__SHA384__MGF1 struct { +} + +func (PaddingScheme_OAEP__SHA384__MGF1) isPaddingScheme() {} + +func (CompanionStruct_PaddingScheme_) Create_OAEP__SHA384__MGF1_() PaddingScheme { + return PaddingScheme{PaddingScheme_OAEP__SHA384__MGF1{}} +} + +func (_this PaddingScheme) Is_OAEP__SHA384__MGF1() bool { + _, ok := _this.Get_().(PaddingScheme_OAEP__SHA384__MGF1) + return ok +} + +type PaddingScheme_OAEP__SHA512__MGF1 struct { +} + +func (PaddingScheme_OAEP__SHA512__MGF1) isPaddingScheme() {} + +func (CompanionStruct_PaddingScheme_) Create_OAEP__SHA512__MGF1_() PaddingScheme { + return PaddingScheme{PaddingScheme_OAEP__SHA512__MGF1{}} +} + +func (_this PaddingScheme) Is_OAEP__SHA512__MGF1() bool { + _, ok := _this.Get_().(PaddingScheme_OAEP__SHA512__MGF1) + return ok +} + +func (CompanionStruct_PaddingScheme_) Default() PaddingScheme { + return Companion_PaddingScheme_.Create_PKCS1_() +} + +func (_ CompanionStruct_PaddingScheme_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_PaddingScheme_.Create_PKCS1_(), true + case 1: + return Companion_PaddingScheme_.Create_OAEP__SHA1__MGF1_(), true + case 2: + return Companion_PaddingScheme_.Create_OAEP__SHA256__MGF1_(), true + case 3: + return Companion_PaddingScheme_.Create_OAEP__SHA384__MGF1_(), true + case 4: + return Companion_PaddingScheme_.Create_OAEP__SHA512__MGF1_(), true + default: + return PaddingScheme{}, false + } + } +} + +func (_this PaddingScheme) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case PaddingScheme_PKCS1: + { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme.PKCS1" + } + case PaddingScheme_OAEP__SHA1__MGF1: + { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme.OAEP_SHA1_MGF1" + } + case PaddingScheme_OAEP__SHA256__MGF1: + { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme.OAEP_SHA256_MGF1" + } + case PaddingScheme_OAEP__SHA384__MGF1: + { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme.OAEP_SHA384_MGF1" + } + case PaddingScheme_OAEP__SHA512__MGF1: + { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme.OAEP_SHA512_MGF1" + } + default: + { + return "" + } + } +} + +func (_this PaddingScheme) Equals(other PaddingScheme) bool { + switch _this.Get_().(type) { + case PaddingScheme_PKCS1: + { + _, ok := other.Get_().(PaddingScheme_PKCS1) + return ok + } + case PaddingScheme_OAEP__SHA1__MGF1: + { + _, ok := other.Get_().(PaddingScheme_OAEP__SHA1__MGF1) + return ok + } + case PaddingScheme_OAEP__SHA256__MGF1: + { + _, ok := other.Get_().(PaddingScheme_OAEP__SHA256__MGF1) + return ok + } + case PaddingScheme_OAEP__SHA384__MGF1: + { + _, ok := other.Get_().(PaddingScheme_OAEP__SHA384__MGF1) + return ok + } + case PaddingScheme_OAEP__SHA512__MGF1: + { + _, ok := other.Get_().(PaddingScheme_OAEP__SHA512__MGF1) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this PaddingScheme) EqualsGeneric(other interface{}) bool { + typed, ok := other.(PaddingScheme) + return ok && _this.Equals(typed) +} + +func Type_PaddingScheme_() _dafny.TypeDescriptor { + return type_PaddingScheme_{} +} + +type type_PaddingScheme_ struct { +} + +func (_this type_PaddingScheme_) Default() interface{} { + return Companion_PaddingScheme_.Default() +} + +func (_this type_PaddingScheme_) String() string { + return "AwsCryptographyMaterialProvidersTypes.PaddingScheme" +} +func (_this PaddingScheme) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = PaddingScheme{} + +// End of datatype PaddingScheme + +// Definition of class PositiveInteger +type PositiveInteger struct { +} + +func New_PositiveInteger_() *PositiveInteger { + _this := PositiveInteger{} + + return &_this +} + +type CompanionStruct_PositiveInteger_ struct { +} + +var Companion_PositiveInteger_ = CompanionStruct_PositiveInteger_{} + +func (*PositiveInteger) String() string { + return "AwsCryptographyMaterialProvidersTypes.PositiveInteger" +} + +// End of class PositiveInteger + +func Type_PositiveInteger_() _dafny.TypeDescriptor { + return type_PositiveInteger_{} +} + +type type_PositiveInteger_ struct { +} + +func (_this type_PositiveInteger_) Default() interface{} { + return int32(0) +} + +func (_this type_PositiveInteger_) String() string { + return "AwsCryptographyMaterialProvidersTypes.PositiveInteger" +} +func (_this *CompanionStruct_PositiveInteger_) Is_(__source int32) bool { + var _0_x int32 = (__source) + _ = _0_x + if true { + return Companion_Default___.IsValid__PositiveInteger(_0_x) + } + return false +} + +// Definition of class PositiveLong +type PositiveLong struct { +} + +func New_PositiveLong_() *PositiveLong { + _this := PositiveLong{} + + return &_this +} + +type CompanionStruct_PositiveLong_ struct { +} + +var Companion_PositiveLong_ = CompanionStruct_PositiveLong_{} + +func (*PositiveLong) String() string { + return "AwsCryptographyMaterialProvidersTypes.PositiveLong" +} + +// End of class PositiveLong + +func Type_PositiveLong_() _dafny.TypeDescriptor { + return type_PositiveLong_{} +} + +type type_PositiveLong_ struct { +} + +func (_this type_PositiveLong_) Default() interface{} { + return int64(0) +} + +func (_this type_PositiveLong_) String() string { + return "AwsCryptographyMaterialProvidersTypes.PositiveLong" +} +func (_this *CompanionStruct_PositiveLong_) Is_(__source int64) bool { + var _1_x int64 = (__source) + _ = _1_x + if true { + return Companion_Default___.IsValid__PositiveLong(_1_x) + } + return false +} + +// Definition of datatype PublicKeyDiscoveryInput +type PublicKeyDiscoveryInput struct { + Data_PublicKeyDiscoveryInput_ +} + +func (_this PublicKeyDiscoveryInput) Get_() Data_PublicKeyDiscoveryInput_ { + return _this.Data_PublicKeyDiscoveryInput_ +} + +type Data_PublicKeyDiscoveryInput_ interface { + isPublicKeyDiscoveryInput() +} + +type CompanionStruct_PublicKeyDiscoveryInput_ struct { +} + +var Companion_PublicKeyDiscoveryInput_ = CompanionStruct_PublicKeyDiscoveryInput_{} + +type PublicKeyDiscoveryInput_PublicKeyDiscoveryInput struct { + RecipientStaticPrivateKey _dafny.Sequence +} + +func (PublicKeyDiscoveryInput_PublicKeyDiscoveryInput) isPublicKeyDiscoveryInput() {} + +func (CompanionStruct_PublicKeyDiscoveryInput_) Create_PublicKeyDiscoveryInput_(RecipientStaticPrivateKey _dafny.Sequence) PublicKeyDiscoveryInput { + return PublicKeyDiscoveryInput{PublicKeyDiscoveryInput_PublicKeyDiscoveryInput{RecipientStaticPrivateKey}} +} + +func (_this PublicKeyDiscoveryInput) Is_PublicKeyDiscoveryInput() bool { + _, ok := _this.Get_().(PublicKeyDiscoveryInput_PublicKeyDiscoveryInput) + return ok +} + +func (CompanionStruct_PublicKeyDiscoveryInput_) Default() PublicKeyDiscoveryInput { + return Companion_PublicKeyDiscoveryInput_.Create_PublicKeyDiscoveryInput_(_dafny.EmptySeq) +} + +func (_this PublicKeyDiscoveryInput) Dtor_recipientStaticPrivateKey() _dafny.Sequence { + return _this.Get_().(PublicKeyDiscoveryInput_PublicKeyDiscoveryInput).RecipientStaticPrivateKey +} + +func (_this PublicKeyDiscoveryInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case PublicKeyDiscoveryInput_PublicKeyDiscoveryInput: + { + return "AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput.PublicKeyDiscoveryInput" + "(" + _dafny.String(data.RecipientStaticPrivateKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this PublicKeyDiscoveryInput) Equals(other PublicKeyDiscoveryInput) bool { + switch data1 := _this.Get_().(type) { + case PublicKeyDiscoveryInput_PublicKeyDiscoveryInput: + { + data2, ok := other.Get_().(PublicKeyDiscoveryInput_PublicKeyDiscoveryInput) + return ok && data1.RecipientStaticPrivateKey.Equals(data2.RecipientStaticPrivateKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this PublicKeyDiscoveryInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(PublicKeyDiscoveryInput) + return ok && _this.Equals(typed) +} + +func Type_PublicKeyDiscoveryInput_() _dafny.TypeDescriptor { + return type_PublicKeyDiscoveryInput_{} +} + +type type_PublicKeyDiscoveryInput_ struct { +} + +func (_this type_PublicKeyDiscoveryInput_) Default() interface{} { + return Companion_PublicKeyDiscoveryInput_.Default() +} + +func (_this type_PublicKeyDiscoveryInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput" +} +func (_this PublicKeyDiscoveryInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = PublicKeyDiscoveryInput{} + +// End of datatype PublicKeyDiscoveryInput + +// Definition of datatype PutCacheEntryInput +type PutCacheEntryInput struct { + Data_PutCacheEntryInput_ +} + +func (_this PutCacheEntryInput) Get_() Data_PutCacheEntryInput_ { + return _this.Data_PutCacheEntryInput_ +} + +type Data_PutCacheEntryInput_ interface { + isPutCacheEntryInput() +} + +type CompanionStruct_PutCacheEntryInput_ struct { +} + +var Companion_PutCacheEntryInput_ = CompanionStruct_PutCacheEntryInput_{} + +type PutCacheEntryInput_PutCacheEntryInput struct { + Identifier _dafny.Sequence + Materials Materials + CreationTime int64 + ExpiryTime int64 + MessagesUsed m_Wrappers.Option + BytesUsed m_Wrappers.Option +} + +func (PutCacheEntryInput_PutCacheEntryInput) isPutCacheEntryInput() {} + +func (CompanionStruct_PutCacheEntryInput_) Create_PutCacheEntryInput_(Identifier _dafny.Sequence, Materials Materials, CreationTime int64, ExpiryTime int64, MessagesUsed m_Wrappers.Option, BytesUsed m_Wrappers.Option) PutCacheEntryInput { + return PutCacheEntryInput{PutCacheEntryInput_PutCacheEntryInput{Identifier, Materials, CreationTime, ExpiryTime, MessagesUsed, BytesUsed}} +} + +func (_this PutCacheEntryInput) Is_PutCacheEntryInput() bool { + _, ok := _this.Get_().(PutCacheEntryInput_PutCacheEntryInput) + return ok +} + +func (CompanionStruct_PutCacheEntryInput_) Default() PutCacheEntryInput { + return Companion_PutCacheEntryInput_.Create_PutCacheEntryInput_(_dafny.EmptySeq, Companion_Materials_.Default(), int64(0), int64(0), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this PutCacheEntryInput) Dtor_identifier() _dafny.Sequence { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).Identifier +} + +func (_this PutCacheEntryInput) Dtor_materials() Materials { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).Materials +} + +func (_this PutCacheEntryInput) Dtor_creationTime() int64 { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).CreationTime +} + +func (_this PutCacheEntryInput) Dtor_expiryTime() int64 { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).ExpiryTime +} + +func (_this PutCacheEntryInput) Dtor_messagesUsed() m_Wrappers.Option { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).MessagesUsed +} + +func (_this PutCacheEntryInput) Dtor_bytesUsed() m_Wrappers.Option { + return _this.Get_().(PutCacheEntryInput_PutCacheEntryInput).BytesUsed +} + +func (_this PutCacheEntryInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case PutCacheEntryInput_PutCacheEntryInput: + { + return "AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput.PutCacheEntryInput" + "(" + _dafny.String(data.Identifier) + ", " + _dafny.String(data.Materials) + ", " + _dafny.String(data.CreationTime) + ", " + _dafny.String(data.ExpiryTime) + ", " + _dafny.String(data.MessagesUsed) + ", " + _dafny.String(data.BytesUsed) + ")" + } + default: + { + return "" + } + } +} + +func (_this PutCacheEntryInput) Equals(other PutCacheEntryInput) bool { + switch data1 := _this.Get_().(type) { + case PutCacheEntryInput_PutCacheEntryInput: + { + data2, ok := other.Get_().(PutCacheEntryInput_PutCacheEntryInput) + return ok && data1.Identifier.Equals(data2.Identifier) && data1.Materials.Equals(data2.Materials) && data1.CreationTime == data2.CreationTime && data1.ExpiryTime == data2.ExpiryTime && data1.MessagesUsed.Equals(data2.MessagesUsed) && data1.BytesUsed.Equals(data2.BytesUsed) + } + default: + { + return false // unexpected + } + } +} + +func (_this PutCacheEntryInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(PutCacheEntryInput) + return ok && _this.Equals(typed) +} + +func Type_PutCacheEntryInput_() _dafny.TypeDescriptor { + return type_PutCacheEntryInput_{} +} + +type type_PutCacheEntryInput_ struct { +} + +func (_this type_PutCacheEntryInput_) Default() interface{} { + return Companion_PutCacheEntryInput_.Default() +} + +func (_this type_PutCacheEntryInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput" +} +func (_this PutCacheEntryInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = PutCacheEntryInput{} + +// End of datatype PutCacheEntryInput + +// Definition of datatype RawEcdhStaticConfigurations +type RawEcdhStaticConfigurations struct { + Data_RawEcdhStaticConfigurations_ +} + +func (_this RawEcdhStaticConfigurations) Get_() Data_RawEcdhStaticConfigurations_ { + return _this.Data_RawEcdhStaticConfigurations_ +} + +type Data_RawEcdhStaticConfigurations_ interface { + isRawEcdhStaticConfigurations() +} + +type CompanionStruct_RawEcdhStaticConfigurations_ struct { +} + +var Companion_RawEcdhStaticConfigurations_ = CompanionStruct_RawEcdhStaticConfigurations_{} + +type RawEcdhStaticConfigurations_PublicKeyDiscovery struct { + PublicKeyDiscovery PublicKeyDiscoveryInput +} + +func (RawEcdhStaticConfigurations_PublicKeyDiscovery) isRawEcdhStaticConfigurations() {} + +func (CompanionStruct_RawEcdhStaticConfigurations_) Create_PublicKeyDiscovery_(PublicKeyDiscovery PublicKeyDiscoveryInput) RawEcdhStaticConfigurations { + return RawEcdhStaticConfigurations{RawEcdhStaticConfigurations_PublicKeyDiscovery{PublicKeyDiscovery}} +} + +func (_this RawEcdhStaticConfigurations) Is_PublicKeyDiscovery() bool { + _, ok := _this.Get_().(RawEcdhStaticConfigurations_PublicKeyDiscovery) + return ok +} + +type RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey struct { + RawPrivateKeyToStaticPublicKey RawPrivateKeyToStaticPublicKeyInput +} + +func (RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey) isRawEcdhStaticConfigurations() {} + +func (CompanionStruct_RawEcdhStaticConfigurations_) Create_RawPrivateKeyToStaticPublicKey_(RawPrivateKeyToStaticPublicKey RawPrivateKeyToStaticPublicKeyInput) RawEcdhStaticConfigurations { + return RawEcdhStaticConfigurations{RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey{RawPrivateKeyToStaticPublicKey}} +} + +func (_this RawEcdhStaticConfigurations) Is_RawPrivateKeyToStaticPublicKey() bool { + _, ok := _this.Get_().(RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey) + return ok +} + +type RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey struct { + EphemeralPrivateKeyToStaticPublicKey EphemeralPrivateKeyToStaticPublicKeyInput +} + +func (RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey) isRawEcdhStaticConfigurations() { +} + +func (CompanionStruct_RawEcdhStaticConfigurations_) Create_EphemeralPrivateKeyToStaticPublicKey_(EphemeralPrivateKeyToStaticPublicKey EphemeralPrivateKeyToStaticPublicKeyInput) RawEcdhStaticConfigurations { + return RawEcdhStaticConfigurations{RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey{EphemeralPrivateKeyToStaticPublicKey}} +} + +func (_this RawEcdhStaticConfigurations) Is_EphemeralPrivateKeyToStaticPublicKey() bool { + _, ok := _this.Get_().(RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey) + return ok +} + +func (CompanionStruct_RawEcdhStaticConfigurations_) Default() RawEcdhStaticConfigurations { + return Companion_RawEcdhStaticConfigurations_.Create_PublicKeyDiscovery_(Companion_PublicKeyDiscoveryInput_.Default()) +} + +func (_this RawEcdhStaticConfigurations) Dtor_PublicKeyDiscovery() PublicKeyDiscoveryInput { + return _this.Get_().(RawEcdhStaticConfigurations_PublicKeyDiscovery).PublicKeyDiscovery +} + +func (_this RawEcdhStaticConfigurations) Dtor_RawPrivateKeyToStaticPublicKey() RawPrivateKeyToStaticPublicKeyInput { + return _this.Get_().(RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey).RawPrivateKeyToStaticPublicKey +} + +func (_this RawEcdhStaticConfigurations) Dtor_EphemeralPrivateKeyToStaticPublicKey() EphemeralPrivateKeyToStaticPublicKeyInput { + return _this.Get_().(RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey).EphemeralPrivateKeyToStaticPublicKey +} + +func (_this RawEcdhStaticConfigurations) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case RawEcdhStaticConfigurations_PublicKeyDiscovery: + { + return "AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations.PublicKeyDiscovery" + "(" + _dafny.String(data.PublicKeyDiscovery) + ")" + } + case RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey: + { + return "AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations.RawPrivateKeyToStaticPublicKey" + "(" + _dafny.String(data.RawPrivateKeyToStaticPublicKey) + ")" + } + case RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey: + { + return "AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations.EphemeralPrivateKeyToStaticPublicKey" + "(" + _dafny.String(data.EphemeralPrivateKeyToStaticPublicKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this RawEcdhStaticConfigurations) Equals(other RawEcdhStaticConfigurations) bool { + switch data1 := _this.Get_().(type) { + case RawEcdhStaticConfigurations_PublicKeyDiscovery: + { + data2, ok := other.Get_().(RawEcdhStaticConfigurations_PublicKeyDiscovery) + return ok && data1.PublicKeyDiscovery.Equals(data2.PublicKeyDiscovery) + } + case RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey: + { + data2, ok := other.Get_().(RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey) + return ok && data1.RawPrivateKeyToStaticPublicKey.Equals(data2.RawPrivateKeyToStaticPublicKey) + } + case RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey: + { + data2, ok := other.Get_().(RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey) + return ok && data1.EphemeralPrivateKeyToStaticPublicKey.Equals(data2.EphemeralPrivateKeyToStaticPublicKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this RawEcdhStaticConfigurations) EqualsGeneric(other interface{}) bool { + typed, ok := other.(RawEcdhStaticConfigurations) + return ok && _this.Equals(typed) +} + +func Type_RawEcdhStaticConfigurations_() _dafny.TypeDescriptor { + return type_RawEcdhStaticConfigurations_{} +} + +type type_RawEcdhStaticConfigurations_ struct { +} + +func (_this type_RawEcdhStaticConfigurations_) Default() interface{} { + return Companion_RawEcdhStaticConfigurations_.Default() +} + +func (_this type_RawEcdhStaticConfigurations_) String() string { + return "AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations" +} +func (_this RawEcdhStaticConfigurations) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = RawEcdhStaticConfigurations{} + +// End of datatype RawEcdhStaticConfigurations + +// Definition of datatype RawPrivateKeyToStaticPublicKeyInput +type RawPrivateKeyToStaticPublicKeyInput struct { + Data_RawPrivateKeyToStaticPublicKeyInput_ +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) Get_() Data_RawPrivateKeyToStaticPublicKeyInput_ { + return _this.Data_RawPrivateKeyToStaticPublicKeyInput_ +} + +type Data_RawPrivateKeyToStaticPublicKeyInput_ interface { + isRawPrivateKeyToStaticPublicKeyInput() +} + +type CompanionStruct_RawPrivateKeyToStaticPublicKeyInput_ struct { +} + +var Companion_RawPrivateKeyToStaticPublicKeyInput_ = CompanionStruct_RawPrivateKeyToStaticPublicKeyInput_{} + +type RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput struct { + SenderStaticPrivateKey _dafny.Sequence + RecipientPublicKey _dafny.Sequence +} + +func (RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput) isRawPrivateKeyToStaticPublicKeyInput() { +} + +func (CompanionStruct_RawPrivateKeyToStaticPublicKeyInput_) Create_RawPrivateKeyToStaticPublicKeyInput_(SenderStaticPrivateKey _dafny.Sequence, RecipientPublicKey _dafny.Sequence) RawPrivateKeyToStaticPublicKeyInput { + return RawPrivateKeyToStaticPublicKeyInput{RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput{SenderStaticPrivateKey, RecipientPublicKey}} +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) Is_RawPrivateKeyToStaticPublicKeyInput() bool { + _, ok := _this.Get_().(RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput) + return ok +} + +func (CompanionStruct_RawPrivateKeyToStaticPublicKeyInput_) Default() RawPrivateKeyToStaticPublicKeyInput { + return Companion_RawPrivateKeyToStaticPublicKeyInput_.Create_RawPrivateKeyToStaticPublicKeyInput_(_dafny.EmptySeq, _dafny.EmptySeq) +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) Dtor_senderStaticPrivateKey() _dafny.Sequence { + return _this.Get_().(RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput).SenderStaticPrivateKey +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) Dtor_recipientPublicKey() _dafny.Sequence { + return _this.Get_().(RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput).RecipientPublicKey +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput: + { + return "AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput.RawPrivateKeyToStaticPublicKeyInput" + "(" + _dafny.String(data.SenderStaticPrivateKey) + ", " + _dafny.String(data.RecipientPublicKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) Equals(other RawPrivateKeyToStaticPublicKeyInput) bool { + switch data1 := _this.Get_().(type) { + case RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput: + { + data2, ok := other.Get_().(RawPrivateKeyToStaticPublicKeyInput_RawPrivateKeyToStaticPublicKeyInput) + return ok && data1.SenderStaticPrivateKey.Equals(data2.SenderStaticPrivateKey) && data1.RecipientPublicKey.Equals(data2.RecipientPublicKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this RawPrivateKeyToStaticPublicKeyInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(RawPrivateKeyToStaticPublicKeyInput) + return ok && _this.Equals(typed) +} + +func Type_RawPrivateKeyToStaticPublicKeyInput_() _dafny.TypeDescriptor { + return type_RawPrivateKeyToStaticPublicKeyInput_{} +} + +type type_RawPrivateKeyToStaticPublicKeyInput_ struct { +} + +func (_this type_RawPrivateKeyToStaticPublicKeyInput_) Default() interface{} { + return Companion_RawPrivateKeyToStaticPublicKeyInput_.Default() +} + +func (_this type_RawPrivateKeyToStaticPublicKeyInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput" +} +func (_this RawPrivateKeyToStaticPublicKeyInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = RawPrivateKeyToStaticPublicKeyInput{} + +// End of datatype RawPrivateKeyToStaticPublicKeyInput + +// Definition of datatype SignatureAlgorithm +type SignatureAlgorithm struct { + Data_SignatureAlgorithm_ +} + +func (_this SignatureAlgorithm) Get_() Data_SignatureAlgorithm_ { + return _this.Data_SignatureAlgorithm_ +} + +type Data_SignatureAlgorithm_ interface { + isSignatureAlgorithm() +} + +type CompanionStruct_SignatureAlgorithm_ struct { +} + +var Companion_SignatureAlgorithm_ = CompanionStruct_SignatureAlgorithm_{} + +type SignatureAlgorithm_ECDSA struct { + ECDSA ECDSA +} + +func (SignatureAlgorithm_ECDSA) isSignatureAlgorithm() {} + +func (CompanionStruct_SignatureAlgorithm_) Create_ECDSA_(ECDSA ECDSA) SignatureAlgorithm { + return SignatureAlgorithm{SignatureAlgorithm_ECDSA{ECDSA}} +} + +func (_this SignatureAlgorithm) Is_ECDSA() bool { + _, ok := _this.Get_().(SignatureAlgorithm_ECDSA) + return ok +} + +type SignatureAlgorithm_None struct { + None None +} + +func (SignatureAlgorithm_None) isSignatureAlgorithm() {} + +func (CompanionStruct_SignatureAlgorithm_) Create_None_(None None) SignatureAlgorithm { + return SignatureAlgorithm{SignatureAlgorithm_None{None}} +} + +func (_this SignatureAlgorithm) Is_None() bool { + _, ok := _this.Get_().(SignatureAlgorithm_None) + return ok +} + +func (CompanionStruct_SignatureAlgorithm_) Default() SignatureAlgorithm { + return Companion_SignatureAlgorithm_.Create_ECDSA_(Companion_ECDSA_.Default()) +} + +func (_this SignatureAlgorithm) Dtor_ECDSA() ECDSA { + return _this.Get_().(SignatureAlgorithm_ECDSA).ECDSA +} + +func (_this SignatureAlgorithm) Dtor_None() None { + return _this.Get_().(SignatureAlgorithm_None).None +} + +func (_this SignatureAlgorithm) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case SignatureAlgorithm_ECDSA: + { + return "AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm.ECDSA" + "(" + _dafny.String(data.ECDSA) + ")" + } + case SignatureAlgorithm_None: + { + return "AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm.None" + "(" + _dafny.String(data.None) + ")" + } + default: + { + return "" + } + } +} + +func (_this SignatureAlgorithm) Equals(other SignatureAlgorithm) bool { + switch data1 := _this.Get_().(type) { + case SignatureAlgorithm_ECDSA: + { + data2, ok := other.Get_().(SignatureAlgorithm_ECDSA) + return ok && data1.ECDSA.Equals(data2.ECDSA) + } + case SignatureAlgorithm_None: + { + data2, ok := other.Get_().(SignatureAlgorithm_None) + return ok && data1.None.Equals(data2.None) + } + default: + { + return false // unexpected + } + } +} + +func (_this SignatureAlgorithm) EqualsGeneric(other interface{}) bool { + typed, ok := other.(SignatureAlgorithm) + return ok && _this.Equals(typed) +} + +func Type_SignatureAlgorithm_() _dafny.TypeDescriptor { + return type_SignatureAlgorithm_{} +} + +type type_SignatureAlgorithm_ struct { +} + +func (_this type_SignatureAlgorithm_) Default() interface{} { + return Companion_SignatureAlgorithm_.Default() +} + +func (_this type_SignatureAlgorithm_) String() string { + return "AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm" +} +func (_this SignatureAlgorithm) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = SignatureAlgorithm{} + +// End of datatype SignatureAlgorithm + +// Definition of datatype SingleThreadedCache +type SingleThreadedCache struct { + Data_SingleThreadedCache_ +} + +func (_this SingleThreadedCache) Get_() Data_SingleThreadedCache_ { + return _this.Data_SingleThreadedCache_ +} + +type Data_SingleThreadedCache_ interface { + isSingleThreadedCache() +} + +type CompanionStruct_SingleThreadedCache_ struct { +} + +var Companion_SingleThreadedCache_ = CompanionStruct_SingleThreadedCache_{} + +type SingleThreadedCache_SingleThreadedCache struct { + EntryCapacity int32 + EntryPruningTailSize m_Wrappers.Option +} + +func (SingleThreadedCache_SingleThreadedCache) isSingleThreadedCache() {} + +func (CompanionStruct_SingleThreadedCache_) Create_SingleThreadedCache_(EntryCapacity int32, EntryPruningTailSize m_Wrappers.Option) SingleThreadedCache { + return SingleThreadedCache{SingleThreadedCache_SingleThreadedCache{EntryCapacity, EntryPruningTailSize}} +} + +func (_this SingleThreadedCache) Is_SingleThreadedCache() bool { + _, ok := _this.Get_().(SingleThreadedCache_SingleThreadedCache) + return ok +} + +func (CompanionStruct_SingleThreadedCache_) Default() SingleThreadedCache { + return Companion_SingleThreadedCache_.Create_SingleThreadedCache_(int32(0), m_Wrappers.Companion_Option_.Default()) +} + +func (_this SingleThreadedCache) Dtor_entryCapacity() int32 { + return _this.Get_().(SingleThreadedCache_SingleThreadedCache).EntryCapacity +} + +func (_this SingleThreadedCache) Dtor_entryPruningTailSize() m_Wrappers.Option { + return _this.Get_().(SingleThreadedCache_SingleThreadedCache).EntryPruningTailSize +} + +func (_this SingleThreadedCache) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case SingleThreadedCache_SingleThreadedCache: + { + return "AwsCryptographyMaterialProvidersTypes.SingleThreadedCache.SingleThreadedCache" + "(" + _dafny.String(data.EntryCapacity) + ", " + _dafny.String(data.EntryPruningTailSize) + ")" + } + default: + { + return "" + } + } +} + +func (_this SingleThreadedCache) Equals(other SingleThreadedCache) bool { + switch data1 := _this.Get_().(type) { + case SingleThreadedCache_SingleThreadedCache: + { + data2, ok := other.Get_().(SingleThreadedCache_SingleThreadedCache) + return ok && data1.EntryCapacity == data2.EntryCapacity && data1.EntryPruningTailSize.Equals(data2.EntryPruningTailSize) + } + default: + { + return false // unexpected + } + } +} + +func (_this SingleThreadedCache) EqualsGeneric(other interface{}) bool { + typed, ok := other.(SingleThreadedCache) + return ok && _this.Equals(typed) +} + +func Type_SingleThreadedCache_() _dafny.TypeDescriptor { + return type_SingleThreadedCache_{} +} + +type type_SingleThreadedCache_ struct { +} + +func (_this type_SingleThreadedCache_) Default() interface{} { + return Companion_SingleThreadedCache_.Default() +} + +func (_this type_SingleThreadedCache_) String() string { + return "AwsCryptographyMaterialProvidersTypes.SingleThreadedCache" +} +func (_this SingleThreadedCache) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = SingleThreadedCache{} + +// End of datatype SingleThreadedCache + +// Definition of datatype StaticConfigurations +type StaticConfigurations struct { + Data_StaticConfigurations_ +} + +func (_this StaticConfigurations) Get_() Data_StaticConfigurations_ { + return _this.Data_StaticConfigurations_ +} + +type Data_StaticConfigurations_ interface { + isStaticConfigurations() +} + +type CompanionStruct_StaticConfigurations_ struct { +} + +var Companion_StaticConfigurations_ = CompanionStruct_StaticConfigurations_{} + +type StaticConfigurations_AWS__KMS__ECDH struct { + AWS__KMS__ECDH KmsEcdhStaticConfigurations +} + +func (StaticConfigurations_AWS__KMS__ECDH) isStaticConfigurations() {} + +func (CompanionStruct_StaticConfigurations_) Create_AWS__KMS__ECDH_(AWS__KMS__ECDH KmsEcdhStaticConfigurations) StaticConfigurations { + return StaticConfigurations{StaticConfigurations_AWS__KMS__ECDH{AWS__KMS__ECDH}} +} + +func (_this StaticConfigurations) Is_AWS__KMS__ECDH() bool { + _, ok := _this.Get_().(StaticConfigurations_AWS__KMS__ECDH) + return ok +} + +type StaticConfigurations_RAW__ECDH struct { + RAW__ECDH RawEcdhStaticConfigurations +} + +func (StaticConfigurations_RAW__ECDH) isStaticConfigurations() {} + +func (CompanionStruct_StaticConfigurations_) Create_RAW__ECDH_(RAW__ECDH RawEcdhStaticConfigurations) StaticConfigurations { + return StaticConfigurations{StaticConfigurations_RAW__ECDH{RAW__ECDH}} +} + +func (_this StaticConfigurations) Is_RAW__ECDH() bool { + _, ok := _this.Get_().(StaticConfigurations_RAW__ECDH) + return ok +} + +func (CompanionStruct_StaticConfigurations_) Default() StaticConfigurations { + return Companion_StaticConfigurations_.Create_AWS__KMS__ECDH_(Companion_KmsEcdhStaticConfigurations_.Default()) +} + +func (_this StaticConfigurations) Dtor_AWS__KMS__ECDH() KmsEcdhStaticConfigurations { + return _this.Get_().(StaticConfigurations_AWS__KMS__ECDH).AWS__KMS__ECDH +} + +func (_this StaticConfigurations) Dtor_RAW__ECDH() RawEcdhStaticConfigurations { + return _this.Get_().(StaticConfigurations_RAW__ECDH).RAW__ECDH +} + +func (_this StaticConfigurations) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case StaticConfigurations_AWS__KMS__ECDH: + { + return "AwsCryptographyMaterialProvidersTypes.StaticConfigurations.AWS_KMS_ECDH" + "(" + _dafny.String(data.AWS__KMS__ECDH) + ")" + } + case StaticConfigurations_RAW__ECDH: + { + return "AwsCryptographyMaterialProvidersTypes.StaticConfigurations.RAW_ECDH" + "(" + _dafny.String(data.RAW__ECDH) + ")" + } + default: + { + return "" + } + } +} + +func (_this StaticConfigurations) Equals(other StaticConfigurations) bool { + switch data1 := _this.Get_().(type) { + case StaticConfigurations_AWS__KMS__ECDH: + { + data2, ok := other.Get_().(StaticConfigurations_AWS__KMS__ECDH) + return ok && data1.AWS__KMS__ECDH.Equals(data2.AWS__KMS__ECDH) + } + case StaticConfigurations_RAW__ECDH: + { + data2, ok := other.Get_().(StaticConfigurations_RAW__ECDH) + return ok && data1.RAW__ECDH.Equals(data2.RAW__ECDH) + } + default: + { + return false // unexpected + } + } +} + +func (_this StaticConfigurations) EqualsGeneric(other interface{}) bool { + typed, ok := other.(StaticConfigurations) + return ok && _this.Equals(typed) +} + +func Type_StaticConfigurations_() _dafny.TypeDescriptor { + return type_StaticConfigurations_{} +} + +type type_StaticConfigurations_ struct { +} + +func (_this type_StaticConfigurations_) Default() interface{} { + return Companion_StaticConfigurations_.Default() +} + +func (_this type_StaticConfigurations_) String() string { + return "AwsCryptographyMaterialProvidersTypes.StaticConfigurations" +} +func (_this StaticConfigurations) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = StaticConfigurations{} + +// End of datatype StaticConfigurations + +// Definition of datatype StormTrackingCache +type StormTrackingCache struct { + Data_StormTrackingCache_ +} + +func (_this StormTrackingCache) Get_() Data_StormTrackingCache_ { + return _this.Data_StormTrackingCache_ +} + +type Data_StormTrackingCache_ interface { + isStormTrackingCache() +} + +type CompanionStruct_StormTrackingCache_ struct { +} + +var Companion_StormTrackingCache_ = CompanionStruct_StormTrackingCache_{} + +type StormTrackingCache_StormTrackingCache struct { + EntryCapacity int32 + EntryPruningTailSize m_Wrappers.Option + GracePeriod int32 + GraceInterval int32 + FanOut int32 + InFlightTTL int32 + SleepMilli int32 + TimeUnits m_Wrappers.Option +} + +func (StormTrackingCache_StormTrackingCache) isStormTrackingCache() {} + +func (CompanionStruct_StormTrackingCache_) Create_StormTrackingCache_(EntryCapacity int32, EntryPruningTailSize m_Wrappers.Option, GracePeriod int32, GraceInterval int32, FanOut int32, InFlightTTL int32, SleepMilli int32, TimeUnits m_Wrappers.Option) StormTrackingCache { + return StormTrackingCache{StormTrackingCache_StormTrackingCache{EntryCapacity, EntryPruningTailSize, GracePeriod, GraceInterval, FanOut, InFlightTTL, SleepMilli, TimeUnits}} +} + +func (_this StormTrackingCache) Is_StormTrackingCache() bool { + _, ok := _this.Get_().(StormTrackingCache_StormTrackingCache) + return ok +} + +func (CompanionStruct_StormTrackingCache_) Default() StormTrackingCache { + return Companion_StormTrackingCache_.Create_StormTrackingCache_(int32(0), m_Wrappers.Companion_Option_.Default(), int32(0), int32(0), int32(0), int32(0), int32(0), m_Wrappers.Companion_Option_.Default()) +} + +func (_this StormTrackingCache) Dtor_entryCapacity() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).EntryCapacity +} + +func (_this StormTrackingCache) Dtor_entryPruningTailSize() m_Wrappers.Option { + return _this.Get_().(StormTrackingCache_StormTrackingCache).EntryPruningTailSize +} + +func (_this StormTrackingCache) Dtor_gracePeriod() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).GracePeriod +} + +func (_this StormTrackingCache) Dtor_graceInterval() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).GraceInterval +} + +func (_this StormTrackingCache) Dtor_fanOut() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).FanOut +} + +func (_this StormTrackingCache) Dtor_inFlightTTL() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).InFlightTTL +} + +func (_this StormTrackingCache) Dtor_sleepMilli() int32 { + return _this.Get_().(StormTrackingCache_StormTrackingCache).SleepMilli +} + +func (_this StormTrackingCache) Dtor_timeUnits() m_Wrappers.Option { + return _this.Get_().(StormTrackingCache_StormTrackingCache).TimeUnits +} + +func (_this StormTrackingCache) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case StormTrackingCache_StormTrackingCache: + { + return "AwsCryptographyMaterialProvidersTypes.StormTrackingCache.StormTrackingCache" + "(" + _dafny.String(data.EntryCapacity) + ", " + _dafny.String(data.EntryPruningTailSize) + ", " + _dafny.String(data.GracePeriod) + ", " + _dafny.String(data.GraceInterval) + ", " + _dafny.String(data.FanOut) + ", " + _dafny.String(data.InFlightTTL) + ", " + _dafny.String(data.SleepMilli) + ", " + _dafny.String(data.TimeUnits) + ")" + } + default: + { + return "" + } + } +} + +func (_this StormTrackingCache) Equals(other StormTrackingCache) bool { + switch data1 := _this.Get_().(type) { + case StormTrackingCache_StormTrackingCache: + { + data2, ok := other.Get_().(StormTrackingCache_StormTrackingCache) + return ok && data1.EntryCapacity == data2.EntryCapacity && data1.EntryPruningTailSize.Equals(data2.EntryPruningTailSize) && data1.GracePeriod == data2.GracePeriod && data1.GraceInterval == data2.GraceInterval && data1.FanOut == data2.FanOut && data1.InFlightTTL == data2.InFlightTTL && data1.SleepMilli == data2.SleepMilli && data1.TimeUnits.Equals(data2.TimeUnits) + } + default: + { + return false // unexpected + } + } +} + +func (_this StormTrackingCache) EqualsGeneric(other interface{}) bool { + typed, ok := other.(StormTrackingCache) + return ok && _this.Equals(typed) +} + +func Type_StormTrackingCache_() _dafny.TypeDescriptor { + return type_StormTrackingCache_{} +} + +type type_StormTrackingCache_ struct { +} + +func (_this type_StormTrackingCache_) Default() interface{} { + return Companion_StormTrackingCache_.Default() +} + +func (_this type_StormTrackingCache_) String() string { + return "AwsCryptographyMaterialProvidersTypes.StormTrackingCache" +} +func (_this StormTrackingCache) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = StormTrackingCache{} + +// End of datatype StormTrackingCache + +// Definition of datatype SymmetricSignatureAlgorithm +type SymmetricSignatureAlgorithm struct { + Data_SymmetricSignatureAlgorithm_ +} + +func (_this SymmetricSignatureAlgorithm) Get_() Data_SymmetricSignatureAlgorithm_ { + return _this.Data_SymmetricSignatureAlgorithm_ +} + +type Data_SymmetricSignatureAlgorithm_ interface { + isSymmetricSignatureAlgorithm() +} + +type CompanionStruct_SymmetricSignatureAlgorithm_ struct { +} + +var Companion_SymmetricSignatureAlgorithm_ = CompanionStruct_SymmetricSignatureAlgorithm_{} + +type SymmetricSignatureAlgorithm_HMAC struct { + HMAC m_AwsCryptographyPrimitivesTypes.DigestAlgorithm +} + +func (SymmetricSignatureAlgorithm_HMAC) isSymmetricSignatureAlgorithm() {} + +func (CompanionStruct_SymmetricSignatureAlgorithm_) Create_HMAC_(HMAC m_AwsCryptographyPrimitivesTypes.DigestAlgorithm) SymmetricSignatureAlgorithm { + return SymmetricSignatureAlgorithm{SymmetricSignatureAlgorithm_HMAC{HMAC}} +} + +func (_this SymmetricSignatureAlgorithm) Is_HMAC() bool { + _, ok := _this.Get_().(SymmetricSignatureAlgorithm_HMAC) + return ok +} + +type SymmetricSignatureAlgorithm_None struct { + None None +} + +func (SymmetricSignatureAlgorithm_None) isSymmetricSignatureAlgorithm() {} + +func (CompanionStruct_SymmetricSignatureAlgorithm_) Create_None_(None None) SymmetricSignatureAlgorithm { + return SymmetricSignatureAlgorithm{SymmetricSignatureAlgorithm_None{None}} +} + +func (_this SymmetricSignatureAlgorithm) Is_None() bool { + _, ok := _this.Get_().(SymmetricSignatureAlgorithm_None) + return ok +} + +func (CompanionStruct_SymmetricSignatureAlgorithm_) Default() SymmetricSignatureAlgorithm { + return Companion_SymmetricSignatureAlgorithm_.Create_HMAC_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Default()) +} + +func (_this SymmetricSignatureAlgorithm) Dtor_HMAC() m_AwsCryptographyPrimitivesTypes.DigestAlgorithm { + return _this.Get_().(SymmetricSignatureAlgorithm_HMAC).HMAC +} + +func (_this SymmetricSignatureAlgorithm) Dtor_None() None { + return _this.Get_().(SymmetricSignatureAlgorithm_None).None +} + +func (_this SymmetricSignatureAlgorithm) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case SymmetricSignatureAlgorithm_HMAC: + { + return "AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm.HMAC" + "(" + _dafny.String(data.HMAC) + ")" + } + case SymmetricSignatureAlgorithm_None: + { + return "AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm.None" + "(" + _dafny.String(data.None) + ")" + } + default: + { + return "" + } + } +} + +func (_this SymmetricSignatureAlgorithm) Equals(other SymmetricSignatureAlgorithm) bool { + switch data1 := _this.Get_().(type) { + case SymmetricSignatureAlgorithm_HMAC: + { + data2, ok := other.Get_().(SymmetricSignatureAlgorithm_HMAC) + return ok && data1.HMAC.Equals(data2.HMAC) + } + case SymmetricSignatureAlgorithm_None: + { + data2, ok := other.Get_().(SymmetricSignatureAlgorithm_None) + return ok && data1.None.Equals(data2.None) + } + default: + { + return false // unexpected + } + } +} + +func (_this SymmetricSignatureAlgorithm) EqualsGeneric(other interface{}) bool { + typed, ok := other.(SymmetricSignatureAlgorithm) + return ok && _this.Equals(typed) +} + +func Type_SymmetricSignatureAlgorithm_() _dafny.TypeDescriptor { + return type_SymmetricSignatureAlgorithm_{} +} + +type type_SymmetricSignatureAlgorithm_ struct { +} + +func (_this type_SymmetricSignatureAlgorithm_) Default() interface{} { + return Companion_SymmetricSignatureAlgorithm_.Default() +} + +func (_this type_SymmetricSignatureAlgorithm_) String() string { + return "AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm" +} +func (_this SymmetricSignatureAlgorithm) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = SymmetricSignatureAlgorithm{} + +// End of datatype SymmetricSignatureAlgorithm + +// Definition of datatype TimeUnits +type TimeUnits struct { + Data_TimeUnits_ +} + +func (_this TimeUnits) Get_() Data_TimeUnits_ { + return _this.Data_TimeUnits_ +} + +type Data_TimeUnits_ interface { + isTimeUnits() +} + +type CompanionStruct_TimeUnits_ struct { +} + +var Companion_TimeUnits_ = CompanionStruct_TimeUnits_{} + +type TimeUnits_Seconds struct { +} + +func (TimeUnits_Seconds) isTimeUnits() {} + +func (CompanionStruct_TimeUnits_) Create_Seconds_() TimeUnits { + return TimeUnits{TimeUnits_Seconds{}} +} + +func (_this TimeUnits) Is_Seconds() bool { + _, ok := _this.Get_().(TimeUnits_Seconds) + return ok +} + +type TimeUnits_Milliseconds struct { +} + +func (TimeUnits_Milliseconds) isTimeUnits() {} + +func (CompanionStruct_TimeUnits_) Create_Milliseconds_() TimeUnits { + return TimeUnits{TimeUnits_Milliseconds{}} +} + +func (_this TimeUnits) Is_Milliseconds() bool { + _, ok := _this.Get_().(TimeUnits_Milliseconds) + return ok +} + +func (CompanionStruct_TimeUnits_) Default() TimeUnits { + return Companion_TimeUnits_.Create_Seconds_() +} + +func (_ CompanionStruct_TimeUnits_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_TimeUnits_.Create_Seconds_(), true + case 1: + return Companion_TimeUnits_.Create_Milliseconds_(), true + default: + return TimeUnits{}, false + } + } +} + +func (_this TimeUnits) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case TimeUnits_Seconds: + { + return "AwsCryptographyMaterialProvidersTypes.TimeUnits.Seconds" + } + case TimeUnits_Milliseconds: + { + return "AwsCryptographyMaterialProvidersTypes.TimeUnits.Milliseconds" + } + default: + { + return "" + } + } +} + +func (_this TimeUnits) Equals(other TimeUnits) bool { + switch _this.Get_().(type) { + case TimeUnits_Seconds: + { + _, ok := other.Get_().(TimeUnits_Seconds) + return ok + } + case TimeUnits_Milliseconds: + { + _, ok := other.Get_().(TimeUnits_Milliseconds) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this TimeUnits) EqualsGeneric(other interface{}) bool { + typed, ok := other.(TimeUnits) + return ok && _this.Equals(typed) +} + +func Type_TimeUnits_() _dafny.TypeDescriptor { + return type_TimeUnits_{} +} + +type type_TimeUnits_ struct { +} + +func (_this type_TimeUnits_) Default() interface{} { + return Companion_TimeUnits_.Default() +} + +func (_this type_TimeUnits_) String() string { + return "AwsCryptographyMaterialProvidersTypes.TimeUnits" +} +func (_this TimeUnits) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = TimeUnits{} + +// End of datatype TimeUnits + +// Definition of datatype UpdateUsageMetadataInput +type UpdateUsageMetadataInput struct { + Data_UpdateUsageMetadataInput_ +} + +func (_this UpdateUsageMetadataInput) Get_() Data_UpdateUsageMetadataInput_ { + return _this.Data_UpdateUsageMetadataInput_ +} + +type Data_UpdateUsageMetadataInput_ interface { + isUpdateUsageMetadataInput() +} + +type CompanionStruct_UpdateUsageMetadataInput_ struct { +} + +var Companion_UpdateUsageMetadataInput_ = CompanionStruct_UpdateUsageMetadataInput_{} + +type UpdateUsageMetadataInput_UpdateUsageMetadataInput struct { + Identifier _dafny.Sequence + BytesUsed int32 +} + +func (UpdateUsageMetadataInput_UpdateUsageMetadataInput) isUpdateUsageMetadataInput() {} + +func (CompanionStruct_UpdateUsageMetadataInput_) Create_UpdateUsageMetadataInput_(Identifier _dafny.Sequence, BytesUsed int32) UpdateUsageMetadataInput { + return UpdateUsageMetadataInput{UpdateUsageMetadataInput_UpdateUsageMetadataInput{Identifier, BytesUsed}} +} + +func (_this UpdateUsageMetadataInput) Is_UpdateUsageMetadataInput() bool { + _, ok := _this.Get_().(UpdateUsageMetadataInput_UpdateUsageMetadataInput) + return ok +} + +func (CompanionStruct_UpdateUsageMetadataInput_) Default() UpdateUsageMetadataInput { + return Companion_UpdateUsageMetadataInput_.Create_UpdateUsageMetadataInput_(_dafny.EmptySeq, int32(0)) +} + +func (_this UpdateUsageMetadataInput) Dtor_identifier() _dafny.Sequence { + return _this.Get_().(UpdateUsageMetadataInput_UpdateUsageMetadataInput).Identifier +} + +func (_this UpdateUsageMetadataInput) Dtor_bytesUsed() int32 { + return _this.Get_().(UpdateUsageMetadataInput_UpdateUsageMetadataInput).BytesUsed +} + +func (_this UpdateUsageMetadataInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case UpdateUsageMetadataInput_UpdateUsageMetadataInput: + { + return "AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput.UpdateUsageMetadataInput" + "(" + _dafny.String(data.Identifier) + ", " + _dafny.String(data.BytesUsed) + ")" + } + default: + { + return "" + } + } +} + +func (_this UpdateUsageMetadataInput) Equals(other UpdateUsageMetadataInput) bool { + switch data1 := _this.Get_().(type) { + case UpdateUsageMetadataInput_UpdateUsageMetadataInput: + { + data2, ok := other.Get_().(UpdateUsageMetadataInput_UpdateUsageMetadataInput) + return ok && data1.Identifier.Equals(data2.Identifier) && data1.BytesUsed == data2.BytesUsed + } + default: + { + return false // unexpected + } + } +} + +func (_this UpdateUsageMetadataInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(UpdateUsageMetadataInput) + return ok && _this.Equals(typed) +} + +func Type_UpdateUsageMetadataInput_() _dafny.TypeDescriptor { + return type_UpdateUsageMetadataInput_{} +} + +type type_UpdateUsageMetadataInput_ struct { +} + +func (_this type_UpdateUsageMetadataInput_) Default() interface{} { + return Companion_UpdateUsageMetadataInput_.Default() +} + +func (_this type_UpdateUsageMetadataInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput" +} +func (_this UpdateUsageMetadataInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = UpdateUsageMetadataInput{} + +// End of datatype UpdateUsageMetadataInput + +// Definition of datatype ValidateCommitmentPolicyOnDecryptInput +type ValidateCommitmentPolicyOnDecryptInput struct { + Data_ValidateCommitmentPolicyOnDecryptInput_ +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) Get_() Data_ValidateCommitmentPolicyOnDecryptInput_ { + return _this.Data_ValidateCommitmentPolicyOnDecryptInput_ +} + +type Data_ValidateCommitmentPolicyOnDecryptInput_ interface { + isValidateCommitmentPolicyOnDecryptInput() +} + +type CompanionStruct_ValidateCommitmentPolicyOnDecryptInput_ struct { +} + +var Companion_ValidateCommitmentPolicyOnDecryptInput_ = CompanionStruct_ValidateCommitmentPolicyOnDecryptInput_{} + +type ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput struct { + Algorithm AlgorithmSuiteId + CommitmentPolicy CommitmentPolicy +} + +func (ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput) isValidateCommitmentPolicyOnDecryptInput() { +} + +func (CompanionStruct_ValidateCommitmentPolicyOnDecryptInput_) Create_ValidateCommitmentPolicyOnDecryptInput_(Algorithm AlgorithmSuiteId, CommitmentPolicy CommitmentPolicy) ValidateCommitmentPolicyOnDecryptInput { + return ValidateCommitmentPolicyOnDecryptInput{ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput{Algorithm, CommitmentPolicy}} +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) Is_ValidateCommitmentPolicyOnDecryptInput() bool { + _, ok := _this.Get_().(ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput) + return ok +} + +func (CompanionStruct_ValidateCommitmentPolicyOnDecryptInput_) Default() ValidateCommitmentPolicyOnDecryptInput { + return Companion_ValidateCommitmentPolicyOnDecryptInput_.Create_ValidateCommitmentPolicyOnDecryptInput_(Companion_AlgorithmSuiteId_.Default(), Companion_CommitmentPolicy_.Default()) +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) Dtor_algorithm() AlgorithmSuiteId { + return _this.Get_().(ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput).Algorithm +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) Dtor_commitmentPolicy() CommitmentPolicy { + return _this.Get_().(ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput).CommitmentPolicy +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput: + { + return "AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput.ValidateCommitmentPolicyOnDecryptInput" + "(" + _dafny.String(data.Algorithm) + ", " + _dafny.String(data.CommitmentPolicy) + ")" + } + default: + { + return "" + } + } +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) Equals(other ValidateCommitmentPolicyOnDecryptInput) bool { + switch data1 := _this.Get_().(type) { + case ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput: + { + data2, ok := other.Get_().(ValidateCommitmentPolicyOnDecryptInput_ValidateCommitmentPolicyOnDecryptInput) + return ok && data1.Algorithm.Equals(data2.Algorithm) && data1.CommitmentPolicy.Equals(data2.CommitmentPolicy) + } + default: + { + return false // unexpected + } + } +} + +func (_this ValidateCommitmentPolicyOnDecryptInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ValidateCommitmentPolicyOnDecryptInput) + return ok && _this.Equals(typed) +} + +func Type_ValidateCommitmentPolicyOnDecryptInput_() _dafny.TypeDescriptor { + return type_ValidateCommitmentPolicyOnDecryptInput_{} +} + +type type_ValidateCommitmentPolicyOnDecryptInput_ struct { +} + +func (_this type_ValidateCommitmentPolicyOnDecryptInput_) Default() interface{} { + return Companion_ValidateCommitmentPolicyOnDecryptInput_.Default() +} + +func (_this type_ValidateCommitmentPolicyOnDecryptInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput" +} +func (_this ValidateCommitmentPolicyOnDecryptInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ValidateCommitmentPolicyOnDecryptInput{} + +// End of datatype ValidateCommitmentPolicyOnDecryptInput + +// Definition of datatype ValidateCommitmentPolicyOnEncryptInput +type ValidateCommitmentPolicyOnEncryptInput struct { + Data_ValidateCommitmentPolicyOnEncryptInput_ +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) Get_() Data_ValidateCommitmentPolicyOnEncryptInput_ { + return _this.Data_ValidateCommitmentPolicyOnEncryptInput_ +} + +type Data_ValidateCommitmentPolicyOnEncryptInput_ interface { + isValidateCommitmentPolicyOnEncryptInput() +} + +type CompanionStruct_ValidateCommitmentPolicyOnEncryptInput_ struct { +} + +var Companion_ValidateCommitmentPolicyOnEncryptInput_ = CompanionStruct_ValidateCommitmentPolicyOnEncryptInput_{} + +type ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput struct { + Algorithm AlgorithmSuiteId + CommitmentPolicy CommitmentPolicy +} + +func (ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput) isValidateCommitmentPolicyOnEncryptInput() { +} + +func (CompanionStruct_ValidateCommitmentPolicyOnEncryptInput_) Create_ValidateCommitmentPolicyOnEncryptInput_(Algorithm AlgorithmSuiteId, CommitmentPolicy CommitmentPolicy) ValidateCommitmentPolicyOnEncryptInput { + return ValidateCommitmentPolicyOnEncryptInput{ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput{Algorithm, CommitmentPolicy}} +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) Is_ValidateCommitmentPolicyOnEncryptInput() bool { + _, ok := _this.Get_().(ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput) + return ok +} + +func (CompanionStruct_ValidateCommitmentPolicyOnEncryptInput_) Default() ValidateCommitmentPolicyOnEncryptInput { + return Companion_ValidateCommitmentPolicyOnEncryptInput_.Create_ValidateCommitmentPolicyOnEncryptInput_(Companion_AlgorithmSuiteId_.Default(), Companion_CommitmentPolicy_.Default()) +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) Dtor_algorithm() AlgorithmSuiteId { + return _this.Get_().(ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput).Algorithm +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) Dtor_commitmentPolicy() CommitmentPolicy { + return _this.Get_().(ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput).CommitmentPolicy +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput: + { + return "AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput.ValidateCommitmentPolicyOnEncryptInput" + "(" + _dafny.String(data.Algorithm) + ", " + _dafny.String(data.CommitmentPolicy) + ")" + } + default: + { + return "" + } + } +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) Equals(other ValidateCommitmentPolicyOnEncryptInput) bool { + switch data1 := _this.Get_().(type) { + case ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput: + { + data2, ok := other.Get_().(ValidateCommitmentPolicyOnEncryptInput_ValidateCommitmentPolicyOnEncryptInput) + return ok && data1.Algorithm.Equals(data2.Algorithm) && data1.CommitmentPolicy.Equals(data2.CommitmentPolicy) + } + default: + { + return false // unexpected + } + } +} + +func (_this ValidateCommitmentPolicyOnEncryptInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ValidateCommitmentPolicyOnEncryptInput) + return ok && _this.Equals(typed) +} + +func Type_ValidateCommitmentPolicyOnEncryptInput_() _dafny.TypeDescriptor { + return type_ValidateCommitmentPolicyOnEncryptInput_{} +} + +type type_ValidateCommitmentPolicyOnEncryptInput_ struct { +} + +func (_this type_ValidateCommitmentPolicyOnEncryptInput_) Default() interface{} { + return Companion_ValidateCommitmentPolicyOnEncryptInput_.Default() +} + +func (_this type_ValidateCommitmentPolicyOnEncryptInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput" +} +func (_this ValidateCommitmentPolicyOnEncryptInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ValidateCommitmentPolicyOnEncryptInput{} + +// End of datatype ValidateCommitmentPolicyOnEncryptInput + +// Definition of datatype ValidDecryptionMaterialsTransitionInput +type ValidDecryptionMaterialsTransitionInput struct { + Data_ValidDecryptionMaterialsTransitionInput_ +} + +func (_this ValidDecryptionMaterialsTransitionInput) Get_() Data_ValidDecryptionMaterialsTransitionInput_ { + return _this.Data_ValidDecryptionMaterialsTransitionInput_ +} + +type Data_ValidDecryptionMaterialsTransitionInput_ interface { + isValidDecryptionMaterialsTransitionInput() +} + +type CompanionStruct_ValidDecryptionMaterialsTransitionInput_ struct { +} + +var Companion_ValidDecryptionMaterialsTransitionInput_ = CompanionStruct_ValidDecryptionMaterialsTransitionInput_{} + +type ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput struct { + Start DecryptionMaterials + Stop DecryptionMaterials +} + +func (ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput) isValidDecryptionMaterialsTransitionInput() { +} + +func (CompanionStruct_ValidDecryptionMaterialsTransitionInput_) Create_ValidDecryptionMaterialsTransitionInput_(Start DecryptionMaterials, Stop DecryptionMaterials) ValidDecryptionMaterialsTransitionInput { + return ValidDecryptionMaterialsTransitionInput{ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput{Start, Stop}} +} + +func (_this ValidDecryptionMaterialsTransitionInput) Is_ValidDecryptionMaterialsTransitionInput() bool { + _, ok := _this.Get_().(ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput) + return ok +} + +func (CompanionStruct_ValidDecryptionMaterialsTransitionInput_) Default() ValidDecryptionMaterialsTransitionInput { + return Companion_ValidDecryptionMaterialsTransitionInput_.Create_ValidDecryptionMaterialsTransitionInput_(Companion_DecryptionMaterials_.Default(), Companion_DecryptionMaterials_.Default()) +} + +func (_this ValidDecryptionMaterialsTransitionInput) Dtor_start() DecryptionMaterials { + return _this.Get_().(ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput).Start +} + +func (_this ValidDecryptionMaterialsTransitionInput) Dtor_stop() DecryptionMaterials { + return _this.Get_().(ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput).Stop +} + +func (_this ValidDecryptionMaterialsTransitionInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput: + { + return "AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput.ValidDecryptionMaterialsTransitionInput" + "(" + _dafny.String(data.Start) + ", " + _dafny.String(data.Stop) + ")" + } + default: + { + return "" + } + } +} + +func (_this ValidDecryptionMaterialsTransitionInput) Equals(other ValidDecryptionMaterialsTransitionInput) bool { + switch data1 := _this.Get_().(type) { + case ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput: + { + data2, ok := other.Get_().(ValidDecryptionMaterialsTransitionInput_ValidDecryptionMaterialsTransitionInput) + return ok && data1.Start.Equals(data2.Start) && data1.Stop.Equals(data2.Stop) + } + default: + { + return false // unexpected + } + } +} + +func (_this ValidDecryptionMaterialsTransitionInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ValidDecryptionMaterialsTransitionInput) + return ok && _this.Equals(typed) +} + +func Type_ValidDecryptionMaterialsTransitionInput_() _dafny.TypeDescriptor { + return type_ValidDecryptionMaterialsTransitionInput_{} +} + +type type_ValidDecryptionMaterialsTransitionInput_ struct { +} + +func (_this type_ValidDecryptionMaterialsTransitionInput_) Default() interface{} { + return Companion_ValidDecryptionMaterialsTransitionInput_.Default() +} + +func (_this type_ValidDecryptionMaterialsTransitionInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput" +} +func (_this ValidDecryptionMaterialsTransitionInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ValidDecryptionMaterialsTransitionInput{} + +// End of datatype ValidDecryptionMaterialsTransitionInput + +// Definition of datatype ValidEncryptionMaterialsTransitionInput +type ValidEncryptionMaterialsTransitionInput struct { + Data_ValidEncryptionMaterialsTransitionInput_ +} + +func (_this ValidEncryptionMaterialsTransitionInput) Get_() Data_ValidEncryptionMaterialsTransitionInput_ { + return _this.Data_ValidEncryptionMaterialsTransitionInput_ +} + +type Data_ValidEncryptionMaterialsTransitionInput_ interface { + isValidEncryptionMaterialsTransitionInput() +} + +type CompanionStruct_ValidEncryptionMaterialsTransitionInput_ struct { +} + +var Companion_ValidEncryptionMaterialsTransitionInput_ = CompanionStruct_ValidEncryptionMaterialsTransitionInput_{} + +type ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput struct { + Start EncryptionMaterials + Stop EncryptionMaterials +} + +func (ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput) isValidEncryptionMaterialsTransitionInput() { +} + +func (CompanionStruct_ValidEncryptionMaterialsTransitionInput_) Create_ValidEncryptionMaterialsTransitionInput_(Start EncryptionMaterials, Stop EncryptionMaterials) ValidEncryptionMaterialsTransitionInput { + return ValidEncryptionMaterialsTransitionInput{ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput{Start, Stop}} +} + +func (_this ValidEncryptionMaterialsTransitionInput) Is_ValidEncryptionMaterialsTransitionInput() bool { + _, ok := _this.Get_().(ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput) + return ok +} + +func (CompanionStruct_ValidEncryptionMaterialsTransitionInput_) Default() ValidEncryptionMaterialsTransitionInput { + return Companion_ValidEncryptionMaterialsTransitionInput_.Create_ValidEncryptionMaterialsTransitionInput_(Companion_EncryptionMaterials_.Default(), Companion_EncryptionMaterials_.Default()) +} + +func (_this ValidEncryptionMaterialsTransitionInput) Dtor_start() EncryptionMaterials { + return _this.Get_().(ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput).Start +} + +func (_this ValidEncryptionMaterialsTransitionInput) Dtor_stop() EncryptionMaterials { + return _this.Get_().(ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput).Stop +} + +func (_this ValidEncryptionMaterialsTransitionInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput: + { + return "AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput.ValidEncryptionMaterialsTransitionInput" + "(" + _dafny.String(data.Start) + ", " + _dafny.String(data.Stop) + ")" + } + default: + { + return "" + } + } +} + +func (_this ValidEncryptionMaterialsTransitionInput) Equals(other ValidEncryptionMaterialsTransitionInput) bool { + switch data1 := _this.Get_().(type) { + case ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput: + { + data2, ok := other.Get_().(ValidEncryptionMaterialsTransitionInput_ValidEncryptionMaterialsTransitionInput) + return ok && data1.Start.Equals(data2.Start) && data1.Stop.Equals(data2.Stop) + } + default: + { + return false // unexpected + } + } +} + +func (_this ValidEncryptionMaterialsTransitionInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ValidEncryptionMaterialsTransitionInput) + return ok && _this.Equals(typed) +} + +func Type_ValidEncryptionMaterialsTransitionInput_() _dafny.TypeDescriptor { + return type_ValidEncryptionMaterialsTransitionInput_{} +} + +type type_ValidEncryptionMaterialsTransitionInput_ struct { +} + +func (_this type_ValidEncryptionMaterialsTransitionInput_) Default() interface{} { + return Companion_ValidEncryptionMaterialsTransitionInput_.Default() +} + +func (_this type_ValidEncryptionMaterialsTransitionInput_) String() string { + return "AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput" +} +func (_this ValidEncryptionMaterialsTransitionInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ValidEncryptionMaterialsTransitionInput{} + +// End of datatype ValidEncryptionMaterialsTransitionInput + +// Definition of datatype Error +type Error struct { + Data_Error_ +} + +func (_this Error) Get_() Data_Error_ { + return _this.Data_Error_ +} + +type Data_Error_ interface { + isError() +} + +type CompanionStruct_Error_ struct { +} + +var Companion_Error_ = CompanionStruct_Error_{} + +type Error_AwsCryptographicMaterialProvidersException struct { + Message _dafny.Sequence +} + +func (Error_AwsCryptographicMaterialProvidersException) isError() {} + +func (CompanionStruct_Error_) Create_AwsCryptographicMaterialProvidersException_(Message _dafny.Sequence) Error { + return Error{Error_AwsCryptographicMaterialProvidersException{Message}} +} + +func (_this Error) Is_AwsCryptographicMaterialProvidersException() bool { + _, ok := _this.Get_().(Error_AwsCryptographicMaterialProvidersException) + return ok +} + +type Error_EntryAlreadyExists struct { + Message _dafny.Sequence +} + +func (Error_EntryAlreadyExists) isError() {} + +func (CompanionStruct_Error_) Create_EntryAlreadyExists_(Message _dafny.Sequence) Error { + return Error{Error_EntryAlreadyExists{Message}} +} + +func (_this Error) Is_EntryAlreadyExists() bool { + _, ok := _this.Get_().(Error_EntryAlreadyExists) + return ok +} + +type Error_EntryDoesNotExist struct { + Message _dafny.Sequence +} + +func (Error_EntryDoesNotExist) isError() {} + +func (CompanionStruct_Error_) Create_EntryDoesNotExist_(Message _dafny.Sequence) Error { + return Error{Error_EntryDoesNotExist{Message}} +} + +func (_this Error) Is_EntryDoesNotExist() bool { + _, ok := _this.Get_().(Error_EntryDoesNotExist) + return ok +} + +type Error_InFlightTTLExceeded struct { + Message _dafny.Sequence +} + +func (Error_InFlightTTLExceeded) isError() {} + +func (CompanionStruct_Error_) Create_InFlightTTLExceeded_(Message _dafny.Sequence) Error { + return Error{Error_InFlightTTLExceeded{Message}} +} + +func (_this Error) Is_InFlightTTLExceeded() bool { + _, ok := _this.Get_().(Error_InFlightTTLExceeded) + return ok +} + +type Error_InvalidAlgorithmSuiteInfo struct { + Message _dafny.Sequence +} + +func (Error_InvalidAlgorithmSuiteInfo) isError() {} + +func (CompanionStruct_Error_) Create_InvalidAlgorithmSuiteInfo_(Message _dafny.Sequence) Error { + return Error{Error_InvalidAlgorithmSuiteInfo{Message}} +} + +func (_this Error) Is_InvalidAlgorithmSuiteInfo() bool { + _, ok := _this.Get_().(Error_InvalidAlgorithmSuiteInfo) + return ok +} + +type Error_InvalidAlgorithmSuiteInfoOnDecrypt struct { + Message _dafny.Sequence +} + +func (Error_InvalidAlgorithmSuiteInfoOnDecrypt) isError() {} + +func (CompanionStruct_Error_) Create_InvalidAlgorithmSuiteInfoOnDecrypt_(Message _dafny.Sequence) Error { + return Error{Error_InvalidAlgorithmSuiteInfoOnDecrypt{Message}} +} + +func (_this Error) Is_InvalidAlgorithmSuiteInfoOnDecrypt() bool { + _, ok := _this.Get_().(Error_InvalidAlgorithmSuiteInfoOnDecrypt) + return ok +} + +type Error_InvalidAlgorithmSuiteInfoOnEncrypt struct { + Message _dafny.Sequence +} + +func (Error_InvalidAlgorithmSuiteInfoOnEncrypt) isError() {} + +func (CompanionStruct_Error_) Create_InvalidAlgorithmSuiteInfoOnEncrypt_(Message _dafny.Sequence) Error { + return Error{Error_InvalidAlgorithmSuiteInfoOnEncrypt{Message}} +} + +func (_this Error) Is_InvalidAlgorithmSuiteInfoOnEncrypt() bool { + _, ok := _this.Get_().(Error_InvalidAlgorithmSuiteInfoOnEncrypt) + return ok +} + +type Error_InvalidDecryptionMaterials struct { + Message _dafny.Sequence +} + +func (Error_InvalidDecryptionMaterials) isError() {} + +func (CompanionStruct_Error_) Create_InvalidDecryptionMaterials_(Message _dafny.Sequence) Error { + return Error{Error_InvalidDecryptionMaterials{Message}} +} + +func (_this Error) Is_InvalidDecryptionMaterials() bool { + _, ok := _this.Get_().(Error_InvalidDecryptionMaterials) + return ok +} + +type Error_InvalidDecryptionMaterialsTransition struct { + Message _dafny.Sequence +} + +func (Error_InvalidDecryptionMaterialsTransition) isError() {} + +func (CompanionStruct_Error_) Create_InvalidDecryptionMaterialsTransition_(Message _dafny.Sequence) Error { + return Error{Error_InvalidDecryptionMaterialsTransition{Message}} +} + +func (_this Error) Is_InvalidDecryptionMaterialsTransition() bool { + _, ok := _this.Get_().(Error_InvalidDecryptionMaterialsTransition) + return ok +} + +type Error_InvalidEncryptionMaterials struct { + Message _dafny.Sequence +} + +func (Error_InvalidEncryptionMaterials) isError() {} + +func (CompanionStruct_Error_) Create_InvalidEncryptionMaterials_(Message _dafny.Sequence) Error { + return Error{Error_InvalidEncryptionMaterials{Message}} +} + +func (_this Error) Is_InvalidEncryptionMaterials() bool { + _, ok := _this.Get_().(Error_InvalidEncryptionMaterials) + return ok +} + +type Error_InvalidEncryptionMaterialsTransition struct { + Message _dafny.Sequence +} + +func (Error_InvalidEncryptionMaterialsTransition) isError() {} + +func (CompanionStruct_Error_) Create_InvalidEncryptionMaterialsTransition_(Message _dafny.Sequence) Error { + return Error{Error_InvalidEncryptionMaterialsTransition{Message}} +} + +func (_this Error) Is_InvalidEncryptionMaterialsTransition() bool { + _, ok := _this.Get_().(Error_InvalidEncryptionMaterialsTransition) + return ok +} + +type Error_AwsCryptographyKeyStore struct { + AwsCryptographyKeyStore m_AwsCryptographyKeyStoreTypes.Error +} + +func (Error_AwsCryptographyKeyStore) isError() {} + +func (CompanionStruct_Error_) Create_AwsCryptographyKeyStore_(AwsCryptographyKeyStore m_AwsCryptographyKeyStoreTypes.Error) Error { + return Error{Error_AwsCryptographyKeyStore{AwsCryptographyKeyStore}} +} + +func (_this Error) Is_AwsCryptographyKeyStore() bool { + _, ok := _this.Get_().(Error_AwsCryptographyKeyStore) + return ok +} + +type Error_AwsCryptographyPrimitives struct { + AwsCryptographyPrimitives m_AwsCryptographyPrimitivesTypes.Error +} + +func (Error_AwsCryptographyPrimitives) isError() {} + +func (CompanionStruct_Error_) Create_AwsCryptographyPrimitives_(AwsCryptographyPrimitives m_AwsCryptographyPrimitivesTypes.Error) Error { + return Error{Error_AwsCryptographyPrimitives{AwsCryptographyPrimitives}} +} + +func (_this Error) Is_AwsCryptographyPrimitives() bool { + _, ok := _this.Get_().(Error_AwsCryptographyPrimitives) + return ok +} + +type Error_ComAmazonawsDynamodb struct { + ComAmazonawsDynamodb m_ComAmazonawsDynamodbTypes.Error +} + +func (Error_ComAmazonawsDynamodb) isError() {} + +func (CompanionStruct_Error_) Create_ComAmazonawsDynamodb_(ComAmazonawsDynamodb m_ComAmazonawsDynamodbTypes.Error) Error { + return Error{Error_ComAmazonawsDynamodb{ComAmazonawsDynamodb}} +} + +func (_this Error) Is_ComAmazonawsDynamodb() bool { + _, ok := _this.Get_().(Error_ComAmazonawsDynamodb) + return ok +} + +type Error_ComAmazonawsKms struct { + ComAmazonawsKms m_ComAmazonawsKmsTypes.Error +} + +func (Error_ComAmazonawsKms) isError() {} + +func (CompanionStruct_Error_) Create_ComAmazonawsKms_(ComAmazonawsKms m_ComAmazonawsKmsTypes.Error) Error { + return Error{Error_ComAmazonawsKms{ComAmazonawsKms}} +} + +func (_this Error) Is_ComAmazonawsKms() bool { + _, ok := _this.Get_().(Error_ComAmazonawsKms) + return ok +} + +type Error_CollectionOfErrors struct { + List _dafny.Sequence + Message _dafny.Sequence +} + +func (Error_CollectionOfErrors) isError() {} + +func (CompanionStruct_Error_) Create_CollectionOfErrors_(List _dafny.Sequence, Message _dafny.Sequence) Error { + return Error{Error_CollectionOfErrors{List, Message}} +} + +func (_this Error) Is_CollectionOfErrors() bool { + _, ok := _this.Get_().(Error_CollectionOfErrors) + return ok +} + +type Error_Opaque struct { + Obj interface{} +} + +func (Error_Opaque) isError() {} + +func (CompanionStruct_Error_) Create_Opaque_(Obj interface{}) Error { + return Error{Error_Opaque{Obj}} +} + +func (_this Error) Is_Opaque() bool { + _, ok := _this.Get_().(Error_Opaque) + return ok +} + +type Error_OpaqueWithText struct { + Obj interface{} + ObjMessage _dafny.Sequence +} + +func (Error_OpaqueWithText) isError() {} + +func (CompanionStruct_Error_) Create_OpaqueWithText_(Obj interface{}, ObjMessage _dafny.Sequence) Error { + return Error{Error_OpaqueWithText{Obj, ObjMessage}} +} + +func (_this Error) Is_OpaqueWithText() bool { + _, ok := _this.Get_().(Error_OpaqueWithText) + return ok +} + +func (CompanionStruct_Error_) Default() Error { + return Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.EmptySeq.SetString()) +} + +func (_this Error) Dtor_message() _dafny.Sequence { + switch data := _this.Get_().(type) { + case Error_AwsCryptographicMaterialProvidersException: + return data.Message + case Error_EntryAlreadyExists: + return data.Message + case Error_EntryDoesNotExist: + return data.Message + case Error_InFlightTTLExceeded: + return data.Message + case Error_InvalidAlgorithmSuiteInfo: + return data.Message + case Error_InvalidAlgorithmSuiteInfoOnDecrypt: + return data.Message + case Error_InvalidAlgorithmSuiteInfoOnEncrypt: + return data.Message + case Error_InvalidDecryptionMaterials: + return data.Message + case Error_InvalidDecryptionMaterialsTransition: + return data.Message + case Error_InvalidEncryptionMaterials: + return data.Message + case Error_InvalidEncryptionMaterialsTransition: + return data.Message + default: + return data.(Error_CollectionOfErrors).Message + } +} + +func (_this Error) Dtor_AwsCryptographyKeyStore() m_AwsCryptographyKeyStoreTypes.Error { + return _this.Get_().(Error_AwsCryptographyKeyStore).AwsCryptographyKeyStore +} + +func (_this Error) Dtor_AwsCryptographyPrimitives() m_AwsCryptographyPrimitivesTypes.Error { + return _this.Get_().(Error_AwsCryptographyPrimitives).AwsCryptographyPrimitives +} + +func (_this Error) Dtor_ComAmazonawsDynamodb() m_ComAmazonawsDynamodbTypes.Error { + return _this.Get_().(Error_ComAmazonawsDynamodb).ComAmazonawsDynamodb +} + +func (_this Error) Dtor_ComAmazonawsKms() m_ComAmazonawsKmsTypes.Error { + return _this.Get_().(Error_ComAmazonawsKms).ComAmazonawsKms +} + +func (_this Error) Dtor_list() _dafny.Sequence { + return _this.Get_().(Error_CollectionOfErrors).List +} + +func (_this Error) Dtor_obj() interface{} { + switch data := _this.Get_().(type) { + case Error_Opaque: + return data.Obj + default: + return data.(Error_OpaqueWithText).Obj + } +} + +func (_this Error) Dtor_objMessage() _dafny.Sequence { + return _this.Get_().(Error_OpaqueWithText).ObjMessage +} + +func (_this Error) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Error_AwsCryptographicMaterialProvidersException: + { + return "AwsCryptographyMaterialProvidersTypes.Error.AwsCryptographicMaterialProvidersException" + "(" + _dafny.String(data.Message) + ")" + } + case Error_EntryAlreadyExists: + { + return "AwsCryptographyMaterialProvidersTypes.Error.EntryAlreadyExists" + "(" + _dafny.String(data.Message) + ")" + } + case Error_EntryDoesNotExist: + { + return "AwsCryptographyMaterialProvidersTypes.Error.EntryDoesNotExist" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InFlightTTLExceeded: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InFlightTTLExceeded" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidAlgorithmSuiteInfo: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidAlgorithmSuiteInfo" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidAlgorithmSuiteInfoOnDecrypt: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidAlgorithmSuiteInfoOnDecrypt" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidAlgorithmSuiteInfoOnEncrypt: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidAlgorithmSuiteInfoOnEncrypt" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidDecryptionMaterials: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidDecryptionMaterials" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidDecryptionMaterialsTransition: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidDecryptionMaterialsTransition" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidEncryptionMaterials: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidEncryptionMaterials" + "(" + _dafny.String(data.Message) + ")" + } + case Error_InvalidEncryptionMaterialsTransition: + { + return "AwsCryptographyMaterialProvidersTypes.Error.InvalidEncryptionMaterialsTransition" + "(" + _dafny.String(data.Message) + ")" + } + case Error_AwsCryptographyKeyStore: + { + return "AwsCryptographyMaterialProvidersTypes.Error.AwsCryptographyKeyStore" + "(" + _dafny.String(data.AwsCryptographyKeyStore) + ")" + } + case Error_AwsCryptographyPrimitives: + { + return "AwsCryptographyMaterialProvidersTypes.Error.AwsCryptographyPrimitives" + "(" + _dafny.String(data.AwsCryptographyPrimitives) + ")" + } + case Error_ComAmazonawsDynamodb: + { + return "AwsCryptographyMaterialProvidersTypes.Error.ComAmazonawsDynamodb" + "(" + _dafny.String(data.ComAmazonawsDynamodb) + ")" + } + case Error_ComAmazonawsKms: + { + return "AwsCryptographyMaterialProvidersTypes.Error.ComAmazonawsKms" + "(" + _dafny.String(data.ComAmazonawsKms) + ")" + } + case Error_CollectionOfErrors: + { + return "AwsCryptographyMaterialProvidersTypes.Error.CollectionOfErrors" + "(" + _dafny.String(data.List) + ", " + _dafny.String(data.Message) + ")" + } + case Error_Opaque: + { + return "AwsCryptographyMaterialProvidersTypes.Error.Opaque" + "(" + _dafny.String(data.Obj) + ")" + } + case Error_OpaqueWithText: + { + return "AwsCryptographyMaterialProvidersTypes.Error.OpaqueWithText" + "(" + _dafny.String(data.Obj) + ", " + _dafny.String(data.ObjMessage) + ")" + } + default: + { + return "" + } + } +} + +func (_this Error) Equals(other Error) bool { + switch data1 := _this.Get_().(type) { + case Error_AwsCryptographicMaterialProvidersException: + { + data2, ok := other.Get_().(Error_AwsCryptographicMaterialProvidersException) + return ok && data1.Message.Equals(data2.Message) + } + case Error_EntryAlreadyExists: + { + data2, ok := other.Get_().(Error_EntryAlreadyExists) + return ok && data1.Message.Equals(data2.Message) + } + case Error_EntryDoesNotExist: + { + data2, ok := other.Get_().(Error_EntryDoesNotExist) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InFlightTTLExceeded: + { + data2, ok := other.Get_().(Error_InFlightTTLExceeded) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidAlgorithmSuiteInfo: + { + data2, ok := other.Get_().(Error_InvalidAlgorithmSuiteInfo) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidAlgorithmSuiteInfoOnDecrypt: + { + data2, ok := other.Get_().(Error_InvalidAlgorithmSuiteInfoOnDecrypt) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidAlgorithmSuiteInfoOnEncrypt: + { + data2, ok := other.Get_().(Error_InvalidAlgorithmSuiteInfoOnEncrypt) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidDecryptionMaterials: + { + data2, ok := other.Get_().(Error_InvalidDecryptionMaterials) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidDecryptionMaterialsTransition: + { + data2, ok := other.Get_().(Error_InvalidDecryptionMaterialsTransition) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidEncryptionMaterials: + { + data2, ok := other.Get_().(Error_InvalidEncryptionMaterials) + return ok && data1.Message.Equals(data2.Message) + } + case Error_InvalidEncryptionMaterialsTransition: + { + data2, ok := other.Get_().(Error_InvalidEncryptionMaterialsTransition) + return ok && data1.Message.Equals(data2.Message) + } + case Error_AwsCryptographyKeyStore: + { + data2, ok := other.Get_().(Error_AwsCryptographyKeyStore) + return ok && data1.AwsCryptographyKeyStore.Equals(data2.AwsCryptographyKeyStore) + } + case Error_AwsCryptographyPrimitives: + { + data2, ok := other.Get_().(Error_AwsCryptographyPrimitives) + return ok && data1.AwsCryptographyPrimitives.Equals(data2.AwsCryptographyPrimitives) + } + case Error_ComAmazonawsDynamodb: + { + data2, ok := other.Get_().(Error_ComAmazonawsDynamodb) + return ok && data1.ComAmazonawsDynamodb.Equals(data2.ComAmazonawsDynamodb) + } + case Error_ComAmazonawsKms: + { + data2, ok := other.Get_().(Error_ComAmazonawsKms) + return ok && data1.ComAmazonawsKms.Equals(data2.ComAmazonawsKms) + } + case Error_CollectionOfErrors: + { + data2, ok := other.Get_().(Error_CollectionOfErrors) + return ok && data1.List.Equals(data2.List) && data1.Message.Equals(data2.Message) + } + case Error_Opaque: + { + data2, ok := other.Get_().(Error_Opaque) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) + } + case Error_OpaqueWithText: + { + data2, ok := other.Get_().(Error_OpaqueWithText) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) && data1.ObjMessage.Equals(data2.ObjMessage) + } + default: + { + return false // unexpected + } + } +} + +func (_this Error) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Error) + return ok && _this.Equals(typed) +} + +func Type_Error_() _dafny.TypeDescriptor { + return type_Error_{} +} + +type type_Error_ struct { +} + +func (_this type_Error_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_Error_) String() string { + return "AwsCryptographyMaterialProvidersTypes.Error" +} +func (_this Error) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Error{} + +// End of datatype Error + +// Definition of class OpaqueError +type OpaqueError struct { +} + +func New_OpaqueError_() *OpaqueError { + _this := OpaqueError{} + + return &_this +} + +type CompanionStruct_OpaqueError_ struct { +} + +var Companion_OpaqueError_ = CompanionStruct_OpaqueError_{} + +func (*OpaqueError) String() string { + return "AwsCryptographyMaterialProvidersTypes.OpaqueError" +} + +// End of class OpaqueError + +func Type_OpaqueError_() _dafny.TypeDescriptor { + return type_OpaqueError_{} +} + +type type_OpaqueError_ struct { +} + +func (_this type_OpaqueError_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_OpaqueError_) String() string { + return "AwsCryptographyMaterialProvidersTypes.OpaqueError" +} +func (_this *CompanionStruct_OpaqueError_) Is_(__source Error) bool { + var _2_e Error = (__source) + _ = _2_e + return ((_2_e).Is_Opaque()) || ((_2_e).Is_OpaqueWithText()) +} + +// Definition of class DummySubsetType +type DummySubsetType struct { +} + +func New_DummySubsetType_() *DummySubsetType { + _this := DummySubsetType{} + + return &_this +} + +type CompanionStruct_DummySubsetType_ struct { +} + +var Companion_DummySubsetType_ = CompanionStruct_DummySubsetType_{} + +func (*DummySubsetType) String() string { + return "AwsCryptographyMaterialProvidersTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Witness() _dafny.Int { + return _dafny.One +} + +// End of class DummySubsetType + +func Type_DummySubsetType_() _dafny.TypeDescriptor { + return type_DummySubsetType_{} +} + +type type_DummySubsetType_ struct { +} + +func (_this type_DummySubsetType_) Default() interface{} { + return Companion_DummySubsetType_.Witness() +} + +func (_this type_DummySubsetType_) String() string { + return "AwsCryptographyMaterialProvidersTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Is_(__source _dafny.Int) bool { + var _3_x _dafny.Int = (__source) + _ = _3_x + return Companion_Default___.IsDummySubsetType(_3_x) +} diff --git a/releases/go/mpl/AwsKmsDiscoveryKeyring/AwsKmsDiscoveryKeyring.go b/releases/go/mpl/AwsKmsDiscoveryKeyring/AwsKmsDiscoveryKeyring.go new file mode 100644 index 000000000..5cd860463 --- /dev/null +++ b/releases/go/mpl/AwsKmsDiscoveryKeyring/AwsKmsDiscoveryKeyring.go @@ -0,0 +1,808 @@ +// Package AwsKmsDiscoveryKeyring +// Dafny module AwsKmsDiscoveryKeyring compiled into Go + +package AwsKmsDiscoveryKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsDiscoveryKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DiscoveryMatch(arn m_AwsArnParsing.AwsArn, discoveryFilter m_Wrappers.Option) bool { + return (true) && (func() bool { + var _source0 m_Wrappers.Option = discoveryFilter + _ = _source0 + { + if _source0.Is_Some() { + var _0_filter m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter = _source0.Get_().(m_Wrappers.Option_Some).Value.(m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter) + _ = _0_filter + return (_dafny.Companion_Sequence_.Equal((_0_filter).Dtor_partition(), (arn).Dtor_partition())) && (_dafny.Companion_Sequence_.IsPrefixOf((_0_filter).Dtor_accountIds(), _dafny.SeqOf((arn).Dtor_account()))) + } + } + { + return true + } + }()) +} + +// End of class Default__ + +// Definition of class AwsKmsDiscoveryKeyring +type AwsKmsDiscoveryKeyring struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _discoveryFilter m_Wrappers.Option + _grantTokens _dafny.Sequence +} + +func New_AwsKmsDiscoveryKeyring_() *AwsKmsDiscoveryKeyring { + _this := AwsKmsDiscoveryKeyring{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsDiscoveryKeyring_ struct { +} + +var Companion_AwsKmsDiscoveryKeyring_ = CompanionStruct_AwsKmsDiscoveryKeyring_{} + +func (_this *AwsKmsDiscoveryKeyring) Equals(other *AwsKmsDiscoveryKeyring) bool { + return _this == other +} + +func (_this *AwsKmsDiscoveryKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsDiscoveryKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsDiscoveryKeyring) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring" +} + +func Type_AwsKmsDiscoveryKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsDiscoveryKeyring_{} +} + +type type_AwsKmsDiscoveryKeyring_ struct { +} + +func (_this type_AwsKmsDiscoveryKeyring_) Default() interface{} { + return (*AwsKmsDiscoveryKeyring)(nil) +} + +func (_this type_AwsKmsDiscoveryKeyring_) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring" +} +func (_this *AwsKmsDiscoveryKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsDiscoveryKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsDiscoveryKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsDiscoveryKeyring{} + +func (_this *AwsKmsDiscoveryKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out3 +} +func (_this *AwsKmsDiscoveryKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out3 +} +func (_this *AwsKmsDiscoveryKeyring) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, discoveryFilter m_Wrappers.Option, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._discoveryFilter = discoveryFilter + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsDiscoveryKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption is not supported with a Discovery Keyring."))) + return output + return output + } +} +func (_this *AwsKmsDiscoveryKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_encryptedDataKeys _dafny.Sequence + _ = _1_encryptedDataKeys + _1_encryptedDataKeys = (input).Dtor_encryptedDataKeys() + var _2_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _2_suite + _2_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError0 + _3_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _4_edkFilter *AwsKmsEncryptedDataKeyFilter + _ = _4_edkFilter + var _nw0 *AwsKmsEncryptedDataKeyFilter = New_AwsKmsEncryptedDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).DiscoveryFilter()) + _4_edkFilter = _nw0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_4_edkFilter, _1_encryptedDataKeys) + _5_valueOrError1 = _out0 + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_matchingEdks _dafny.Sequence + _ = _6_matchingEdks + _6_matchingEdks = (_5_valueOrError1).Extract().(_dafny.Sequence) + var _7_edkTransform *AwsKmsEncryptedDataKeyTransformer + _ = _7_edkTransform + var _nw1 *AwsKmsEncryptedDataKeyTransformer = New_AwsKmsEncryptedDataKeyTransformer_() + _ = _nw1 + _nw1.Ctor__() + _7_edkTransform = _nw1 + var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _8_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.DeterministicFlatMapWithResult(_7_edkTransform, _6_matchingEdks) + _8_valueOrError2 = _out1 + if (_8_valueOrError2).IsFailure() { + res = (_8_valueOrError2).PropagateFailure() + return res + } + var _9_edksToAttempt _dafny.Sequence + _ = _9_edksToAttempt + _9_edksToAttempt = (_8_valueOrError2).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_9_edksToAttempt).Cardinality())).Sign() == 0 { + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _10_valueOrError3 + _10_valueOrError3 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_10_valueOrError3).IsFailure() { + res = (_10_valueOrError3).PropagateFailure() + return res + } + var _11_errorMessage _dafny.Sequence + _ = _11_errorMessage + _11_errorMessage = (_10_valueOrError3).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_11_errorMessage)) + return res + } + var _12_decryptAction *AwsKmsEncryptedDataKeyDecryptor + _ = _12_decryptAction + var _nw2 *AwsKmsEncryptedDataKeyDecryptor = New_AwsKmsEncryptedDataKeyDecryptor_() + _ = _nw2 + _nw2.Ctor__(_0_materials, (_this).Client(), (_this).GrantTokens()) + _12_decryptAction = _nw2 + var _13_outcome m_Wrappers.Result + _ = _13_outcome + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_Actions.Companion_Default___.ReduceToSuccess(_12_decryptAction, _9_edksToAttempt) + _13_outcome = _out2 + var _source0 m_Wrappers.Result = _13_outcome + _ = _source0 + { + { + if _source0.Is_Success() { + var _14_mat m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = _source0.Get_().(m_Wrappers.Result_Success).Value.(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + _ = _14_mat + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_14_mat)) + goto Lmatch0 + } + } + { + var _15_errors _dafny.Sequence = _source0.Get_().(m_Wrappers.Result_Failure).Error.(_dafny.Sequence) + _ = _15_errors + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_15_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`."))) + } + goto Lmatch0 + } + Lmatch0: + return res + return res + } +} +func (_this *AwsKmsDiscoveryKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsDiscoveryKeyring) DiscoveryFilter() m_Wrappers.Option { + { + return _this._discoveryFilter + } +} +func (_this *AwsKmsDiscoveryKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class AwsKmsDiscoveryKeyring + +// Definition of class AwsKmsEncryptedDataKeyFilter +type AwsKmsEncryptedDataKeyFilter struct { + _discoveryFilter m_Wrappers.Option +} + +func New_AwsKmsEncryptedDataKeyFilter_() *AwsKmsEncryptedDataKeyFilter { + _this := AwsKmsEncryptedDataKeyFilter{} + + _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKeyFilter_ struct { +} + +var Companion_AwsKmsEncryptedDataKeyFilter_ = CompanionStruct_AwsKmsEncryptedDataKeyFilter_{} + +func (_this *AwsKmsEncryptedDataKeyFilter) Equals(other *AwsKmsEncryptedDataKeyFilter) bool { + return _this == other +} + +func (_this *AwsKmsEncryptedDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEncryptedDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*AwsKmsEncryptedDataKeyFilter) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyFilter" +} + +func Type_AwsKmsEncryptedDataKeyFilter_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKeyFilter_{} +} + +type type_AwsKmsEncryptedDataKeyFilter_ struct { +} + +func (_this type_AwsKmsEncryptedDataKeyFilter_) Default() interface{} { + return (*AwsKmsEncryptedDataKeyFilter)(nil) +} + +func (_this type_AwsKmsEncryptedDataKeyFilter_) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyFilter" +} +func (_this *AwsKmsEncryptedDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &AwsKmsEncryptedDataKeyFilter{} +var _ m_Actions.DeterministicAction = &AwsKmsEncryptedDataKeyFilter{} +var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyFilter{} + +func (_this *AwsKmsEncryptedDataKeyFilter) Ctor__(discoveryFilter m_Wrappers.Option) { + { + (_this)._discoveryFilter = discoveryFilter + } +} +func (_this *AwsKmsEncryptedDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _1_valueOrError1 + _1_valueOrError1 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer63 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg64 interface{}) interface{} { + return coer63(arg64.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_keyId _dafny.Sequence + _ = _2_keyId + _2_keyId = (_1_valueOrError1).Extract().(_dafny.Sequence) + var _3_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError2 + _3_valueOrError2 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_2_keyId)).MapFailure(func(coer64 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg65 interface{}) interface{} { + return coer64(arg65.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_3_valueOrError2).IsFailure() { + output = (_3_valueOrError2).PropagateFailure() + return output + } + var _4_arn m_AwsArnParsing.AwsArn + _ = _4_arn + _4_arn = (_3_valueOrError2).Extract().(m_AwsArnParsing.AwsArn) + var _5_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError3 + _5_valueOrError3 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(((_4_arn).Dtor_resource()).Dtor_resourceType(), _dafny.SeqOfString("key")), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Only AWS KMS Keys supported"))) + if (_5_valueOrError3).IsFailure() { + output = (_5_valueOrError3).PropagateFailure() + return output + } + if !_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()) { + output = m_Wrappers.Companion_Result_.Create_Success_(false) + return output + } + if !(Companion_Default___.DiscoveryMatch(_4_arn, (_this).DiscoveryFilter())) { + output = m_Wrappers.Companion_Result_.Create_Success_(false) + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(true) + return output + return output + } +} +func (_this *AwsKmsEncryptedDataKeyFilter) DiscoveryFilter() m_Wrappers.Option { + { + return _this._discoveryFilter + } +} + +// End of class AwsKmsEncryptedDataKeyFilter + +// Definition of class AwsKmsEncryptedDataKeyTransformer +type AwsKmsEncryptedDataKeyTransformer struct { + dummy byte +} + +func New_AwsKmsEncryptedDataKeyTransformer_() *AwsKmsEncryptedDataKeyTransformer { + _this := AwsKmsEncryptedDataKeyTransformer{} + + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKeyTransformer_ struct { +} + +var Companion_AwsKmsEncryptedDataKeyTransformer_ = CompanionStruct_AwsKmsEncryptedDataKeyTransformer_{} + +func (_this *AwsKmsEncryptedDataKeyTransformer) Equals(other *AwsKmsEncryptedDataKeyTransformer) bool { + return _this == other +} + +func (_this *AwsKmsEncryptedDataKeyTransformer) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEncryptedDataKeyTransformer) + return ok && _this.Equals(other) +} + +func (*AwsKmsEncryptedDataKeyTransformer) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyTransformer" +} + +func Type_AwsKmsEncryptedDataKeyTransformer_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKeyTransformer_{} +} + +type type_AwsKmsEncryptedDataKeyTransformer_ struct { +} + +func (_this type_AwsKmsEncryptedDataKeyTransformer_) Default() interface{} { + return (*AwsKmsEncryptedDataKeyTransformer)(nil) +} + +func (_this type_AwsKmsEncryptedDataKeyTransformer_) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyTransformer" +} +func (_this *AwsKmsEncryptedDataKeyTransformer) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &AwsKmsEncryptedDataKeyTransformer{} +var _ m_Actions.DeterministicAction = &AwsKmsEncryptedDataKeyTransformer{} +var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyTransformer{} + +func (_this *AwsKmsEncryptedDataKeyTransformer) Ctor__() { + { + } +} +func (_this *AwsKmsEncryptedDataKeyTransformer) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encrypted data key was not generated by KMS"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) + if (_1_valueOrError1).IsFailure() { + res = (_1_valueOrError1).PropagateFailure() + return res + } + var _2_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _2_valueOrError2 + _2_valueOrError2 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer65 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg66 interface{}) interface{} { + return coer65(arg66.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_2_valueOrError2).IsFailure() { + res = (_2_valueOrError2).PropagateFailure() + return res + } + var _3_keyId _dafny.Sequence + _ = _3_keyId + _3_keyId = (_2_valueOrError2).Extract().(_dafny.Sequence) + var _4_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError3 + _4_valueOrError3 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_3_keyId)).MapFailure(func(coer66 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg67 interface{}) interface{} { + return coer66(arg67.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_4_valueOrError3).IsFailure() { + res = (_4_valueOrError3).PropagateFailure() + return res + } + var _5_arn m_AwsArnParsing.AwsArn + _ = _5_arn + _5_arn = (_4_valueOrError3).Extract().(m_AwsArnParsing.AwsArn) + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf(m_Constants.Companion_AwsKmsEdkHelper_.Create_AwsKmsEdkHelper_(edk, _5_arn))) + return res + return res + } +} + +// End of class AwsKmsEncryptedDataKeyTransformer + +// Definition of class AwsKmsEncryptedDataKeyDecryptor +type AwsKmsEncryptedDataKeyDecryptor struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _client m_ComAmazonawsKmsTypes.IKMSClient + _grantTokens _dafny.Sequence +} + +func New_AwsKmsEncryptedDataKeyDecryptor_() *AwsKmsEncryptedDataKeyDecryptor { + _this := AwsKmsEncryptedDataKeyDecryptor{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_ struct { +} + +var Companion_AwsKmsEncryptedDataKeyDecryptor_ = CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_{} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) Equals(other *AwsKmsEncryptedDataKeyDecryptor) bool { + return _this == other +} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEncryptedDataKeyDecryptor) + return ok && _this.Equals(other) +} + +func (*AwsKmsEncryptedDataKeyDecryptor) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" +} + +func Type_AwsKmsEncryptedDataKeyDecryptor_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKeyDecryptor_{} +} + +type type_AwsKmsEncryptedDataKeyDecryptor_ struct { +} + +func (_this type_AwsKmsEncryptedDataKeyDecryptor_) Default() interface{} { + return (*AwsKmsEncryptedDataKeyDecryptor)(nil) +} + +func (_this type_AwsKmsEncryptedDataKeyDecryptor_) String() string { + return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &AwsKmsEncryptedDataKeyDecryptor{} +var _ m_Actions.Action = &AwsKmsEncryptedDataKeyDecryptor{} +var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyDecryptor{} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, grantTokens _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._client = client + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Invoke(helper interface{}) interface{} { + { + var helper m_Constants.AwsKmsEdkHelper = helper.(m_Constants.AwsKmsEdkHelper) + _ = helper + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_awsKmsKey _dafny.Sequence + _ = _0_awsKmsKey + _0_awsKmsKey = ((helper).Dtor_arn()).ToString() + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _1_valueOrError0 + _1_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId(((helper).Dtor_arn()).ToString()) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2___v0 _dafny.Tuple + _ = _2___v0 + _2___v0 = (_1_valueOrError0).Extract().(_dafny.Tuple) + var _3_kmsUnwrap *m_AwsKmsKeyring.KmsUnwrapKeyMaterial + _ = _3_kmsUnwrap + var _nw0 *m_AwsKmsKeyring.KmsUnwrapKeyMaterial = m_AwsKmsKeyring.New_KmsUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), _0_awsKmsKey, (_this).GrantTokens()) + _3_kmsUnwrap = _nw0 + var _4_unwrapOutputRes m_Wrappers.Result + _ = _4_unwrapOutputRes + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial(((helper).Dtor_edk()).Dtor_ciphertext(), (_this).Materials(), _3_kmsUnwrap) + _4_unwrapOutputRes = _out0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_AwsKmsKeyring.Companion_KmsUnwrapInfo_.Default())) + _ = _5_valueOrError1 + _5_valueOrError1 = _4_unwrapOutputRes + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _6_unwrapOutput + _6_unwrapOutput = (_5_valueOrError1).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _7_valueOrError2 + _7_valueOrError2 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_6_unwrapOutput).Dtor_plaintextDataKey(), (_6_unwrapOutput).Dtor_symmetricSigningKey()) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _8_result + _8_result = (_7_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_8_result) + return res + return res + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class AwsKmsEncryptedDataKeyDecryptor diff --git a/releases/go/mpl/AwsKmsEcdhKeyring/AwsKmsEcdhKeyring.go b/releases/go/mpl/AwsKmsEcdhKeyring/AwsKmsEcdhKeyring.go new file mode 100644 index 000000000..ce68da97e --- /dev/null +++ b/releases/go/mpl/AwsKmsEcdhKeyring/AwsKmsEcdhKeyring.go @@ -0,0 +1,1185 @@ +// Package AwsKmsEcdhKeyring +// Dafny module AwsKmsEcdhKeyring compiled into Go + +package AwsKmsEcdhKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsEcdhKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DeriveSharedSecret(client m_ComAmazonawsKmsTypes.IKMSClient, senderAwsKmsKey _dafny.Sequence, recipientPublicKey _dafny.Sequence, grantTokens _dafny.Sequence) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_deriveSharedSecretRequest m_ComAmazonawsKmsTypes.DeriveSharedSecretRequest + _ = _0_deriveSharedSecretRequest + _0_deriveSharedSecretRequest = m_ComAmazonawsKmsTypes.Companion_DeriveSharedSecretRequest_.Create_DeriveSharedSecretRequest_(senderAwsKmsKey, m_ComAmazonawsKmsTypes.Companion_KeyAgreementAlgorithmSpec_.Create_ECDH_(), recipientPublicKey, m_Wrappers.Companion_Option_.Create_Some_(grantTokens), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _1_maybeDeriveSharedSecret m_Wrappers.Result + _ = _1_maybeDeriveSharedSecret + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (client).DeriveSharedSecret(_0_deriveSharedSecretRequest) + _1_maybeDeriveSharedSecret = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DeriveSharedSecretResponse_.Default()) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_maybeDeriveSharedSecret).MapFailure(func(coer117 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg118 interface{}) interface{} { + return coer117(arg118.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_3_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_deriveSharedSecretResponse m_ComAmazonawsKmsTypes.DeriveSharedSecretResponse + _ = _4_deriveSharedSecretResponse + _4_deriveSharedSecretResponse = (_2_valueOrError0).Extract().(m_ComAmazonawsKmsTypes.DeriveSharedSecretResponse) + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError1 + _5_valueOrError1 = m_Wrappers.Companion_Default___.Need(((((((_4_deriveSharedSecretResponse).Dtor_KeyId()).Is_Some()) && (((_4_deriveSharedSecretResponse).Dtor_SharedSecret()).Is_Some())) && (((_4_deriveSharedSecretResponse).Dtor_KeyAgreementAlgorithm()).Is_Some())) && (_dafny.Companion_Sequence_.Equal(((_4_deriveSharedSecretResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence), senderAwsKmsKey))) && ((((_4_deriveSharedSecretResponse).Dtor_KeyAgreementAlgorithm()).Dtor_value().(m_ComAmazonawsKmsTypes.KeyAgreementAlgorithmSpec)).Equals(m_ComAmazonawsKmsTypes.Companion_KeyAgreementAlgorithmSpec_.Create_ECDH_())), Companion_Default___.E(_dafny.SeqOfString("Invalid response from KMS DeriveSharedSecret"))) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(((_4_deriveSharedSecretResponse).Dtor_SharedSecret()).Dtor_value().(_dafny.Sequence)) + return res + return res +} +func (_static *CompanionStruct_Default___) E(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} +func (_static *CompanionStruct_Default___) AWS__KMS__ECDH__KEYRING__VERSION() _dafny.Sequence { + return m_RawECDHKeyring.Companion_Default___.RAW__ECDH__KEYRING__VERSION() +} + +// End of class Default__ + +// Definition of class AwsKmsEcdhKeyring +type AwsKmsEcdhKeyring struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations + _curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec + _grantTokens _dafny.Sequence + _recipientPublicKey _dafny.Sequence + _senderPublicKey m_Wrappers.Option + _compressedSenderPublicKey m_Wrappers.Option + _compressedRecipientPublicKey _dafny.Sequence + _senderKmsKeyId m_Wrappers.Option +} + +func New_AwsKmsEcdhKeyring_() *AwsKmsEcdhKeyring { + _this := AwsKmsEcdhKeyring{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_KmsEcdhStaticConfigurations_.Default() + _this._curveSpec = m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default() + _this._grantTokens = _dafny.EmptySeq + _this._recipientPublicKey = _dafny.EmptySeq + _this._senderPublicKey = m_Wrappers.Companion_Option_.Default() + _this._compressedSenderPublicKey = m_Wrappers.Companion_Option_.Default() + _this._compressedRecipientPublicKey = _dafny.EmptySeq + _this._senderKmsKeyId = m_Wrappers.Companion_Option_.Default() + return &_this +} + +type CompanionStruct_AwsKmsEcdhKeyring_ struct { +} + +var Companion_AwsKmsEcdhKeyring_ = CompanionStruct_AwsKmsEcdhKeyring_{} + +func (_this *AwsKmsEcdhKeyring) Equals(other *AwsKmsEcdhKeyring) bool { + return _this == other +} + +func (_this *AwsKmsEcdhKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEcdhKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsEcdhKeyring) String() string { + return "AwsKmsEcdhKeyring.AwsKmsEcdhKeyring" +} + +func Type_AwsKmsEcdhKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsEcdhKeyring_{} +} + +type type_AwsKmsEcdhKeyring_ struct { +} + +func (_this type_AwsKmsEcdhKeyring_) Default() interface{} { + return (*AwsKmsEcdhKeyring)(nil) +} + +func (_this type_AwsKmsEcdhKeyring_) String() string { + return "AwsKmsEcdhKeyring.AwsKmsEcdhKeyring" +} +func (_this *AwsKmsEcdhKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsEcdhKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsEcdhKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsEcdhKeyring{} + +func (_this *AwsKmsEcdhKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out9 m_Wrappers.Result + _ = _out9 + _out9 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out9 +} +func (_this *AwsKmsEcdhKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out9 m_Wrappers.Result + _ = _out9 + _out9 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out9 +} +func (_this *AwsKmsEcdhKeyring) Ctor__(KeyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, client m_ComAmazonawsKmsTypes.IKMSClient, grantTokens _dafny.Sequence, senderKmsKeyId m_Wrappers.Option, senderPublicKey m_Wrappers.Option, recipientPublicKey _dafny.Sequence, compressedSenderPublicKey m_Wrappers.Option, compressedRecipientPublicKey _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyAgreementScheme = KeyAgreementScheme + (_this)._curveSpec = curveSpec + (_this)._client = client + (_this)._grantTokens = grantTokens + (_this)._recipientPublicKey = recipientPublicKey + (_this)._senderPublicKey = senderPublicKey + (_this)._compressedSenderPublicKey = compressedSenderPublicKey + (_this)._compressedRecipientPublicKey = compressedRecipientPublicKey + (_this)._senderKmsKeyId = senderKmsKeyId + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *AwsKmsEcdhKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(!(((_this).KeyAgreementScheme()).Is_KmsPublicKeyDiscovery()), Companion_Default___.E(_dafny.SeqOfString("KmsPublicKeyDiscovery Key Agreement Scheme is forbidden on encrypt."))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(((_this).SenderKmsKeyId()).Is_Some(), Companion_Default___.E(_dafny.SeqOfString("Keyring MUST be configured with a sender KMS Key ID"))) + if (_1_valueOrError1).IsFailure() { + res = (_1_valueOrError1).PropagateFailure() + return res + } + var _2_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError2 + _2_valueOrError2 = m_Wrappers.Companion_Default___.Need(((_this).SenderPublicKey()).Is_Some(), Companion_Default___.E(_dafny.SeqOfString("Keyring MUST be configured with a senderPublicKey"))) + if (_2_valueOrError2).IsFailure() { + res = (_2_valueOrError2).PropagateFailure() + return res + } + var _3_senderKmsKeyId _dafny.Sequence + _ = _3_senderKmsKeyId + _3_senderKmsKeyId = ((_this).SenderKmsKeyId()).Dtor_value().(_dafny.Sequence) + var _4_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _4_materials + _4_materials = (input).Dtor_materials() + var _5_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _5_suite + _5_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _6_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _6_valueOrError3 + _6_valueOrError3 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_6_valueOrError3).IsFailure() { + res = (_6_valueOrError3).PropagateFailure() + return res + } + var _7_stringifiedEncCtx _dafny.Map + _ = _7_stringifiedEncCtx + _7_stringifiedEncCtx = (_6_valueOrError3).Extract().(_dafny.Map) + var _8_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _8_valueOrError4 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.DeriveSharedSecret((_this).Client(), _3_senderKmsKeyId, (_this).RecipientPublicKey(), (_this).GrantTokens()) + _8_valueOrError4 = _out0 + if (_8_valueOrError4).IsFailure() { + res = (_8_valueOrError4).PropagateFailure() + return res + } + var _9_sharedSecret _dafny.Sequence + _ = _9_sharedSecret + _9_sharedSecret = (_8_valueOrError4).Extract().(_dafny.Sequence) + var _10_operationCompressedSenderPublicKey _dafny.Sequence + _ = _10_operationCompressedSenderPublicKey + if ((_this).CompressedSenderPublicKey()).Is_None() { + _10_operationCompressedSenderPublicKey = _dafny.SeqOf() + } else { + _10_operationCompressedSenderPublicKey = ((_this).CompressedSenderPublicKey()).Dtor_value().(_dafny.Sequence) + } + var _11_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _11_valueOrError5 + _11_valueOrError5 = (m_UTF8.Encode(m_RawECDHKeyring.Companion_Default___.CurveSpecTypeToString((_this).CurveSpec()))).MapFailure(func(coer118 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg119 interface{}) interface{} { + return coer118(arg119.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_11_valueOrError5).IsFailure() { + res = (_11_valueOrError5).PropagateFailure() + return res + } + var _12_curveSpecUtf8 _dafny.Sequence + _ = _12_curveSpecUtf8 + _12_curveSpecUtf8 = (_11_valueOrError5).Extract().(_dafny.Sequence) + var _13_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _13_valueOrError6 + _13_valueOrError6 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_13_valueOrError6).IsFailure() { + res = (_13_valueOrError6).PropagateFailure() + return res + } + var _14_canonicalizedEC _dafny.Sequence + _ = _14_canonicalizedEC + _14_canonicalizedEC = (_13_valueOrError6).Extract().(_dafny.Sequence) + var _15_fixedInfo _dafny.Sequence + _ = _15_fixedInfo + _15_fixedInfo = m_EcdhEdkWrapping.Companion_Default___.SerializeFixedInfo(m_Constants.Companion_Default___.ECDH__KDF__UTF8(), _12_curveSpecUtf8, _10_operationCompressedSenderPublicKey, (_this).CompressedRecipientPublicKey(), _14_canonicalizedEC, Companion_Default___.AWS__KMS__ECDH__KEYRING__VERSION()) + var _16_ecdhGenerateAndWrap *m_EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial + _ = _16_ecdhGenerateAndWrap + var _nw0 *m_EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial = m_EcdhEdkWrapping.New_EcdhGenerateAndWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(_9_sharedSecret, _15_fixedInfo, (_this).CryptoPrimitives()) + _16_ecdhGenerateAndWrap = _nw0 + var _17_ecdhWrap *m_EcdhEdkWrapping.EcdhWrapKeyMaterial + _ = _17_ecdhWrap + var _nw1 *m_EcdhEdkWrapping.EcdhWrapKeyMaterial = m_EcdhEdkWrapping.New_EcdhWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__(_9_sharedSecret, _15_fixedInfo, (_this).CryptoPrimitives()) + _17_ecdhWrap = _nw1 + var _18_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(m_EcdhEdkWrapping.Companion_EcdhWrapInfo_.Default())) + _ = _18_valueOrError7 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_4_materials, _17_ecdhWrap, _16_ecdhGenerateAndWrap) + _18_valueOrError7 = _out1 + if (_18_valueOrError7).IsFailure() { + res = (_18_valueOrError7).PropagateFailure() + return res + } + var _19_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _19_wrapOutput + _19_wrapOutput = (_18_valueOrError7).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _20_symmetricSigningKeyList m_Wrappers.Option + _ = _20_symmetricSigningKeyList + if ((_19_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_19_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _21_valueOrError8 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _21_valueOrError8 + _21_valueOrError8 = m_Wrappers.Companion_Default___.Need((m_RawECDHKeyring.Companion_Default___.ValidCompressedPublicKeyLength(_10_operationCompressedSenderPublicKey)) && (m_RawECDHKeyring.Companion_Default___.ValidCompressedPublicKeyLength((_this).CompressedRecipientPublicKey())), Companion_Default___.E(_dafny.SeqOfString("Invalid compressed public key length."))) + if (_21_valueOrError8).IsFailure() { + res = (_21_valueOrError8).PropagateFailure() + return res + } + var _22_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _22_edk + _22_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.KMS__ECDH__PROVIDER__ID(), m_RawECDHKeyring.Companion_Default___.SerializeProviderInfo(_10_operationCompressedSenderPublicKey, (_this).CompressedRecipientPublicKey()), (_19_wrapOutput).Dtor_wrappedMaterial()) + if (_19_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _23_valueOrError9 m_Wrappers.Result = m_Wrappers.Result{} + _ = _23_valueOrError9 + _23_valueOrError9 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_4_materials, (_19_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_22_edk), _20_symmetricSigningKeyList) + if (_23_valueOrError9).IsFailure() { + res = (_23_valueOrError9).PropagateFailure() + return res + } + var _24_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _24_result + _24_result = (_23_valueOrError9).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_24_result)) + return res + } else if (_19_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _25_valueOrError10 m_Wrappers.Result = m_Wrappers.Result{} + _ = _25_valueOrError10 + _25_valueOrError10 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_4_materials, _dafny.SeqOf(_22_edk), _20_symmetricSigningKeyList) + if (_25_valueOrError10).IsFailure() { + res = (_25_valueOrError10).PropagateFailure() + return res + } + var _26_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _26_result + _26_result = (_25_valueOrError10).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_26_result)) + return res + } + return res + } +} +func (_this *AwsKmsEcdhKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), Companion_Default___.E(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_filter *OnDecryptEcdhDataKeyFilter + _ = _3_filter + var _nw0 *OnDecryptEcdhDataKeyFilter = New_OnDecryptEcdhDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).KeyAgreementScheme(), (_this).CompressedRecipientPublicKey(), (_this).CompressedSenderPublicKey()) + _3_filter = _nw0 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_3_filter, (input).Dtor_encryptedDataKeys()) + _4_valueOrError1 = _out0 + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_edksToAttempt _dafny.Sequence + _ = _5_edksToAttempt + _5_edksToAttempt = (_4_valueOrError1).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_5_edksToAttempt).Cardinality())).Sign() == 0 { + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _6_valueOrError2 + _6_valueOrError2 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _7_errorMessage _dafny.Sequence + _ = _7_errorMessage + _7_errorMessage = (_6_valueOrError2).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(Companion_Default___.E(_7_errorMessage)) + return res + } + var _8_decryptClosure m_Actions.ActionWithResult + _ = _8_decryptClosure + var _nw1 *DecryptSingleEncryptedDataKey = New_DecryptSingleEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).CryptoPrimitives(), (_this).CompressedRecipientPublicKey(), (_this).Client(), (_this).GrantTokens(), (_this).KeyAgreementScheme(), (_this).CurveSpec()) + _8_decryptClosure = _nw1 + var _9_outcome m_Wrappers.Result + _ = _9_outcome + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.ReduceToSuccess(_8_decryptClosure, _5_edksToAttempt) + _9_outcome = _out1 + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError3 + _10_valueOrError3 = (_9_outcome).MapFailure(func(coer119 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg120 interface{}) interface{} { + return coer119(arg120.(_dafny.Sequence)) + } + }(func(_11_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_11_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_10_valueOrError3).IsFailure() { + res = (_10_valueOrError3).PropagateFailure() + return res + } + var _12_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _12_SealedDecryptionMaterials + _12_SealedDecryptionMaterials = (_10_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_12_SealedDecryptionMaterials)) + return res + return res + } +} +func (_this *AwsKmsEcdhKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsEcdhKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *AwsKmsEcdhKeyring) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *AwsKmsEcdhKeyring) CurveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + { + return _this._curveSpec + } +} +func (_this *AwsKmsEcdhKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} +func (_this *AwsKmsEcdhKeyring) RecipientPublicKey() _dafny.Sequence { + { + return _this._recipientPublicKey + } +} +func (_this *AwsKmsEcdhKeyring) SenderPublicKey() m_Wrappers.Option { + { + return _this._senderPublicKey + } +} +func (_this *AwsKmsEcdhKeyring) CompressedSenderPublicKey() m_Wrappers.Option { + { + return _this._compressedSenderPublicKey + } +} +func (_this *AwsKmsEcdhKeyring) CompressedRecipientPublicKey() _dafny.Sequence { + { + return _this._compressedRecipientPublicKey + } +} +func (_this *AwsKmsEcdhKeyring) SenderKmsKeyId() m_Wrappers.Option { + { + return _this._senderKmsKeyId + } +} + +// End of class AwsKmsEcdhKeyring + +// Definition of class DecryptSingleEncryptedDataKey +type DecryptSingleEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _recipientPublicKey _dafny.Sequence + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations + _client m_ComAmazonawsKmsTypes.IKMSClient + _curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec + _grantTokens _dafny.Sequence +} + +func New_DecryptSingleEncryptedDataKey_() *DecryptSingleEncryptedDataKey { + _this := DecryptSingleEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._recipientPublicKey = _dafny.EmptySeq + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_KmsEcdhStaticConfigurations_.Default() + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._curveSpec = m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_DecryptSingleEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleEncryptedDataKey_ = CompanionStruct_DecryptSingleEncryptedDataKey_{} + +func (_this *DecryptSingleEncryptedDataKey) Equals(other *DecryptSingleEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleEncryptedDataKey) String() string { + return "AwsKmsEcdhKeyring.DecryptSingleEncryptedDataKey" +} + +func Type_DecryptSingleEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleEncryptedDataKey_{} +} + +type type_DecryptSingleEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleEncryptedDataKey_) String() string { + return "AwsKmsEcdhKeyring.DecryptSingleEncryptedDataKey" +} +func (_this *DecryptSingleEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleEncryptedDataKey{} + +func (_this *DecryptSingleEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, recipientPublicKey _dafny.Sequence, client m_ComAmazonawsKmsTypes.IKMSClient, grantTokens _dafny.Sequence, keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec) { + { + (_this)._materials = materials + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._recipientPublicKey = recipientPublicKey + (_this)._keyAgreementScheme = keyAgreementScheme + (_this)._client = client + (_this)._curveSpec = curveSpec + (_this)._grantTokens = grantTokens + } +} +func (_this *DecryptSingleEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderId()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received invalid EDK provider id for AWS KMS ECDH Keyring"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((_this).Materials()).Dtor_algorithmSuite() + var _2_keyProviderId _dafny.Sequence + _ = _2_keyProviderId + _2_keyProviderId = (edk).Dtor_keyProviderId() + var _3_providerInfo _dafny.Sequence + _ = _3_providerInfo + _3_providerInfo = (edk).Dtor_keyProviderInfo() + var _4_ciphertext _dafny.Sequence + _ = _4_ciphertext + _4_ciphertext = (edk).Dtor_ciphertext() + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + _5_valueOrError1 = m_EdkWrapping.Companion_Default___.GetProviderWrappedMaterial(_4_ciphertext, _1_suite) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_providerWrappedMaterial _dafny.Sequence + _ = _6_providerWrappedMaterial + _6_providerWrappedMaterial = (_5_valueOrError1).Extract().(_dafny.Sequence) + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((_3_providerInfo).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__521__LEN())) <= 0) && (m_RawECDHKeyring.Companion_Default___.ValidProviderInfoLength(_3_providerInfo)), Companion_Default___.E(_dafny.SeqOfString("EDK ProviderInfo longer than expected"))) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_keyringVersion uint8 + _ = _8_keyringVersion + _8_keyringVersion = (_3_providerInfo).Select(0).(uint8) + var _9_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError3 + _9_valueOrError3 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(_dafny.SeqOf(_8_keyringVersion), Companion_Default___.AWS__KMS__ECDH__KEYRING__VERSION()), Companion_Default___.E(_dafny.SeqOfString("Incorrect Keyring version found in provider info."))) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_recipientPublicKeyLength _dafny.Int + _ = _10_recipientPublicKeyLength + _10_recipientPublicKeyLength = _dafny.IntOfUint32(m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((_3_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPL__INDEX()), uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())))) + var _11_recipientPublicKeyLengthIndex _dafny.Int + _ = _11_recipientPublicKeyLengthIndex + _11_recipientPublicKeyLengthIndex = (_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())).Plus(_10_recipientPublicKeyLength) + var _12_senderPublicKeyIndex _dafny.Int + _ = _12_senderPublicKeyIndex + _12_senderPublicKeyIndex = (_11_recipientPublicKeyLengthIndex).Plus(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN()) + var _13_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _13_valueOrError4 + _13_valueOrError4 = m_Wrappers.Companion_Default___.Need(((_11_recipientPublicKeyLengthIndex).Plus(_dafny.IntOfInt64(4))).Cmp(_dafny.IntOfUint32((_3_providerInfo).Cardinality())) < 0, Companion_Default___.E(_dafny.SeqOfString("Key Provider Info Serialization Error. Serialized length less than expected."))) + if (_13_valueOrError4).IsFailure() { + res = (_13_valueOrError4).PropagateFailure() + return res + } + var _14_providerInfoRecipientPublicKey _dafny.Sequence + _ = _14_providerInfoRecipientPublicKey + _14_providerInfoRecipientPublicKey = (_3_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX()), (_11_recipientPublicKeyLengthIndex).Uint32()) + var _15_providerInfoSenderPublicKey _dafny.Sequence + _ = _15_providerInfoSenderPublicKey + _15_providerInfoSenderPublicKey = (_3_providerInfo).Drop((_12_senderPublicKeyIndex).Uint32()) + var _16_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _16_valueOrError5 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_RawECDHKeyring.Companion_Default___.DecompressPublicKey(_15_providerInfoSenderPublicKey, (_this).CurveSpec(), (_this).CryptoPrimitives()) + _16_valueOrError5 = _out0 + if (_16_valueOrError5).IsFailure() { + res = (_16_valueOrError5).PropagateFailure() + return res + } + var _17_senderPublicKey _dafny.Sequence + _ = _17_senderPublicKey + _17_senderPublicKey = (_16_valueOrError5).Extract().(_dafny.Sequence) + var _18_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _18_valueOrError6 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_RawECDHKeyring.Companion_Default___.DecompressPublicKey(_14_providerInfoRecipientPublicKey, (_this).CurveSpec(), (_this).CryptoPrimitives()) + _18_valueOrError6 = _out1 + if (_18_valueOrError6).IsFailure() { + res = (_18_valueOrError6).PropagateFailure() + return res + } + var _19_recipientPublicKey _dafny.Sequence + _ = _19_recipientPublicKey + _19_recipientPublicKey = (_18_valueOrError6).Extract().(_dafny.Sequence) + var _20_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _20_valueOrError7 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((_this).CryptoPrimitives(), (_this).CurveSpec(), _17_senderPublicKey) + _20_valueOrError7 = _out2 + if (_20_valueOrError7).IsFailure() { + res = (_20_valueOrError7).PropagateFailure() + return res + } + var _21___v0 bool + _ = _21___v0 + _21___v0 = (_20_valueOrError7).Extract().(bool) + var _22_valueOrError8 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _22_valueOrError8 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_RawECDHKeyring.Companion_Default___.ValidatePublicKey((_this).CryptoPrimitives(), (_this).CurveSpec(), _19_recipientPublicKey) + _22_valueOrError8 = _out3 + if (_22_valueOrError8).IsFailure() { + res = (_22_valueOrError8).PropagateFailure() + return res + } + var _23___v1 bool + _ = _23___v1 + _23___v1 = (_22_valueOrError8).Extract().(bool) + var _24_valueOrError9 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _24_valueOrError9 + _24_valueOrError9 = m_Wrappers.Companion_Default___.Need((m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PublicKeyType(_17_senderPublicKey)) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PublicKeyType((_this).RecipientPublicKey())), Companion_Default___.E(_dafny.SeqOfString("Received serialized sender public key of incorrect length"))) + if (_24_valueOrError9).IsFailure() { + res = (_24_valueOrError9).PropagateFailure() + return res + } + var _25_sharedSecretPublicKey _dafny.Sequence = _dafny.EmptySeq + _ = _25_sharedSecretPublicKey + var _26_sharedSecretKmsKeyId _dafny.Sequence = _dafny.EmptySeq.SetString() + _ = _26_sharedSecretKmsKeyId + var _source0 m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations = (_this).KeyAgreementScheme() + _ = _source0 + { + { + if _source0.Is_KmsPublicKeyDiscovery() { + var _27_kmsPublicKeyDiscovery m_AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery).KmsPublicKeyDiscovery + _ = _27_kmsPublicKeyDiscovery + { + var _28_valueOrError10 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _28_valueOrError10 + _28_valueOrError10 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((_27_kmsPublicKeyDiscovery).Dtor_recipientKmsIdentifier()) + if (_28_valueOrError10).IsFailure() { + res = (_28_valueOrError10).PropagateFailure() + return res + } + var _29___v2 _dafny.Tuple + _ = _29___v2 + _29___v2 = (_28_valueOrError10).Extract().(_dafny.Tuple) + _25_sharedSecretPublicKey = _17_senderPublicKey + _26_sharedSecretKmsKeyId = (_27_kmsPublicKeyDiscovery).Dtor_recipientKmsIdentifier() + } + goto Lmatch0 + } + } + { + var _30_kmsPrivateKeyToStaticPublicKey m_AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey).KmsPrivateKeyToStaticPublicKey + _ = _30_kmsPrivateKeyToStaticPublicKey + { + var _31_valueOrError11 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _31_valueOrError11 + _31_valueOrError11 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId((_30_kmsPrivateKeyToStaticPublicKey).Dtor_senderKmsIdentifier()) + if (_31_valueOrError11).IsFailure() { + res = (_31_valueOrError11).PropagateFailure() + return res + } + var _32___v3 _dafny.Tuple + _ = _32___v3 + _32___v3 = (_31_valueOrError11).Extract().(_dafny.Tuple) + _26_sharedSecretKmsKeyId = (_30_kmsPrivateKeyToStaticPublicKey).Dtor_senderKmsIdentifier() + if _dafny.Companion_Sequence_.Equal((_30_kmsPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey(), _19_recipientPublicKey) { + _25_sharedSecretPublicKey = _19_recipientPublicKey + } else { + _25_sharedSecretPublicKey = _17_senderPublicKey + } + } + } + goto Lmatch0 + } + Lmatch0: + var _33_valueOrError12 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _33_valueOrError12 + _33_valueOrError12 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PublicKeyType(_25_sharedSecretPublicKey), Companion_Default___.E(_dafny.SeqOfString("Received Recipient Public Key of incorrect expected length"))) + if (_33_valueOrError12).IsFailure() { + res = (_33_valueOrError12).PropagateFailure() + return res + } + var _34_valueOrError13 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _34_valueOrError13 + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = Companion_Default___.DeriveSharedSecret((_this).Client(), _26_sharedSecretKmsKeyId, _25_sharedSecretPublicKey, (_this).GrantTokens()) + _34_valueOrError13 = _out4 + if (_34_valueOrError13).IsFailure() { + res = (_34_valueOrError13).PropagateFailure() + return res + } + var _35_sharedSecret _dafny.Sequence + _ = _35_sharedSecret + _35_sharedSecret = (_34_valueOrError13).Extract().(_dafny.Sequence) + var _36_ecdhUnwrap *m_EcdhEdkWrapping.EcdhUnwrap + _ = _36_ecdhUnwrap + var _nw0 *m_EcdhEdkWrapping.EcdhUnwrap = m_EcdhEdkWrapping.New_EcdhUnwrap_() + _ = _nw0 + _nw0.Ctor__(_15_providerInfoSenderPublicKey, _14_providerInfoRecipientPublicKey, _35_sharedSecret, Companion_Default___.AWS__KMS__ECDH__KEYRING__VERSION(), (_this).CurveSpec(), (_this).CryptoPrimitives()) + _36_ecdhUnwrap = _nw0 + var _37_unwrapOutputRes m_Wrappers.Result + _ = _37_unwrapOutputRes + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _36_ecdhUnwrap) + _37_unwrapOutputRes = _out5 + var _38_valueOrError14 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_EcdhEdkWrapping.Companion_EcdhUnwrapInfo_.Default())) + _ = _38_valueOrError14 + _38_valueOrError14 = _37_unwrapOutputRes + if (_38_valueOrError14).IsFailure() { + res = (_38_valueOrError14).PropagateFailure() + return res + } + var _39_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _39_unwrapOutput + _39_unwrapOutput = (_38_valueOrError14).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _40_valueOrError15 m_Wrappers.Result = m_Wrappers.Result{} + _ = _40_valueOrError15 + _40_valueOrError15 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_39_unwrapOutput).Dtor_plaintextDataKey(), (_39_unwrapOutput).Dtor_symmetricSigningKey()) + if (_40_valueOrError15).IsFailure() { + res = (_40_valueOrError15).PropagateFailure() + return res + } + var _41_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _41_result + _41_result = (_40_valueOrError15).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_41_result) + return res + return res + } +} +func (_this *DecryptSingleEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleEncryptedDataKey) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *DecryptSingleEncryptedDataKey) RecipientPublicKey() _dafny.Sequence { + { + return _this._recipientPublicKey + } +} +func (_this *DecryptSingleEncryptedDataKey) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *DecryptSingleEncryptedDataKey) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *DecryptSingleEncryptedDataKey) CurveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + { + return _this._curveSpec + } +} +func (_this *DecryptSingleEncryptedDataKey) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class DecryptSingleEncryptedDataKey + +// Definition of class OnDecryptEcdhDataKeyFilter +type OnDecryptEcdhDataKeyFilter struct { + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations + _compressedRecipientPublicKey _dafny.Sequence + _compressedSenderPublicKey _dafny.Sequence +} + +func New_OnDecryptEcdhDataKeyFilter_() *OnDecryptEcdhDataKeyFilter { + _this := OnDecryptEcdhDataKeyFilter{} + + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_KmsEcdhStaticConfigurations_.Default() + _this._compressedRecipientPublicKey = _dafny.EmptySeq + _this._compressedSenderPublicKey = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_OnDecryptEcdhDataKeyFilter_ struct { +} + +var Companion_OnDecryptEcdhDataKeyFilter_ = CompanionStruct_OnDecryptEcdhDataKeyFilter_{} + +func (_this *OnDecryptEcdhDataKeyFilter) Equals(other *OnDecryptEcdhDataKeyFilter) bool { + return _this == other +} + +func (_this *OnDecryptEcdhDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OnDecryptEcdhDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*OnDecryptEcdhDataKeyFilter) String() string { + return "AwsKmsEcdhKeyring.OnDecryptEcdhDataKeyFilter" +} + +func Type_OnDecryptEcdhDataKeyFilter_() _dafny.TypeDescriptor { + return type_OnDecryptEcdhDataKeyFilter_{} +} + +type type_OnDecryptEcdhDataKeyFilter_ struct { +} + +func (_this type_OnDecryptEcdhDataKeyFilter_) Default() interface{} { + return (*OnDecryptEcdhDataKeyFilter)(nil) +} + +func (_this type_OnDecryptEcdhDataKeyFilter_) String() string { + return "AwsKmsEcdhKeyring.OnDecryptEcdhDataKeyFilter" +} +func (_this *OnDecryptEcdhDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &OnDecryptEcdhDataKeyFilter{} +var _ m_Actions.DeterministicAction = &OnDecryptEcdhDataKeyFilter{} +var _ _dafny.TraitOffspring = &OnDecryptEcdhDataKeyFilter{} + +func (_this *OnDecryptEcdhDataKeyFilter) Ctor__(keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations, compressedRecipientPublicKey _dafny.Sequence, compressedSenderPublicKey m_Wrappers.Option) { + { + (_this)._keyAgreementScheme = keyAgreementScheme + (_this)._compressedRecipientPublicKey = compressedRecipientPublicKey + if (compressedSenderPublicKey).Is_Some() { + (_this)._compressedSenderPublicKey = (compressedSenderPublicKey).Dtor_value().(_dafny.Sequence) + } else { + (_this)._compressedSenderPublicKey = _dafny.SeqOf() + } + } +} +func (_this *OnDecryptEcdhDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + var _0_providerInfo _dafny.Sequence + _ = _0_providerInfo + _0_providerInfo = (edk).Dtor_keyProviderInfo() + var _1_providerId _dafny.Sequence + _ = _1_providerId + _1_providerId = (edk).Dtor_keyProviderId() + if (!_dafny.Companion_Sequence_.Equal(_1_providerId, m_Constants.Companion_Default___.RAW__ECDH__PROVIDER__ID())) && (!_dafny.Companion_Sequence_.Equal(_1_providerId, m_Constants.Companion_Default___.KMS__ECDH__PROVIDER__ID())) { + res = m_Wrappers.Companion_Result_.Create_Success_(false) + return res + } + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((_0_providerInfo).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__521__LEN())) <= 0) && (m_RawECDHKeyring.Companion_Default___.ValidProviderInfoLength(_0_providerInfo)), Companion_Default___.E(_dafny.SeqOfString("EDK ProviderInfo longer than expected"))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_keyringVersion uint8 + _ = _3_keyringVersion + _3_keyringVersion = (_0_providerInfo).Select(0).(uint8) + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError1 + _4_valueOrError1 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(_dafny.SeqOf(_3_keyringVersion), Companion_Default___.AWS__KMS__ECDH__KEYRING__VERSION()), Companion_Default___.E(_dafny.SeqOfString("Incorrect Keyring version found in provider info."))) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_recipientPublicKeyLength _dafny.Int + _ = _5_recipientPublicKeyLength + _5_recipientPublicKeyLength = _dafny.IntOfUint32(m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((_0_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPL__INDEX()), uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())))) + var _6_recipientPublicKeyLengthIndex _dafny.Int + _ = _6_recipientPublicKeyLengthIndex + _6_recipientPublicKeyLengthIndex = (_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())).Plus(_5_recipientPublicKeyLength) + var _7_senderPublicKeyIndex _dafny.Int + _ = _7_senderPublicKeyIndex + _7_senderPublicKeyIndex = (_6_recipientPublicKeyLengthIndex).Plus(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN()) + var _8_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError2 + _8_valueOrError2 = m_Wrappers.Companion_Default___.Need(((_6_recipientPublicKeyLengthIndex).Plus(_dafny.IntOfInt64(4))).Cmp(_dafny.IntOfUint32((_0_providerInfo).Cardinality())) < 0, Companion_Default___.E(_dafny.SeqOfString("Key Provider Info Serialization Error. Serialized length less than expected."))) + if (_8_valueOrError2).IsFailure() { + res = (_8_valueOrError2).PropagateFailure() + return res + } + var _9_providerInfoRecipientPublicKey _dafny.Sequence + _ = _9_providerInfoRecipientPublicKey + _9_providerInfoRecipientPublicKey = (_0_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX()), (_6_recipientPublicKeyLengthIndex).Uint32()) + var _10_providerInfoSenderPublicKey _dafny.Sequence + _ = _10_providerInfoSenderPublicKey + _10_providerInfoSenderPublicKey = (_0_providerInfo).Drop((_7_senderPublicKeyIndex).Uint32()) + if ((_this).KeyAgreementScheme()).Is_KmsPublicKeyDiscovery() { + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _9_providerInfoRecipientPublicKey)) + return res + } else { + res = m_Wrappers.Companion_Result_.Create_Success_(((_dafny.Companion_Sequence_.Equal((_this).CompressedSenderPublicKey(), _10_providerInfoSenderPublicKey)) && (_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _9_providerInfoRecipientPublicKey))) || ((_dafny.Companion_Sequence_.Equal((_this).CompressedSenderPublicKey(), _9_providerInfoRecipientPublicKey)) && (_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _10_providerInfoSenderPublicKey)))) + return res + } + return res + } +} +func (_this *OnDecryptEcdhDataKeyFilter) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *OnDecryptEcdhDataKeyFilter) CompressedRecipientPublicKey() _dafny.Sequence { + { + return _this._compressedRecipientPublicKey + } +} +func (_this *OnDecryptEcdhDataKeyFilter) CompressedSenderPublicKey() _dafny.Sequence { + { + return _this._compressedSenderPublicKey + } +} + +// End of class OnDecryptEcdhDataKeyFilter diff --git a/releases/go/mpl/AwsKmsHierarchicalKeyring/AwsKmsHierarchicalKeyring.go b/releases/go/mpl/AwsKmsHierarchicalKeyring/AwsKmsHierarchicalKeyring.go new file mode 100644 index 000000000..5492fc6de --- /dev/null +++ b/releases/go/mpl/AwsKmsHierarchicalKeyring/AwsKmsHierarchicalKeyring.go @@ -0,0 +1,2230 @@ +// Package AwsKmsHierarchicalKeyring +// Dafny module AwsKmsHierarchicalKeyring compiled into Go + +package AwsKmsHierarchicalKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m__Time "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Time_" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UUID "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UUID" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsHierarchicalKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) CacheEntryWithinLimits(creationTime int64, now int64, ttlSeconds int64) bool { + return ((now) - (creationTime)) <= (ttlSeconds) +} +func (_static *CompanionStruct_Default___) DeriveEncryptionKeyFromBranchKey(branchKey _dafny.Sequence, salt _dafny.Sequence, purpose m_Wrappers.Option, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = output + var _0_maybeDerivedBranchKey m_Wrappers.Result + _ = _0_maybeDerivedBranchKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (cryptoPrimitives).KdfCounterMode(m_AwsCryptographyPrimitivesTypes.Companion_KdfCtrInput_.Create_KdfCtrInput_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__256_(), branchKey, Companion_Default___.DERIVED__BRANCH__KEY__EXPECTED__LENGTH(), purpose, m_Wrappers.Companion_Option_.Create_Some_(salt))) + _0_maybeDerivedBranchKey = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeDerivedBranchKey).MapFailure(func(coer75 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg76 interface{}) interface{} { + return coer75(arg76.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _3_derivedBranchKey _dafny.Sequence + _ = _3_derivedBranchKey + _3_derivedBranchKey = (_1_valueOrError0).Extract().(_dafny.Sequence) + output = m_Wrappers.Companion_Result_.Create_Success_(_3_derivedBranchKey) + return output +} +func (_static *CompanionStruct_Default___) WrappingAad(branchKeyId _dafny.Sequence, branchKeyVersion _dafny.Sequence, aad _dafny.Sequence) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(m_Constants.Companion_Default___.PROVIDER__ID__HIERARCHY(), branchKeyId), branchKeyVersion), aad) +} +func (_static *CompanionStruct_Default___) SerializeEDKCiphertext(encOutput m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate((encOutput).Dtor_cipherText(), (encOutput).Dtor_authTag()) +} +func (_static *CompanionStruct_Default___) E(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} +func (_static *CompanionStruct_Default___) AES__256__ENC__KEY__LENGTH() int32 { + return int32(32) +} +func (_static *CompanionStruct_Default___) AES__256__ENC__TAG__LENGTH() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) AES__256__ENC__IV__LENGTH() int32 { + return int32(12) +} +func (_static *CompanionStruct_Default___) AES__256__ENC__ALG() m_AwsCryptographyPrimitivesTypes.AES__GCM { + return m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(Companion_Default___.AES__256__ENC__KEY__LENGTH(), Companion_Default___.AES__256__ENC__TAG__LENGTH(), Companion_Default___.AES__256__ENC__IV__LENGTH()) +} +func (_static *CompanionStruct_Default___) H__WRAP__SALT__LEN() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) H__WRAP__NONCE__LEN() int32 { + return int32(12) +} +func (_static *CompanionStruct_Default___) EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX() int32 { + return (Companion_Default___.H__WRAP__SALT__LEN()) + (Companion_Default___.H__WRAP__NONCE__LEN()) +} +func (_static *CompanionStruct_Default___) EDK__CIPHERTEXT__VERSION__LENGTH() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) EDK__CIPHERTEXT__VERSION__INDEX() int32 { + return (Companion_Default___.EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX()) + (Companion_Default___.EDK__CIPHERTEXT__VERSION__LENGTH()) +} +func (_static *CompanionStruct_Default___) EXPECTED__EDK__CIPHERTEXT__OVERHEAD() int32 { + return (Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX()) + (Companion_Default___.AES__256__ENC__TAG__LENGTH()) +} +func (_static *CompanionStruct_Default___) DERIVED__BRANCH__KEY__EXPECTED__LENGTH() int32 { + return int32(32) +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__STORE__GSI() _dafny.Sequence { + return _dafny.SeqOfString("Active-Keys") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("enc") +} +func (_static *CompanionStruct_Default___) VERSION__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("version") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__IDENTIFIER__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("branch-key-id") +} +func (_static *CompanionStruct_Default___) KEY__CONDITION__EXPRESSION() _dafny.Sequence { + return _dafny.SeqOfString("#status = :status and #branch_key_id = :branch_key_id") +} +func (_static *CompanionStruct_Default___) EXPRESSION__ATTRIBUTE__NAMES() _dafny.Map { + return _dafny.NewMapBuilder().ToMap().UpdateUnsafe(_dafny.SeqOfString("#status"), _dafny.SeqOfString("status")).UpdateUnsafe(_dafny.SeqOfString("#branch_key_id"), _dafny.SeqOfString("branch-key-id")) +} +func (_static *CompanionStruct_Default___) EXPRESSION__ATTRIBUTE__VALUE__STATUS__KEY() _dafny.Sequence { + return _dafny.SeqOfString(":status") +} +func (_static *CompanionStruct_Default___) EXPRESSION__ATTRIBUTE__VALUE__STATUS__VALUE() _dafny.Sequence { + return _dafny.SeqOfString("ACTIVE") +} +func (_static *CompanionStruct_Default___) EXPRESSION__ATTRIBUTE__VALUE__BRANCH__KEY() _dafny.Sequence { + return _dafny.SeqOfString(":branch_key_id") +} + +// End of class Default__ + +// Definition of class AwsKmsHierarchicalKeyring +type AwsKmsHierarchicalKeyring struct { + _keyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _cache m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache + _branchKeyIdSupplier m_Wrappers.Option + _branchKeyId m_Wrappers.Option + _ttlSeconds int64 + _partitionIdBytes _dafny.Sequence + _logicalKeyStoreNameBytes _dafny.Sequence +} + +func New_AwsKmsHierarchicalKeyring_() *AwsKmsHierarchicalKeyring { + _this := AwsKmsHierarchicalKeyring{} + + _this._keyStore = (m_AwsCryptographyKeyStoreTypes.IKeyStoreClient)(nil) + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._cache = (m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache)(nil) + _this._branchKeyIdSupplier = m_Wrappers.Companion_Option_.Default() + _this._branchKeyId = m_Wrappers.Companion_Option_.Default() + _this._ttlSeconds = int64(0) + _this._partitionIdBytes = _dafny.EmptySeq + _this._logicalKeyStoreNameBytes = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsHierarchicalKeyring_ struct { +} + +var Companion_AwsKmsHierarchicalKeyring_ = CompanionStruct_AwsKmsHierarchicalKeyring_{} + +func (_this *AwsKmsHierarchicalKeyring) Equals(other *AwsKmsHierarchicalKeyring) bool { + return _this == other +} + +func (_this *AwsKmsHierarchicalKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsHierarchicalKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsHierarchicalKeyring) String() string { + return "AwsKmsHierarchicalKeyring.AwsKmsHierarchicalKeyring" +} + +func Type_AwsKmsHierarchicalKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsHierarchicalKeyring_{} +} + +type type_AwsKmsHierarchicalKeyring_ struct { +} + +func (_this type_AwsKmsHierarchicalKeyring_) Default() interface{} { + return (*AwsKmsHierarchicalKeyring)(nil) +} + +func (_this type_AwsKmsHierarchicalKeyring_) String() string { + return "AwsKmsHierarchicalKeyring.AwsKmsHierarchicalKeyring" +} +func (_this *AwsKmsHierarchicalKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsHierarchicalKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsHierarchicalKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsHierarchicalKeyring{} + +func (_this *AwsKmsHierarchicalKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out6 m_Wrappers.Result + _ = _out6 + _out6 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out6 +} +func (_this *AwsKmsHierarchicalKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out6 m_Wrappers.Result + _ = _out6 + _out6 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out6 +} +func (_this *AwsKmsHierarchicalKeyring) Ctor__(keyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient, branchKeyId m_Wrappers.Option, branchKeyIdSupplier m_Wrappers.Option, ttlSeconds int64, cmc m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache, partitionIdBytes _dafny.Sequence, logicalKeyStoreNameBytes _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyStore = keyStore + (_this)._branchKeyId = branchKeyId + (_this)._branchKeyIdSupplier = branchKeyIdSupplier + (_this)._ttlSeconds = ttlSeconds + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._cache = cmc + (_this)._partitionIdBytes = partitionIdBytes + (_this)._logicalKeyStoreNameBytes = logicalKeyStoreNameBytes + } +} +func (_this *AwsKmsHierarchicalKeyring) GetBranchKeyId(context _dafny.Map) m_Wrappers.Result { + { + var ret m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = ret + if ((_this).BranchKeyId()).Is_Some() { + ret = m_Wrappers.Companion_Result_.Create_Success_(((_this).BranchKeyId()).Dtor_value().(_dafny.Sequence)) + return ret + } else { + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyMaterialProvidersTypes.Companion_GetBranchKeyIdOutput_.Default()) + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (m_AwsCryptographyMaterialProvidersTypes.Companion_IBranchKeyIdSupplier_.CastTo_(((_this).BranchKeyIdSupplier()).Dtor_value())).GetBranchKeyId(m_AwsCryptographyMaterialProvidersTypes.Companion_GetBranchKeyIdInput_.Create_GetBranchKeyIdInput_(context)) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + ret = (_0_valueOrError0).PropagateFailure() + return ret + } + var _1_GetBranchKeyIdOut m_AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput + _ = _1_GetBranchKeyIdOut + _1_GetBranchKeyIdOut = (_0_valueOrError0).Extract().(m_AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_((_1_GetBranchKeyIdOut).Dtor_branchKeyId()) + return ret + } + return ret + } +} +func (_this *AwsKmsHierarchicalKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = (_0_materials).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _2_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetBranchKeyId((_0_materials).Dtor_encryptionContext()) + _2_valueOrError0 = _out0 + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_branchKeyIdForEncrypt _dafny.Sequence + _ = _3_branchKeyIdForEncrypt + _3_branchKeyIdForEncrypt = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _4_valueOrError1 + _4_valueOrError1 = (m_UTF8.Encode(_3_branchKeyIdForEncrypt)).MapFailure(func(coer76 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg77 interface{}) interface{} { + return coer76(arg77.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_branchKeyIdUtf8 _dafny.Sequence + _ = _5_branchKeyIdUtf8 + _5_branchKeyIdUtf8 = (_4_valueOrError1).Extract().(_dafny.Sequence) + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _6_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).GetActiveCacheId(_3_branchKeyIdForEncrypt, _5_branchKeyIdUtf8, (_this).CryptoPrimitives()) + _6_valueOrError2 = _out1 + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _7_cacheId _dafny.Sequence + _ = _7_cacheId + _7_cacheId = (_6_valueOrError2).Extract().(_dafny.Sequence) + var _8_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = _8_valueOrError3 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = (_this).GetActiveHierarchicalMaterials(_3_branchKeyIdForEncrypt, _7_cacheId, (_this).KeyStore()) + _8_valueOrError3 = _out2 + if (_8_valueOrError3).IsFailure() { + res = (_8_valueOrError3).PropagateFailure() + return res + } + var _9_hierarchicalMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _9_hierarchicalMaterials + _9_hierarchicalMaterials = (_8_valueOrError3).Extract().(m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials) + var _10_branchKey _dafny.Sequence + _ = _10_branchKey + _10_branchKey = (_9_hierarchicalMaterials).Dtor_branchKey() + var _11_branchKeyVersion _dafny.Sequence + _ = _11_branchKeyVersion + _11_branchKeyVersion = (_9_hierarchicalMaterials).Dtor_branchKeyVersion() + var _12_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _12_valueOrError4 + _12_valueOrError4 = (m_UTF8.Decode(_11_branchKeyVersion)).MapFailure(func(coer77 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg78 interface{}) interface{} { + return coer77(arg78.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_12_valueOrError4).IsFailure() { + res = (_12_valueOrError4).PropagateFailure() + return res + } + var _13_branchKeyVersionAsString _dafny.Sequence + _ = _13_branchKeyVersionAsString + _13_branchKeyVersionAsString = (_12_valueOrError4).Extract().(_dafny.Sequence) + var _14_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _14_valueOrError5 + _14_valueOrError5 = (m_UUID.ToByteArray(_13_branchKeyVersionAsString)).MapFailure(func(coer78 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg79 interface{}) interface{} { + return coer78(arg79.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_14_valueOrError5).IsFailure() { + res = (_14_valueOrError5).PropagateFailure() + return res + } + var _15_branchKeyVersionAsBytes _dafny.Sequence + _ = _15_branchKeyVersionAsBytes + _15_branchKeyVersionAsBytes = (_14_valueOrError5).Extract().(_dafny.Sequence) + var _16_kmsHierarchyGenerateAndWrap *KmsHierarchyGenerateAndWrapKeyMaterial + _ = _16_kmsHierarchyGenerateAndWrap + var _nw0 *KmsHierarchyGenerateAndWrapKeyMaterial = New_KmsHierarchyGenerateAndWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_9_hierarchicalMaterials).Dtor_branchKey(), _5_branchKeyIdUtf8, _15_branchKeyVersionAsBytes, (_this).CryptoPrimitives()) + _16_kmsHierarchyGenerateAndWrap = _nw0 + var _17_kmsHierarchyWrap *KmsHierarchyWrapKeyMaterial + _ = _17_kmsHierarchyWrap + var _nw1 *KmsHierarchyWrapKeyMaterial = New_KmsHierarchyWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__((_9_hierarchicalMaterials).Dtor_branchKey(), _5_branchKeyIdUtf8, _15_branchKeyVersionAsBytes, (_this).CryptoPrimitives()) + _17_kmsHierarchyWrap = _nw1 + var _18_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_HierarchyWrapInfo_.Default())) + _ = _18_valueOrError6 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_0_materials, _17_kmsHierarchyWrap, _16_kmsHierarchyGenerateAndWrap) + _18_valueOrError6 = _out3 + if (_18_valueOrError6).IsFailure() { + res = (_18_valueOrError6).PropagateFailure() + return res + } + var _19_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _19_wrapOutput + _19_wrapOutput = (_18_valueOrError6).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _20_symmetricSigningKeyList m_Wrappers.Option + _ = _20_symmetricSigningKeyList + if ((_19_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_19_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _21_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _21_edk + _21_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.PROVIDER__ID__HIERARCHY(), _5_branchKeyIdUtf8, (_19_wrapOutput).Dtor_wrappedMaterial()) + if (_19_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _22_valueOrError7 m_Wrappers.Result = m_Wrappers.Result{} + _ = _22_valueOrError7 + _22_valueOrError7 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_0_materials, (_19_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_21_edk), _20_symmetricSigningKeyList) + if (_22_valueOrError7).IsFailure() { + res = (_22_valueOrError7).PropagateFailure() + return res + } + var _23_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _23_result + _23_result = (_22_valueOrError7).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_23_result)) + return res + } else if (_19_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _24_valueOrError8 m_Wrappers.Result = m_Wrappers.Result{} + _ = _24_valueOrError8 + _24_valueOrError8 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_0_materials, _dafny.SeqOf(_21_edk), _20_symmetricSigningKeyList) + if (_24_valueOrError8).IsFailure() { + res = (_24_valueOrError8).PropagateFailure() + return res + } + var _25_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _25_result + _25_result = (_24_valueOrError8).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_25_result)) + return res + } + return res + } +} +func (_this *AwsKmsHierarchicalKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), Companion_Default___.E(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _3_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetBranchKeyId((_0_materials).Dtor_encryptionContext()) + _3_valueOrError1 = _out0 + if (_3_valueOrError1).IsFailure() { + res = (_3_valueOrError1).PropagateFailure() + return res + } + var _4_branchKeyIdForDecrypt _dafny.Sequence + _ = _4_branchKeyIdForDecrypt + _4_branchKeyIdForDecrypt = (_3_valueOrError1).Extract().(_dafny.Sequence) + var _5_filter *OnDecryptHierarchyEncryptedDataKeyFilter + _ = _5_filter + var _nw0 *OnDecryptHierarchyEncryptedDataKeyFilter = New_OnDecryptHierarchyEncryptedDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__(_4_branchKeyIdForDecrypt) + _5_filter = _nw0 + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _6_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.FilterWithResult(_5_filter, (input).Dtor_encryptedDataKeys()) + _6_valueOrError2 = _out1 + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _7_edksToAttempt _dafny.Sequence + _ = _7_edksToAttempt + _7_edksToAttempt = (_6_valueOrError2).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_7_edksToAttempt).Cardinality())).Sign() == 0 { + var _8_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _8_valueOrError3 + _8_valueOrError3 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_8_valueOrError3).IsFailure() { + res = (_8_valueOrError3).PropagateFailure() + return res + } + var _9_errorMessage _dafny.Sequence + _ = _9_errorMessage + _9_errorMessage = (_8_valueOrError3).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_9_errorMessage)) + return res + } + var _10_decryptClosure m_Actions.ActionWithResult + _ = _10_decryptClosure + var _nw1 *DecryptSingleEncryptedDataKey = New_DecryptSingleEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).KeyStore(), (_this).CryptoPrimitives(), _4_branchKeyIdForDecrypt, (_this).TtlSeconds(), (_this).Cache(), (_this).PartitionIdBytes(), (_this).LogicalKeyStoreNameBytes()) + _10_decryptClosure = _nw1 + var _11_outcome m_Wrappers.Result + _ = _11_outcome + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_Actions.Companion_Default___.ReduceToSuccess(_10_decryptClosure, _7_edksToAttempt) + _11_outcome = _out2 + var _12_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _12_valueOrError4 + _12_valueOrError4 = (_11_outcome).MapFailure(func(coer79 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg80 interface{}) interface{} { + return coer79(arg80.(_dafny.Sequence)) + } + }(func(_13_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_13_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_12_valueOrError4).IsFailure() { + res = (_12_valueOrError4).PropagateFailure() + return res + } + var _14_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _14_SealedDecryptionMaterials + _14_SealedDecryptionMaterials = (_12_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_14_SealedDecryptionMaterials)) + return res + return res + } +} +func (_this *AwsKmsHierarchicalKeyring) GetActiveCacheId(branchKeyId _dafny.Sequence, branchKeyIdUtf8 _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + { + var cacheId m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = cacheId + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((m_UTF8.Decode(branchKeyIdUtf8)).MapFailure(func(coer80 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg81 interface{}) interface{} { + return coer80(arg81.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError))).Is_Success()) && (func(_pat_let6_0 _dafny.Sequence) bool { + return func(_1_branchKeyId _dafny.Sequence) bool { + return (true) && (((_dafny.IntOfUint32((_1_branchKeyId).Cardinality())).Sign() != -1) && ((_dafny.IntOfUint32((_1_branchKeyId).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT32__LIMIT()) < 0)) + }(_pat_let6_0) + }(((m_UTF8.Decode(branchKeyIdUtf8)).MapFailure(func(coer81 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg82 interface{}) interface{} { + return coer81(arg82.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError))).Dtor_value().(_dafny.Sequence))), Companion_Default___.E(_dafny.SeqOfString("Invalid Branch Key ID Length"))) + if (_0_valueOrError0).IsFailure() { + cacheId = (_0_valueOrError0).PropagateFailure() + return cacheId + } + var _2_hashAlgorithm m_AwsCryptographyPrimitivesTypes.DigestAlgorithm + _ = _2_hashAlgorithm + _2_hashAlgorithm = m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_() + var _3_resourceId _dafny.Sequence + _ = _3_resourceId + _3_resourceId = m_CacheConstants.Companion_Default___.RESOURCE__ID__HIERARCHICAL__KEYRING() + var _4_scopeId _dafny.Sequence + _ = _4_scopeId + _4_scopeId = m_CacheConstants.Companion_Default___.SCOPE__ID__ENCRYPT() + var _5_suffix _dafny.Sequence + _ = _5_suffix + _5_suffix = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_this).LogicalKeyStoreNameBytes(), m_CacheConstants.Companion_Default___.NULL__BYTE()), branchKeyIdUtf8) + var _6_identifier _dafny.Sequence + _ = _6_identifier + _6_identifier = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_3_resourceId, m_CacheConstants.Companion_Default___.NULL__BYTE()), _4_scopeId), m_CacheConstants.Companion_Default___.NULL__BYTE()), (_this).PartitionIdBytes()), m_CacheConstants.Companion_Default___.NULL__BYTE()), _5_suffix) + var _7_maybeCacheIdDigest m_Wrappers.Result + _ = _7_maybeCacheIdDigest + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (cryptoPrimitives).Digest(m_AwsCryptographyPrimitivesTypes.Companion_DigestInput_.Create_DigestInput_(_2_hashAlgorithm, _6_identifier)) + _7_maybeCacheIdDigest = _out0 + var _8_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _8_valueOrError1 + _8_valueOrError1 = (_7_maybeCacheIdDigest).MapFailure(func(coer82 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg83 interface{}) interface{} { + return coer82(arg83.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_9_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_9_e) + })) + if (_8_valueOrError1).IsFailure() { + cacheId = (_8_valueOrError1).PropagateFailure() + return cacheId + } + var _10_cacheDigest _dafny.Sequence + _ = _10_cacheDigest + _10_cacheDigest = (_8_valueOrError1).Extract().(_dafny.Sequence) + var _11_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _11_valueOrError2 + _11_valueOrError2 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_10_cacheDigest).Cardinality())).Cmp(m_Digest.Companion_Default___.Length(_2_hashAlgorithm)) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Digest generated a message not equal to the expected length."))) + if (_11_valueOrError2).IsFailure() { + cacheId = (_11_valueOrError2).PropagateFailure() + return cacheId + } + cacheId = m_Wrappers.Companion_Result_.Create_Success_(_10_cacheDigest) + return cacheId + return cacheId + } +} +func (_this *AwsKmsHierarchicalKeyring) GetActiveHierarchicalMaterials(branchKeyId _dafny.Sequence, cacheId _dafny.Sequence, keyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient) m_Wrappers.Result { + { + var material m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = material + var _0_getCacheInput m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput + _ = _0_getCacheInput + _0_getCacheInput = m_AwsCryptographyMaterialProvidersTypes.Companion_GetCacheEntryInput_.Create_GetCacheEntryInput_(cacheId, m_Wrappers.Companion_Option_.Create_None_()) + var _1_getCacheOutput m_Wrappers.Result + _ = _1_getCacheOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Cache()).GetCacheEntry(_0_getCacheInput) + _1_getCacheOutput = _out0 + if ((_1_getCacheOutput).Is_Failure()) && (!(((_1_getCacheOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)).Is_EntryDoesNotExist())) { + material = m_Wrappers.Companion_Result_.Create_Failure_((_1_getCacheOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return material + } + var _2_now int64 + _ = _2_now + var _out1 int64 + _ = _out1 + _out1 = m__Time.CurrentRelativeTime() + _2_now = _out1 + if ((_1_getCacheOutput).Is_Failure()) || (!(Companion_Default___.CacheEntryWithinLimits(((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_creationTime(), _2_now, (_this).TtlSeconds()))) { + var _3_maybeGetActiveBranchKeyOutput m_Wrappers.Result + _ = _3_maybeGetActiveBranchKeyOutput + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = (keyStore).GetActiveBranchKey(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyInput_.Create_GetActiveBranchKeyInput_(branchKeyId)) + _3_maybeGetActiveBranchKeyOutput = _out2 + var _4_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Default()) + _ = _4_valueOrError0 + _4_valueOrError0 = (_3_maybeGetActiveBranchKeyOutput).MapFailure(func(coer83 func(m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg84 interface{}) interface{} { + return coer83(arg84.(m_AwsCryptographyKeyStoreTypes.Error)) + } + }(func(_5_e m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyKeyStore_(_5_e) + })) + if (_4_valueOrError0).IsFailure() { + material = (_4_valueOrError0).PropagateFailure() + return material + } + var _6_getActiveBranchKeyOutput m_AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput + _ = _6_getActiveBranchKeyOutput + _6_getActiveBranchKeyOutput = (_4_valueOrError0).Extract().(m_AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput) + var _7_branchKeyMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _7_branchKeyMaterials + _7_branchKeyMaterials = (_6_getActiveBranchKeyOutput).Dtor_branchKeyMaterials() + var _8_now int64 + _ = _8_now + var _out3 int64 + _ = _out3 + _out3 = m__Time.CurrentRelativeTime() + _8_now = _out3 + var _9_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError1 + _9_valueOrError1 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfInt64(_8_now)).Plus(_dafny.IntOfInt64((_this).TtlSeconds()))).Cmp(m_StandardLibrary_UInt.Companion_Default___.INT64__MAX__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("INT64 Overflow when putting cache entry."))) + if (_9_valueOrError1).IsFailure() { + material = (_9_valueOrError1).PropagateFailure() + return material + } + var _10_putCacheEntryInput m_AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput + _ = _10_putCacheEntryInput + _10_putCacheEntryInput = m_AwsCryptographyMaterialProvidersTypes.Companion_PutCacheEntryInput_.Create_PutCacheEntryInput_(cacheId, m_AwsCryptographyMaterialProvidersTypes.Companion_Materials_.Create_BranchKey_(_7_branchKeyMaterials), _8_now, ((_this).TtlSeconds())+(_8_now), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _11_putResult m_Wrappers.Result + _ = _11_putResult + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = ((_this).Cache()).PutCacheEntry(_10_putCacheEntryInput) + _11_putResult = _out4 + if ((_11_putResult).Is_Failure()) && (!(((_11_putResult).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)).Is_EntryAlreadyExists())) { + material = m_Wrappers.Companion_Result_.Create_Failure_((_11_putResult).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return material + } + material = m_Wrappers.Companion_Result_.Create_Success_(_7_branchKeyMaterials) + return material + } else { + var _12_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _12_valueOrError2 + _12_valueOrError2 = m_Wrappers.Companion_Default___.Need(((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Is_BranchKey()) && ((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_Materials_.Create_BranchKey_((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Dtor_BranchKey()))), Companion_Default___.E(_dafny.SeqOfString("Invalid Material Type."))) + if (_12_valueOrError2).IsFailure() { + material = (_12_valueOrError2).PropagateFailure() + return material + } + material = m_Wrappers.Companion_Result_.Create_Success_((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Dtor_BranchKey()) + return material + } + return material + } +} +func (_this *AwsKmsHierarchicalKeyring) KeyStore() m_AwsCryptographyKeyStoreTypes.IKeyStoreClient { + { + return _this._keyStore + } +} +func (_this *AwsKmsHierarchicalKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *AwsKmsHierarchicalKeyring) Cache() m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache { + { + return _this._cache + } +} +func (_this *AwsKmsHierarchicalKeyring) BranchKeyIdSupplier() m_Wrappers.Option { + { + return _this._branchKeyIdSupplier + } +} +func (_this *AwsKmsHierarchicalKeyring) BranchKeyId() m_Wrappers.Option { + { + return _this._branchKeyId + } +} +func (_this *AwsKmsHierarchicalKeyring) TtlSeconds() int64 { + { + return _this._ttlSeconds + } +} +func (_this *AwsKmsHierarchicalKeyring) PartitionIdBytes() _dafny.Sequence { + { + return _this._partitionIdBytes + } +} +func (_this *AwsKmsHierarchicalKeyring) LogicalKeyStoreNameBytes() _dafny.Sequence { + { + return _this._logicalKeyStoreNameBytes + } +} + +// End of class AwsKmsHierarchicalKeyring + +// Definition of class OnDecryptHierarchyEncryptedDataKeyFilter +type OnDecryptHierarchyEncryptedDataKeyFilter struct { + _branchKeyId _dafny.Sequence +} + +func New_OnDecryptHierarchyEncryptedDataKeyFilter_() *OnDecryptHierarchyEncryptedDataKeyFilter { + _this := OnDecryptHierarchyEncryptedDataKeyFilter{} + + _this._branchKeyId = _dafny.EmptySeq.SetString() + return &_this +} + +type CompanionStruct_OnDecryptHierarchyEncryptedDataKeyFilter_ struct { +} + +var Companion_OnDecryptHierarchyEncryptedDataKeyFilter_ = CompanionStruct_OnDecryptHierarchyEncryptedDataKeyFilter_{} + +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) Equals(other *OnDecryptHierarchyEncryptedDataKeyFilter) bool { + return _this == other +} + +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OnDecryptHierarchyEncryptedDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*OnDecryptHierarchyEncryptedDataKeyFilter) String() string { + return "AwsKmsHierarchicalKeyring.OnDecryptHierarchyEncryptedDataKeyFilter" +} + +func Type_OnDecryptHierarchyEncryptedDataKeyFilter_() _dafny.TypeDescriptor { + return type_OnDecryptHierarchyEncryptedDataKeyFilter_{} +} + +type type_OnDecryptHierarchyEncryptedDataKeyFilter_ struct { +} + +func (_this type_OnDecryptHierarchyEncryptedDataKeyFilter_) Default() interface{} { + return (*OnDecryptHierarchyEncryptedDataKeyFilter)(nil) +} + +func (_this type_OnDecryptHierarchyEncryptedDataKeyFilter_) String() string { + return "AwsKmsHierarchicalKeyring.OnDecryptHierarchyEncryptedDataKeyFilter" +} +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &OnDecryptHierarchyEncryptedDataKeyFilter{} +var _ m_Actions.DeterministicAction = &OnDecryptHierarchyEncryptedDataKeyFilter{} +var _ _dafny.TraitOffspring = &OnDecryptHierarchyEncryptedDataKeyFilter{} + +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) Ctor__(branchKeyId _dafny.Sequence) { + { + (_this)._branchKeyId = branchKeyId + } +} +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + var _0_providerInfo _dafny.Sequence + _ = _0_providerInfo + _0_providerInfo = (edk).Dtor_keyProviderInfo() + var _1_providerId _dafny.Sequence + _ = _1_providerId + _1_providerId = (edk).Dtor_keyProviderId() + if !_dafny.Companion_Sequence_.Equal(_1_providerId, m_Constants.Companion_Default___.PROVIDER__ID__HIERARCHY()) { + res = m_Wrappers.Companion_Result_.Create_Success_(false) + return res + } + if !(m_UTF8.Companion_Default___.ValidUTF8Seq(_0_providerInfo)) { + res = m_Wrappers.Companion_Result_.Create_Failure_(Companion_Default___.E(_dafny.SeqOfString("Invalid encoding, provider info is not UTF8."))) + return res + } + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _2_valueOrError0 + _2_valueOrError0 = (m_UTF8.Decode(_0_providerInfo)).MapFailure(func(coer84 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg85 interface{}) interface{} { + return coer84(arg85.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_branchKeyId _dafny.Sequence + _ = _3_branchKeyId + _3_branchKeyId = (_2_valueOrError0).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Equal((_this).BranchKeyId(), _3_branchKeyId)) + return res + return res + } +} +func (_this *OnDecryptHierarchyEncryptedDataKeyFilter) BranchKeyId() _dafny.Sequence { + { + return _this._branchKeyId + } +} + +// End of class OnDecryptHierarchyEncryptedDataKeyFilter + +// Definition of class DecryptSingleEncryptedDataKey +type DecryptSingleEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _keyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _branchKeyId _dafny.Sequence + _ttlSeconds int64 + _cache m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache + _partitionIdBytes _dafny.Sequence + _logicalKeyStoreNameBytes _dafny.Sequence +} + +func New_DecryptSingleEncryptedDataKey_() *DecryptSingleEncryptedDataKey { + _this := DecryptSingleEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._keyStore = (m_AwsCryptographyKeyStoreTypes.IKeyStoreClient)(nil) + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._branchKeyId = _dafny.EmptySeq.SetString() + _this._ttlSeconds = int64(0) + _this._cache = (m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache)(nil) + _this._partitionIdBytes = _dafny.EmptySeq + _this._logicalKeyStoreNameBytes = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_DecryptSingleEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleEncryptedDataKey_ = CompanionStruct_DecryptSingleEncryptedDataKey_{} + +func (_this *DecryptSingleEncryptedDataKey) Equals(other *DecryptSingleEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleEncryptedDataKey) String() string { + return "AwsKmsHierarchicalKeyring.DecryptSingleEncryptedDataKey" +} + +func Type_DecryptSingleEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleEncryptedDataKey_{} +} + +type type_DecryptSingleEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleEncryptedDataKey_) String() string { + return "AwsKmsHierarchicalKeyring.DecryptSingleEncryptedDataKey" +} +func (_this *DecryptSingleEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleEncryptedDataKey{} + +func (_this *DecryptSingleEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, keyStore m_AwsCryptographyKeyStoreTypes.IKeyStoreClient, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, branchKeyId _dafny.Sequence, ttlSeconds int64, cache m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache, partitionIdBytes _dafny.Sequence, logicalKeyStoreNameBytes _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._keyStore = keyStore + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._branchKeyId = branchKeyId + (_this)._ttlSeconds = ttlSeconds + (_this)._cache = cache + (_this)._partitionIdBytes = partitionIdBytes + (_this)._logicalKeyStoreNameBytes = logicalKeyStoreNameBytes + } +} +func (_this *DecryptSingleEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received invalid EDK provider info for Hierarchical Keyring"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((_this).Materials()).Dtor_algorithmSuite() + var _2_keyProviderId _dafny.Sequence + _ = _2_keyProviderId + _2_keyProviderId = (edk).Dtor_keyProviderId() + var _3_branchKeyIdUtf8 _dafny.Sequence + _ = _3_branchKeyIdUtf8 + _3_branchKeyIdUtf8 = (edk).Dtor_keyProviderInfo() + var _4_ciphertext _dafny.Sequence + _ = _4_ciphertext + _4_ciphertext = (edk).Dtor_ciphertext() + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + _5_valueOrError1 = m_EdkWrapping.Companion_Default___.GetProviderWrappedMaterial(_4_ciphertext, _1_suite) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_providerWrappedMaterial _dafny.Sequence + _ = _6_providerWrappedMaterial + _6_providerWrappedMaterial = (_5_valueOrError1).Extract().(_dafny.Sequence) + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_6_providerWrappedMaterial).Cardinality())).Cmp(_dafny.IntOfInt32(Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX())) >= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received EDK Ciphertext of incorrect length."))) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_branchKeyVersionUuid _dafny.Sequence + _ = _8_branchKeyVersionUuid + _8_branchKeyVersionUuid = (_6_providerWrappedMaterial).Subsequence(uint32(Companion_Default___.EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX()), uint32(Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX())) + var _9_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _9_valueOrError3 + _9_valueOrError3 = (m_UUID.FromByteArray(_8_branchKeyVersionUuid)).MapFailure(func(coer85 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg86 interface{}) interface{} { + return coer85(arg86.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_version _dafny.Sequence + _ = _10_version + _10_version = (_9_valueOrError3).Extract().(_dafny.Sequence) + var _11_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _11_valueOrError4 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetVersionCacheId(_3_branchKeyIdUtf8, _10_version, (_this).CryptoPrimitives()) + _11_valueOrError4 = _out0 + if (_11_valueOrError4).IsFailure() { + res = (_11_valueOrError4).PropagateFailure() + return res + } + var _12_cacheId _dafny.Sequence + _ = _12_cacheId + _12_cacheId = (_11_valueOrError4).Extract().(_dafny.Sequence) + var _13_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = _13_valueOrError5 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).GetHierarchicalMaterialsVersion((_this).BranchKeyId(), _3_branchKeyIdUtf8, _10_version, _12_cacheId) + _13_valueOrError5 = _out1 + if (_13_valueOrError5).IsFailure() { + res = (_13_valueOrError5).PropagateFailure() + return res + } + var _14_hierarchicalMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _14_hierarchicalMaterials + _14_hierarchicalMaterials = (_13_valueOrError5).Extract().(m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials) + var _15_branchKey _dafny.Sequence + _ = _15_branchKey + _15_branchKey = (_14_hierarchicalMaterials).Dtor_branchKey() + var _16_branchKeyVersion _dafny.Sequence + _ = _16_branchKeyVersion + _16_branchKeyVersion = (_14_hierarchicalMaterials).Dtor_branchKeyVersion() + var _17_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _17_valueOrError6 + _17_valueOrError6 = (m_UTF8.Decode(_16_branchKeyVersion)).MapFailure(func(coer86 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg87 interface{}) interface{} { + return coer86(arg87.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_17_valueOrError6).IsFailure() { + res = (_17_valueOrError6).PropagateFailure() + return res + } + var _18_branchKeyVersionAsString _dafny.Sequence + _ = _18_branchKeyVersionAsString + _18_branchKeyVersionAsString = (_17_valueOrError6).Extract().(_dafny.Sequence) + var _19_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _19_valueOrError7 + _19_valueOrError7 = (m_UUID.ToByteArray(_18_branchKeyVersionAsString)).MapFailure(func(coer87 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg88 interface{}) interface{} { + return coer87(arg88.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_19_valueOrError7).IsFailure() { + res = (_19_valueOrError7).PropagateFailure() + return res + } + var _20_branchKeyVersionAsBytes _dafny.Sequence + _ = _20_branchKeyVersionAsBytes + _20_branchKeyVersionAsBytes = (_19_valueOrError7).Extract().(_dafny.Sequence) + var _21_maybeCrypto m_Wrappers.Result + _ = _21_maybeCrypto + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) + _21_maybeCrypto = _out2 + var _22_valueOrError8 m_Wrappers.Result = m_Wrappers.Result{} + _ = _22_valueOrError8 + _22_valueOrError8 = (_21_maybeCrypto).MapFailure(func(coer88 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg89 interface{}) interface{} { + return coer88(arg89.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_23_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_23_e) + })) + if (_22_valueOrError8).IsFailure() { + res = (_22_valueOrError8).PropagateFailure() + return res + } + var _24_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient + _ = _24_cryptoPrimitivesX + _24_cryptoPrimitivesX = (_22_valueOrError8).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _25_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _ = _25_cryptoPrimitives + _25_cryptoPrimitives = _24_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _26_kmsHierarchyUnwrap *KmsHierarchyUnwrapKeyMaterial + _ = _26_kmsHierarchyUnwrap + var _nw0 *KmsHierarchyUnwrapKeyMaterial = New_KmsHierarchyUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(_15_branchKey, _3_branchKeyIdUtf8, _20_branchKeyVersionAsBytes, _25_cryptoPrimitives) + _26_kmsHierarchyUnwrap = _nw0 + var _27_unwrapOutputRes m_Wrappers.Result + _ = _27_unwrapOutputRes + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _26_kmsHierarchyUnwrap) + _27_unwrapOutputRes = _out3 + var _28_valueOrError9 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(Companion_HierarchyUnwrapInfo_.Default())) + _ = _28_valueOrError9 + _28_valueOrError9 = _27_unwrapOutputRes + if (_28_valueOrError9).IsFailure() { + res = (_28_valueOrError9).PropagateFailure() + return res + } + var _29_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _29_unwrapOutput + _29_unwrapOutput = (_28_valueOrError9).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _30_valueOrError10 m_Wrappers.Result = m_Wrappers.Result{} + _ = _30_valueOrError10 + _30_valueOrError10 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_29_unwrapOutput).Dtor_plaintextDataKey(), (_29_unwrapOutput).Dtor_symmetricSigningKey()) + if (_30_valueOrError10).IsFailure() { + res = (_30_valueOrError10).PropagateFailure() + return res + } + var _31_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _31_result + _31_result = (_30_valueOrError10).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_31_result) + return res + return res + } +} +func (_this *DecryptSingleEncryptedDataKey) GetVersionCacheId(branchKeyIdUtf8 _dafny.Sequence, branchKeyVersion _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + { + var cacheId m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = cacheId + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((m_UTF8.Decode(branchKeyIdUtf8)).MapFailure(func(coer89 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg90 interface{}) interface{} { + return coer89(arg90.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError))).Is_Success()) && (func(_pat_let7_0 _dafny.Sequence) bool { + return func(_1_branchKeyId _dafny.Sequence) bool { + return (true) && (((_dafny.IntOfUint32((_1_branchKeyId).Cardinality())).Sign() != -1) && ((_dafny.IntOfUint32((_1_branchKeyId).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT32__LIMIT()) < 0)) + }(_pat_let7_0) + }(((m_UTF8.Decode(branchKeyIdUtf8)).MapFailure(func(coer90 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg91 interface{}) interface{} { + return coer90(arg91.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError))).Dtor_value().(_dafny.Sequence))), Companion_Default___.E(_dafny.SeqOfString("Invalid Branch Key ID Length"))) + if (_0_valueOrError0).IsFailure() { + cacheId = (_0_valueOrError0).PropagateFailure() + return cacheId + } + var _2_hashAlgorithm m_AwsCryptographyPrimitivesTypes.DigestAlgorithm + _ = _2_hashAlgorithm + _2_hashAlgorithm = m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_() + var _3_resourceId _dafny.Sequence + _ = _3_resourceId + _3_resourceId = m_CacheConstants.Companion_Default___.RESOURCE__ID__HIERARCHICAL__KEYRING() + var _4_scopeId _dafny.Sequence + _ = _4_scopeId + _4_scopeId = m_CacheConstants.Companion_Default___.SCOPE__ID__DECRYPT() + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError1 + _5_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.IsASCIIString(branchKeyVersion), Companion_Default___.E(_dafny.SeqOfString("Unable to represent as an ASCII string."))) + if (_5_valueOrError1).IsFailure() { + cacheId = (_5_valueOrError1).PropagateFailure() + return cacheId + } + var _6_versionBytes _dafny.Sequence + _ = _6_versionBytes + _6_versionBytes = m_UTF8.Companion_Default___.EncodeAscii(branchKeyVersion) + var _7_suffix _dafny.Sequence + _ = _7_suffix + _7_suffix = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_this).LogicalKeyStoreNameBytes(), m_CacheConstants.Companion_Default___.NULL__BYTE()), branchKeyIdUtf8), m_CacheConstants.Companion_Default___.NULL__BYTE()), _6_versionBytes) + var _8_identifier _dafny.Sequence + _ = _8_identifier + _8_identifier = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_3_resourceId, m_CacheConstants.Companion_Default___.NULL__BYTE()), _4_scopeId), m_CacheConstants.Companion_Default___.NULL__BYTE()), (_this).PartitionIdBytes()), m_CacheConstants.Companion_Default___.NULL__BYTE()), _7_suffix) + var _9_identifierDigestInput m_AwsCryptographyPrimitivesTypes.DigestInput + _ = _9_identifierDigestInput + _9_identifierDigestInput = m_AwsCryptographyPrimitivesTypes.Companion_DigestInput_.Create_DigestInput_(_2_hashAlgorithm, _8_identifier) + var _10_maybeCacheDigest m_Wrappers.Result + _ = _10_maybeCacheDigest + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Digest.Companion_Default___.Digest(_9_identifierDigestInput) + _10_maybeCacheDigest = _out0 + var _11_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _11_valueOrError2 + _11_valueOrError2 = (_10_maybeCacheDigest).MapFailure(func(coer91 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg92 interface{}) interface{} { + return coer91(arg92.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_12_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_12_e) + })) + if (_11_valueOrError2).IsFailure() { + cacheId = (_11_valueOrError2).PropagateFailure() + return cacheId + } + var _13_cacheDigest _dafny.Sequence + _ = _13_cacheDigest + _13_cacheDigest = (_11_valueOrError2).Extract().(_dafny.Sequence) + var _14_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _14_valueOrError3 + _14_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_13_cacheDigest).Cardinality())).Cmp(m_Digest.Companion_Default___.Length(_2_hashAlgorithm)) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Digest generated a message not equal to the expected length."))) + if (_14_valueOrError3).IsFailure() { + cacheId = (_14_valueOrError3).PropagateFailure() + return cacheId + } + cacheId = m_Wrappers.Companion_Result_.Create_Success_(_13_cacheDigest) + return cacheId + return cacheId + } +} +func (_this *DecryptSingleEncryptedDataKey) GetHierarchicalMaterialsVersion(branchKeyId _dafny.Sequence, branchKeyIdUtf8 _dafny.Sequence, version _dafny.Sequence, cacheId _dafny.Sequence) m_Wrappers.Result { + { + var material m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = material + var _0_getCacheInput m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput + _ = _0_getCacheInput + _0_getCacheInput = m_AwsCryptographyMaterialProvidersTypes.Companion_GetCacheEntryInput_.Create_GetCacheEntryInput_(cacheId, m_Wrappers.Companion_Option_.Create_None_()) + var _1_getCacheOutput m_Wrappers.Result + _ = _1_getCacheOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Cache()).GetCacheEntry(_0_getCacheInput) + _1_getCacheOutput = _out0 + if ((_1_getCacheOutput).Is_Failure()) && (!(((_1_getCacheOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)).Is_EntryDoesNotExist())) { + material = m_Wrappers.Companion_Result_.Create_Failure_((_1_getCacheOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return material + } + var _2_now int64 + _ = _2_now + var _out1 int64 + _ = _out1 + _out1 = m__Time.CurrentRelativeTime() + _2_now = _out1 + if ((_1_getCacheOutput).Is_Failure()) || (!(Companion_Default___.CacheEntryWithinLimits(((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_creationTime(), _2_now, (_this).TtlSeconds()))) { + var _3_maybeGetBranchKeyVersionOutput m_Wrappers.Result + _ = _3_maybeGetBranchKeyVersionOutput + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = ((_this).KeyStore()).GetBranchKeyVersion(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionInput_.Create_GetBranchKeyVersionInput_(branchKeyId, version)) + _3_maybeGetBranchKeyVersionOutput = _out2 + var _4_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Default()) + _ = _4_valueOrError0 + _4_valueOrError0 = (_3_maybeGetBranchKeyVersionOutput).MapFailure(func(coer92 func(m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg93 interface{}) interface{} { + return coer92(arg93.(m_AwsCryptographyKeyStoreTypes.Error)) + } + }(func(_5_e m_AwsCryptographyKeyStoreTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyKeyStore_(_5_e) + })) + if (_4_valueOrError0).IsFailure() { + material = (_4_valueOrError0).PropagateFailure() + return material + } + var _6_getBranchKeyVersionOutput m_AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput + _ = _6_getBranchKeyVersionOutput + _6_getBranchKeyVersionOutput = (_4_valueOrError0).Extract().(m_AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput) + var _7_branchKeyMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _7_branchKeyMaterials + _7_branchKeyMaterials = (_6_getBranchKeyVersionOutput).Dtor_branchKeyMaterials() + var _8_now int64 + _ = _8_now + var _out3 int64 + _ = _out3 + _out3 = m__Time.CurrentRelativeTime() + _8_now = _out3 + var _9_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError1 + _9_valueOrError1 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfInt64(_8_now)).Plus(_dafny.IntOfInt64((_this).TtlSeconds()))).Cmp(m_StandardLibrary_UInt.Companion_Default___.INT64__MAX__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("INT64 Overflow when putting cache entry."))) + if (_9_valueOrError1).IsFailure() { + material = (_9_valueOrError1).PropagateFailure() + return material + } + var _10_putCacheEntryInput m_AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput + _ = _10_putCacheEntryInput + _10_putCacheEntryInput = m_AwsCryptographyMaterialProvidersTypes.Companion_PutCacheEntryInput_.Create_PutCacheEntryInput_(cacheId, m_AwsCryptographyMaterialProvidersTypes.Companion_Materials_.Create_BranchKey_(_7_branchKeyMaterials), _8_now, ((_this).TtlSeconds())+(_8_now), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _11_putResult m_Wrappers.Result + _ = _11_putResult + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = ((_this).Cache()).PutCacheEntry(_10_putCacheEntryInput) + _11_putResult = _out4 + if ((_11_putResult).Is_Failure()) && (!(((_11_putResult).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)).Is_EntryAlreadyExists())) { + material = m_Wrappers.Companion_Result_.Create_Failure_((_11_putResult).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return material + } + material = m_Wrappers.Companion_Result_.Create_Success_(_7_branchKeyMaterials) + return material + } else { + var _12_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _12_valueOrError2 + _12_valueOrError2 = m_Wrappers.Companion_Default___.Need(((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Is_BranchKey()) && ((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_Materials_.Create_BranchKey_((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Dtor_BranchKey()))), Companion_Default___.E(_dafny.SeqOfString("Invalid Material Type."))) + if (_12_valueOrError2).IsFailure() { + material = (_12_valueOrError2).PropagateFailure() + return material + } + material = m_Wrappers.Companion_Result_.Create_Success_((((_1_getCacheOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)).Dtor_materials()).Dtor_BranchKey()) + return material + } + return material + } +} +func (_this *DecryptSingleEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleEncryptedDataKey) KeyStore() m_AwsCryptographyKeyStoreTypes.IKeyStoreClient { + { + return _this._keyStore + } +} +func (_this *DecryptSingleEncryptedDataKey) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *DecryptSingleEncryptedDataKey) BranchKeyId() _dafny.Sequence { + { + return _this._branchKeyId + } +} +func (_this *DecryptSingleEncryptedDataKey) TtlSeconds() int64 { + { + return _this._ttlSeconds + } +} +func (_this *DecryptSingleEncryptedDataKey) Cache() m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache { + { + return _this._cache + } +} +func (_this *DecryptSingleEncryptedDataKey) PartitionIdBytes() _dafny.Sequence { + { + return _this._partitionIdBytes + } +} +func (_this *DecryptSingleEncryptedDataKey) LogicalKeyStoreNameBytes() _dafny.Sequence { + { + return _this._logicalKeyStoreNameBytes + } +} + +// End of class DecryptSingleEncryptedDataKey + +// Definition of datatype HierarchyUnwrapInfo +type HierarchyUnwrapInfo struct { + Data_HierarchyUnwrapInfo_ +} + +func (_this HierarchyUnwrapInfo) Get_() Data_HierarchyUnwrapInfo_ { + return _this.Data_HierarchyUnwrapInfo_ +} + +type Data_HierarchyUnwrapInfo_ interface { + isHierarchyUnwrapInfo() +} + +type CompanionStruct_HierarchyUnwrapInfo_ struct { +} + +var Companion_HierarchyUnwrapInfo_ = CompanionStruct_HierarchyUnwrapInfo_{} + +type HierarchyUnwrapInfo_HierarchyUnwrapInfo struct { +} + +func (HierarchyUnwrapInfo_HierarchyUnwrapInfo) isHierarchyUnwrapInfo() {} + +func (CompanionStruct_HierarchyUnwrapInfo_) Create_HierarchyUnwrapInfo_() HierarchyUnwrapInfo { + return HierarchyUnwrapInfo{HierarchyUnwrapInfo_HierarchyUnwrapInfo{}} +} + +func (_this HierarchyUnwrapInfo) Is_HierarchyUnwrapInfo() bool { + _, ok := _this.Get_().(HierarchyUnwrapInfo_HierarchyUnwrapInfo) + return ok +} + +func (CompanionStruct_HierarchyUnwrapInfo_) Default() HierarchyUnwrapInfo { + return Companion_HierarchyUnwrapInfo_.Create_HierarchyUnwrapInfo_() +} + +func (_ CompanionStruct_HierarchyUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_HierarchyUnwrapInfo_.Create_HierarchyUnwrapInfo_(), true + default: + return HierarchyUnwrapInfo{}, false + } + } +} + +func (_this HierarchyUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case HierarchyUnwrapInfo_HierarchyUnwrapInfo: + { + return "AwsKmsHierarchicalKeyring.HierarchyUnwrapInfo.HierarchyUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this HierarchyUnwrapInfo) Equals(other HierarchyUnwrapInfo) bool { + switch _this.Get_().(type) { + case HierarchyUnwrapInfo_HierarchyUnwrapInfo: + { + _, ok := other.Get_().(HierarchyUnwrapInfo_HierarchyUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this HierarchyUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(HierarchyUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_HierarchyUnwrapInfo_() _dafny.TypeDescriptor { + return type_HierarchyUnwrapInfo_{} +} + +type type_HierarchyUnwrapInfo_ struct { +} + +func (_this type_HierarchyUnwrapInfo_) Default() interface{} { + return Companion_HierarchyUnwrapInfo_.Default() +} + +func (_this type_HierarchyUnwrapInfo_) String() string { + return "AwsKmsHierarchicalKeyring.HierarchyUnwrapInfo" +} +func (_this HierarchyUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = HierarchyUnwrapInfo{} + +// End of datatype HierarchyUnwrapInfo + +// Definition of datatype HierarchyWrapInfo +type HierarchyWrapInfo struct { + Data_HierarchyWrapInfo_ +} + +func (_this HierarchyWrapInfo) Get_() Data_HierarchyWrapInfo_ { + return _this.Data_HierarchyWrapInfo_ +} + +type Data_HierarchyWrapInfo_ interface { + isHierarchyWrapInfo() +} + +type CompanionStruct_HierarchyWrapInfo_ struct { +} + +var Companion_HierarchyWrapInfo_ = CompanionStruct_HierarchyWrapInfo_{} + +type HierarchyWrapInfo_HierarchyWrapInfo struct { +} + +func (HierarchyWrapInfo_HierarchyWrapInfo) isHierarchyWrapInfo() {} + +func (CompanionStruct_HierarchyWrapInfo_) Create_HierarchyWrapInfo_() HierarchyWrapInfo { + return HierarchyWrapInfo{HierarchyWrapInfo_HierarchyWrapInfo{}} +} + +func (_this HierarchyWrapInfo) Is_HierarchyWrapInfo() bool { + _, ok := _this.Get_().(HierarchyWrapInfo_HierarchyWrapInfo) + return ok +} + +func (CompanionStruct_HierarchyWrapInfo_) Default() HierarchyWrapInfo { + return Companion_HierarchyWrapInfo_.Create_HierarchyWrapInfo_() +} + +func (_ CompanionStruct_HierarchyWrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_HierarchyWrapInfo_.Create_HierarchyWrapInfo_(), true + default: + return HierarchyWrapInfo{}, false + } + } +} + +func (_this HierarchyWrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case HierarchyWrapInfo_HierarchyWrapInfo: + { + return "AwsKmsHierarchicalKeyring.HierarchyWrapInfo.HierarchyWrapInfo" + } + default: + { + return "" + } + } +} + +func (_this HierarchyWrapInfo) Equals(other HierarchyWrapInfo) bool { + switch _this.Get_().(type) { + case HierarchyWrapInfo_HierarchyWrapInfo: + { + _, ok := other.Get_().(HierarchyWrapInfo_HierarchyWrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this HierarchyWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(HierarchyWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_HierarchyWrapInfo_() _dafny.TypeDescriptor { + return type_HierarchyWrapInfo_{} +} + +type type_HierarchyWrapInfo_ struct { +} + +func (_this type_HierarchyWrapInfo_) Default() interface{} { + return Companion_HierarchyWrapInfo_.Default() +} + +func (_this type_HierarchyWrapInfo_) String() string { + return "AwsKmsHierarchicalKeyring.HierarchyWrapInfo" +} +func (_this HierarchyWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = HierarchyWrapInfo{} + +// End of datatype HierarchyWrapInfo + +// Definition of class KmsHierarchyUnwrapKeyMaterial +type KmsHierarchyUnwrapKeyMaterial struct { + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient + _branchKeyIdUtf8 _dafny.Sequence + _branchKeyVersionAsBytes _dafny.Sequence + _branchKey _dafny.Sequence +} + +func New_KmsHierarchyUnwrapKeyMaterial_() *KmsHierarchyUnwrapKeyMaterial { + _this := KmsHierarchyUnwrapKeyMaterial{} + + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._branchKeyIdUtf8 = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._branchKeyVersionAsBytes = _dafny.EmptySeq + _this._branchKey = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_KmsHierarchyUnwrapKeyMaterial_ struct { +} + +var Companion_KmsHierarchyUnwrapKeyMaterial_ = CompanionStruct_KmsHierarchyUnwrapKeyMaterial_{} + +func (_this *KmsHierarchyUnwrapKeyMaterial) Equals(other *KmsHierarchyUnwrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsHierarchyUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsHierarchyUnwrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsHierarchyUnwrapKeyMaterial) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyUnwrapKeyMaterial" +} + +func Type_KmsHierarchyUnwrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsHierarchyUnwrapKeyMaterial_{} +} + +type type_KmsHierarchyUnwrapKeyMaterial_ struct { +} + +func (_this type_KmsHierarchyUnwrapKeyMaterial_) Default() interface{} { + return (*KmsHierarchyUnwrapKeyMaterial)(nil) +} + +func (_this type_KmsHierarchyUnwrapKeyMaterial_) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyUnwrapKeyMaterial" +} +func (_this *KmsHierarchyUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &KmsHierarchyUnwrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsHierarchyUnwrapKeyMaterial{} +var _ m_Actions.Action = &KmsHierarchyUnwrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsHierarchyUnwrapKeyMaterial{} + +func (_this *KmsHierarchyUnwrapKeyMaterial) Ctor__(branchKey _dafny.Sequence, branchKeyIdUtf8 _dafny.Sequence, branchKeyVersionAsBytes _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._branchKey = branchKey + (_this)._branchKeyIdUtf8 = branchKeyIdUtf8 + (_this)._branchKeyVersionAsBytes = branchKeyVersionAsBytes + (_this)._crypto = crypto + } +} +func (_this *KmsHierarchyUnwrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_HierarchyUnwrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_wrappedMaterial _dafny.Sequence + _ = _1_wrappedMaterial + _1_wrappedMaterial = (input).Dtor_wrappedMaterial() + var _2_aad _dafny.Map + _ = _2_aad + _2_aad = (input).Dtor_encryptionContext() + var _3_KeyLength int32 + _ = _3_KeyLength + _3_KeyLength = m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite) + var _4_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError0 + _4_valueOrError0 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_1_wrappedMaterial).Cardinality())).Cmp((_dafny.IntOfInt32(Companion_Default___.EXPECTED__EDK__CIPHERTEXT__OVERHEAD())).Plus(_dafny.IntOfInt32(_3_KeyLength))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received EDK Ciphertext of incorrect length2."))) + if (_4_valueOrError0).IsFailure() { + res = (_4_valueOrError0).PropagateFailure() + return res + } + var _5_salt _dafny.Sequence + _ = _5_salt + _5_salt = (_1_wrappedMaterial).Subsequence(0, uint32(Companion_Default___.H__WRAP__SALT__LEN())) + var _6_iv _dafny.Sequence + _ = _6_iv + _6_iv = (_1_wrappedMaterial).Subsequence(uint32(Companion_Default___.H__WRAP__SALT__LEN()), uint32(Companion_Default___.EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX())) + var _7_branchKeyVersionUuid _dafny.Sequence + _ = _7_branchKeyVersionUuid + _7_branchKeyVersionUuid = (_1_wrappedMaterial).Subsequence(uint32(Companion_Default___.EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX()), uint32(Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX())) + var _8_wrappedKey _dafny.Sequence + _ = _8_wrappedKey + _8_wrappedKey = (_1_wrappedMaterial).Subsequence(uint32(Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX()), uint32((Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX())+(_3_KeyLength))) + var _9_authTag _dafny.Sequence + _ = _9_authTag + _9_authTag = (_1_wrappedMaterial).Drop(uint32((Companion_Default___.EDK__CIPHERTEXT__VERSION__INDEX()) + (_3_KeyLength))) + var _10_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _10_valueOrError1 + _10_valueOrError1 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_10_valueOrError1).IsFailure() { + res = (_10_valueOrError1).PropagateFailure() + return res + } + var _11_serializedEC _dafny.Sequence + _ = _11_serializedEC + _11_serializedEC = (_10_valueOrError1).Extract().(_dafny.Sequence) + var _12_wrappingAad _dafny.Sequence + _ = _12_wrappingAad + _12_wrappingAad = Companion_Default___.WrappingAad((_this).BranchKeyIdUtf8(), (_this).BranchKeyVersionAsBytes(), _11_serializedEC) + var _13_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _13_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.DeriveEncryptionKeyFromBranchKey((_this).BranchKey(), _5_salt, m_Wrappers.Companion_Option_.Create_Some_(m_Constants.Companion_Default___.PROVIDER__ID__HIERARCHY()), (_this).Crypto()) + _13_valueOrError2 = _out0 + if (_13_valueOrError2).IsFailure() { + res = (_13_valueOrError2).PropagateFailure() + return res + } + var _14_derivedBranchKey _dafny.Sequence + _ = _14_derivedBranchKey + _14_derivedBranchKey = (_13_valueOrError2).Extract().(_dafny.Sequence) + var _15_maybeUnwrappedPdk m_Wrappers.Result + _ = _15_maybeUnwrappedPdk + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = ((_this).Crypto()).AESDecrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESDecryptInput_.Create_AESDecryptInput_(Companion_Default___.AES__256__ENC__ALG(), _14_derivedBranchKey, _8_wrappedKey, _9_authTag, _6_iv, _12_wrappingAad)) + _15_maybeUnwrappedPdk = _out1 + var _16_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _16_valueOrError3 + _16_valueOrError3 = (_15_maybeUnwrappedPdk).MapFailure(func(coer93 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg94 interface{}) interface{} { + return coer93(arg94.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_17_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_17_e) + })) + if (_16_valueOrError3).IsFailure() { + res = (_16_valueOrError3).PropagateFailure() + return res + } + var _18_unwrappedPdk _dafny.Sequence + _ = _18_unwrappedPdk + _18_unwrappedPdk = (_16_valueOrError3).Extract().(_dafny.Sequence) + var _19_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _19_valueOrError4 + _19_valueOrError4 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_18_unwrappedPdk).Cardinality())).Cmp(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))) == 0, Companion_Default___.E(_dafny.SeqOfString("Invalid Key Length"))) + if (_19_valueOrError4).IsFailure() { + res = (_19_valueOrError4).PropagateFailure() + return res + } + var _20_output m_MaterialWrapping.UnwrapOutput + _ = _20_output + _20_output = m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(_18_unwrappedPdk, Companion_HierarchyUnwrapInfo_.Create_HierarchyUnwrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_20_output) + return res + return res + } +} +func (_this *KmsHierarchyUnwrapKeyMaterial) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} +func (_this *KmsHierarchyUnwrapKeyMaterial) BranchKeyIdUtf8() _dafny.Sequence { + { + return _this._branchKeyIdUtf8 + } +} +func (_this *KmsHierarchyUnwrapKeyMaterial) BranchKeyVersionAsBytes() _dafny.Sequence { + { + return _this._branchKeyVersionAsBytes + } +} +func (_this *KmsHierarchyUnwrapKeyMaterial) BranchKey() _dafny.Sequence { + { + return _this._branchKey + } +} + +// End of class KmsHierarchyUnwrapKeyMaterial + +// Definition of class KmsHierarchyGenerateAndWrapKeyMaterial +type KmsHierarchyGenerateAndWrapKeyMaterial struct { + _branchKey _dafny.Sequence + _branchKeyIdUtf8 _dafny.Sequence + _branchKeyVersionAsBytes _dafny.Sequence + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_KmsHierarchyGenerateAndWrapKeyMaterial_() *KmsHierarchyGenerateAndWrapKeyMaterial { + _this := KmsHierarchyGenerateAndWrapKeyMaterial{} + + _this._branchKey = _dafny.EmptySeq + _this._branchKeyIdUtf8 = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._branchKeyVersionAsBytes = _dafny.EmptySeq + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_KmsHierarchyGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_KmsHierarchyGenerateAndWrapKeyMaterial_ = CompanionStruct_KmsHierarchyGenerateAndWrapKeyMaterial_{} + +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) Equals(other *KmsHierarchyGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsHierarchyGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsHierarchyGenerateAndWrapKeyMaterial) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyGenerateAndWrapKeyMaterial" +} + +func Type_KmsHierarchyGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsHierarchyGenerateAndWrapKeyMaterial_{} +} + +type type_KmsHierarchyGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_KmsHierarchyGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*KmsHierarchyGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_KmsHierarchyGenerateAndWrapKeyMaterial_) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyGenerateAndWrapKeyMaterial" +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &KmsHierarchyGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsHierarchyGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &KmsHierarchyGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsHierarchyGenerateAndWrapKeyMaterial{} + +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) Ctor__(branchKey _dafny.Sequence, branchKeyIdUtf8 _dafny.Sequence, branchKeyVersionAsBytes _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._branchKey = branchKey + (_this)._branchKeyIdUtf8 = branchKeyIdUtf8 + (_this)._branchKeyVersionAsBytes = branchKeyVersionAsBytes + (_this)._crypto = crypto + } +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_HierarchyWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_pdkResult m_Wrappers.Result + _ = _1_pdkResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Crypto()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))) + _1_pdkResult = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_pdkResult).MapFailure(func(coer94 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg95 interface{}) interface{} { + return coer94(arg95.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_3_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_pdk _dafny.Sequence + _ = _4_pdk + _4_pdk = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _5_wrap *KmsHierarchyWrapKeyMaterial + _ = _5_wrap + var _nw0 *KmsHierarchyWrapKeyMaterial = New_KmsHierarchyWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).BranchKey(), (_this).BranchKeyIdUtf8(), (_this).BranchKeyVersionAsBytes(), (_this).Crypto()) + _5_wrap = _nw0 + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_HierarchyWrapInfo_.Default())) + _ = _6_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = (_5_wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_4_pdk, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext())) + _6_valueOrError1 = _out1.(m_Wrappers.Result) + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_wrapOutput m_MaterialWrapping.WrapOutput + _ = _7_wrapOutput + _7_wrapOutput = (_6_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + var _8_output m_MaterialWrapping.GenerateAndWrapOutput + _ = _8_output + _8_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_4_pdk, (_7_wrapOutput).Dtor_wrappedMaterial(), Companion_HierarchyWrapInfo_.Create_HierarchyWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_8_output) + return res + return res + } +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) BranchKey() _dafny.Sequence { + { + return _this._branchKey + } +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) BranchKeyIdUtf8() _dafny.Sequence { + { + return _this._branchKeyIdUtf8 + } +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) BranchKeyVersionAsBytes() _dafny.Sequence { + { + return _this._branchKeyVersionAsBytes + } +} +func (_this *KmsHierarchyGenerateAndWrapKeyMaterial) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} + +// End of class KmsHierarchyGenerateAndWrapKeyMaterial + +// Definition of class KmsHierarchyWrapKeyMaterial +type KmsHierarchyWrapKeyMaterial struct { + _branchKey _dafny.Sequence + _branchKeyIdUtf8 _dafny.Sequence + _branchKeyVersionAsBytes _dafny.Sequence + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_KmsHierarchyWrapKeyMaterial_() *KmsHierarchyWrapKeyMaterial { + _this := KmsHierarchyWrapKeyMaterial{} + + _this._branchKey = _dafny.EmptySeq + _this._branchKeyIdUtf8 = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._branchKeyVersionAsBytes = _dafny.EmptySeq + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_KmsHierarchyWrapKeyMaterial_ struct { +} + +var Companion_KmsHierarchyWrapKeyMaterial_ = CompanionStruct_KmsHierarchyWrapKeyMaterial_{} + +func (_this *KmsHierarchyWrapKeyMaterial) Equals(other *KmsHierarchyWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsHierarchyWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsHierarchyWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsHierarchyWrapKeyMaterial) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyWrapKeyMaterial" +} + +func Type_KmsHierarchyWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsHierarchyWrapKeyMaterial_{} +} + +type type_KmsHierarchyWrapKeyMaterial_ struct { +} + +func (_this type_KmsHierarchyWrapKeyMaterial_) Default() interface{} { + return (*KmsHierarchyWrapKeyMaterial)(nil) +} + +func (_this type_KmsHierarchyWrapKeyMaterial_) String() string { + return "AwsKmsHierarchicalKeyring.KmsHierarchyWrapKeyMaterial" +} +func (_this *KmsHierarchyWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &KmsHierarchyWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsHierarchyWrapKeyMaterial{} +var _ m_Actions.Action = &KmsHierarchyWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsHierarchyWrapKeyMaterial{} + +func (_this *KmsHierarchyWrapKeyMaterial) Ctor__(branchKey _dafny.Sequence, branchKeyIdUtf8 _dafny.Sequence, branchKeyVersionAsBytes _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._branchKey = branchKey + (_this)._branchKeyIdUtf8 = branchKeyIdUtf8 + (_this)._branchKeyVersionAsBytes = branchKeyVersionAsBytes + (_this)._crypto = crypto + } +} +func (_this *KmsHierarchyWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_HierarchyWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_maybeNonceSalt m_Wrappers.Result + _ = _1_maybeNonceSalt + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Crypto()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_((Companion_Default___.H__WRAP__SALT__LEN()) + (Companion_Default___.H__WRAP__NONCE__LEN()))) + _1_maybeNonceSalt = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_maybeNonceSalt).MapFailure(func(coer95 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg96 interface{}) interface{} { + return coer95(arg96.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_3_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_saltAndNonce _dafny.Sequence + _ = _4_saltAndNonce + _4_saltAndNonce = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _5_salt _dafny.Sequence + _ = _5_salt + _5_salt = (_4_saltAndNonce).Subsequence(0, uint32(Companion_Default___.H__WRAP__SALT__LEN())) + var _6_nonce _dafny.Sequence + _ = _6_nonce + _6_nonce = (_4_saltAndNonce).Drop(uint32(Companion_Default___.H__WRAP__SALT__LEN())) + var _7_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _7_valueOrError1 + _7_valueOrError1 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_7_valueOrError1).IsFailure() { + res = (_7_valueOrError1).PropagateFailure() + return res + } + var _8_serializedEC _dafny.Sequence + _ = _8_serializedEC + _8_serializedEC = (_7_valueOrError1).Extract().(_dafny.Sequence) + var _9_wrappingAad _dafny.Sequence + _ = _9_wrappingAad + _9_wrappingAad = Companion_Default___.WrappingAad((_this).BranchKeyIdUtf8(), (_this).BranchKeyVersionAsBytes(), _8_serializedEC) + var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _10_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.DeriveEncryptionKeyFromBranchKey((_this).BranchKey(), _5_salt, m_Wrappers.Companion_Option_.Create_Some_(m_Constants.Companion_Default___.PROVIDER__ID__HIERARCHY()), (_this).Crypto()) + _10_valueOrError2 = _out1 + if (_10_valueOrError2).IsFailure() { + res = (_10_valueOrError2).PropagateFailure() + return res + } + var _11_derivedBranchKey _dafny.Sequence + _ = _11_derivedBranchKey + _11_derivedBranchKey = (_10_valueOrError2).Extract().(_dafny.Sequence) + var _12_maybeWrappedPdk m_Wrappers.Result + _ = _12_maybeWrappedPdk + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = ((_this).Crypto()).AESEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_(Companion_Default___.AES__256__ENC__ALG(), _6_nonce, _11_derivedBranchKey, (input).Dtor_plaintextMaterial(), _9_wrappingAad)) + _12_maybeWrappedPdk = _out2 + var _13_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default()) + _ = _13_valueOrError3 + _13_valueOrError3 = (_12_maybeWrappedPdk).MapFailure(func(coer96 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg97 interface{}) interface{} { + return coer96(arg97.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_14_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_14_e) + })) + if (_13_valueOrError3).IsFailure() { + res = (_13_valueOrError3).PropagateFailure() + return res + } + var _15_wrappedPdk m_AwsCryptographyPrimitivesTypes.AESEncryptOutput + _ = _15_wrappedPdk + _15_wrappedPdk = (_13_valueOrError3).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) + var _16_output m_MaterialWrapping.WrapOutput + _ = _16_output + _16_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_5_salt, _6_nonce), (_this).BranchKeyVersionAsBytes()), (_15_wrappedPdk).Dtor_cipherText()), (_15_wrappedPdk).Dtor_authTag()), Companion_HierarchyWrapInfo_.Create_HierarchyWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_16_output) + return res + return res + } +} +func (_this *KmsHierarchyWrapKeyMaterial) BranchKey() _dafny.Sequence { + { + return _this._branchKey + } +} +func (_this *KmsHierarchyWrapKeyMaterial) BranchKeyIdUtf8() _dafny.Sequence { + { + return _this._branchKeyIdUtf8 + } +} +func (_this *KmsHierarchyWrapKeyMaterial) BranchKeyVersionAsBytes() _dafny.Sequence { + { + return _this._branchKeyVersionAsBytes + } +} +func (_this *KmsHierarchyWrapKeyMaterial) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} + +// End of class KmsHierarchyWrapKeyMaterial diff --git a/releases/go/mpl/AwsKmsKeyring/AwsKmsKeyring.go b/releases/go/mpl/AwsKmsKeyring/AwsKmsKeyring.go new file mode 100644 index 000000000..38290127b --- /dev/null +++ b/releases/go/mpl/AwsKmsKeyring/AwsKmsKeyring.go @@ -0,0 +1,1372 @@ +// Package AwsKmsKeyring +// Dafny module AwsKmsKeyring compiled into Go + +package AwsKmsKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ + +type Dummy__ struct{} + +// Definition of class AwsKmsKeyring +type AwsKmsKeyring struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence + _awsKmsArn m_AwsArnParsing.AwsKmsIdentifier +} + +func New_AwsKmsKeyring_() *AwsKmsKeyring { + _this := AwsKmsKeyring{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + _this._awsKmsArn = m_AwsArnParsing.AwsKmsIdentifier{} + return &_this +} + +type CompanionStruct_AwsKmsKeyring_ struct { +} + +var Companion_AwsKmsKeyring_ = CompanionStruct_AwsKmsKeyring_{} + +func (_this *AwsKmsKeyring) Equals(other *AwsKmsKeyring) bool { + return _this == other +} + +func (_this *AwsKmsKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsKeyring) String() string { + return "AwsKmsKeyring.AwsKmsKeyring" +} + +func Type_AwsKmsKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsKeyring_{} +} + +type type_AwsKmsKeyring_ struct { +} + +func (_this type_AwsKmsKeyring_) Default() interface{} { + return (*AwsKmsKeyring)(nil) +} + +func (_this type_AwsKmsKeyring_) String() string { + return "AwsKmsKeyring.AwsKmsKeyring" +} +func (_this *AwsKmsKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsKeyring{} + +func (_this *AwsKmsKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out2 +} +func (_this *AwsKmsKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out2 +} +func (_this *AwsKmsKeyring) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + var _0_parsedAwsKmsId m_Wrappers.Result + _ = _0_parsedAwsKmsId + _0_parsedAwsKmsId = m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(awsKmsKey) + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._awsKmsArn = (_0_parsedAwsKmsId).Dtor_value().(m_AwsArnParsing.AwsKmsIdentifier) + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _2_valueOrError0 + _2_valueOrError0 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_stringifiedEncCtx _dafny.Map + _ = _3_stringifiedEncCtx + _3_stringifiedEncCtx = (_2_valueOrError0).Extract().(_dafny.Map) + var _4_kmsGenerateAndWrap *KmsGenerateAndWrapKeyMaterial + _ = _4_kmsGenerateAndWrap + var _nw0 *KmsGenerateAndWrapKeyMaterial = New_KmsGenerateAndWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _4_kmsGenerateAndWrap = _nw0 + var _5_kmsWrap *KmsWrapKeyMaterial + _ = _5_kmsWrap + var _nw1 *KmsWrapKeyMaterial = New_KmsWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _5_kmsWrap = _nw1 + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_KmsWrapInfo_.Default())) + _ = _6_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_0_materials, _5_kmsWrap, _4_kmsGenerateAndWrap) + _6_valueOrError1 = _out0 + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _7_wrapOutput + _7_wrapOutput = (_6_valueOrError1).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _8_kmsKeyArn _dafny.Sequence + _ = _8_kmsKeyArn + _8_kmsKeyArn = ((_7_wrapOutput).Dtor_wrapInfo().(KmsWrapInfo)).Dtor_kmsKeyArn() + var _9_symmetricSigningKeyList m_Wrappers.Option + _ = _9_symmetricSigningKeyList + if ((_7_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _9_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_7_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _9_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _10_valueOrError2 + _10_valueOrError2 = (m_UTF8.Encode(_8_kmsKeyArn)).MapFailure(func(coer52 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg53 interface{}) interface{} { + return coer52(arg53.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_10_valueOrError2).IsFailure() { + res = (_10_valueOrError2).PropagateFailure() + return res + } + var _11_providerInfo _dafny.Sequence + _ = _11_providerInfo + _11_providerInfo = (_10_valueOrError2).Extract().(_dafny.Sequence) + var _12_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _12_valueOrError3 + _12_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_11_providerInfo).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT16__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS GenerateDataKey: Key ID too long."))) + if (_12_valueOrError3).IsFailure() { + res = (_12_valueOrError3).PropagateFailure() + return res + } + var _13_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _13_edk + _13_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.PROVIDER__ID(), _11_providerInfo, (_7_wrapOutput).Dtor_wrappedMaterial()) + if (_7_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _14_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _14_valueOrError4 + _14_valueOrError4 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_0_materials, (_7_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_13_edk), _9_symmetricSigningKeyList) + if (_14_valueOrError4).IsFailure() { + res = (_14_valueOrError4).PropagateFailure() + return res + } + var _15_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _15_result + _15_result = (_14_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_15_result)) + return res + } else if (_7_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _16_valueOrError5 m_Wrappers.Result = m_Wrappers.Result{} + _ = _16_valueOrError5 + _16_valueOrError5 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_0_materials, _dafny.SeqOf(_13_edk), _9_symmetricSigningKeyList) + if (_16_valueOrError5).IsFailure() { + res = (_16_valueOrError5).PropagateFailure() + return res + } + var _17_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _17_result + _17_result = (_16_valueOrError5).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_17_result)) + return res + } + return res + } +} +func (_this *AwsKmsKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_filter *OnDecryptEncryptedDataKeyFilter + _ = _3_filter + var _nw0 *OnDecryptEncryptedDataKeyFilter = New_OnDecryptEncryptedDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).AwsKmsKey()) + _3_filter = _nw0 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_3_filter, (input).Dtor_encryptedDataKeys()) + _4_valueOrError1 = _out0 + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_edksToAttempt _dafny.Sequence + _ = _5_edksToAttempt + _5_edksToAttempt = (_4_valueOrError1).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_5_edksToAttempt).Cardinality())).Sign() == 0 { + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _6_valueOrError2 + _6_valueOrError2 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _7_errorMessage _dafny.Sequence + _ = _7_errorMessage + _7_errorMessage = (_6_valueOrError2).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_7_errorMessage)) + return res + } + var _8_decryptClosure m_Actions.ActionWithResult + _ = _8_decryptClosure + var _nw1 *DecryptSingleEncryptedDataKey = New_DecryptSingleEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _8_decryptClosure = _nw1 + var _9_outcome m_Wrappers.Result + _ = _9_outcome + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.ReduceToSuccess(_8_decryptClosure, _5_edksToAttempt) + _9_outcome = _out1 + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError3 + _10_valueOrError3 = (_9_outcome).MapFailure(func(coer53 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg54 interface{}) interface{} { + return coer53(arg54.(_dafny.Sequence)) + } + }(func(_11_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_11_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_10_valueOrError3).IsFailure() { + res = (_10_valueOrError3).PropagateFailure() + return res + } + var _12_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _12_SealedDecryptionMaterials + _12_SealedDecryptionMaterials = (_10_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_12_SealedDecryptionMaterials)) + return res + return res + } +} +func (_this *AwsKmsKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsKeyring) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *AwsKmsKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} +func (_this *AwsKmsKeyring) AwsKmsArn() m_AwsArnParsing.AwsKmsIdentifier { + { + return _this._awsKmsArn + } +} + +// End of class AwsKmsKeyring + +// Definition of class OnDecryptEncryptedDataKeyFilter +type OnDecryptEncryptedDataKeyFilter struct { + _awsKmsKey _dafny.Sequence +} + +func New_OnDecryptEncryptedDataKeyFilter_() *OnDecryptEncryptedDataKeyFilter { + _this := OnDecryptEncryptedDataKeyFilter{} + + _this._awsKmsKey = _dafny.EmptySeq.SetString() + return &_this +} + +type CompanionStruct_OnDecryptEncryptedDataKeyFilter_ struct { +} + +var Companion_OnDecryptEncryptedDataKeyFilter_ = CompanionStruct_OnDecryptEncryptedDataKeyFilter_{} + +func (_this *OnDecryptEncryptedDataKeyFilter) Equals(other *OnDecryptEncryptedDataKeyFilter) bool { + return _this == other +} + +func (_this *OnDecryptEncryptedDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OnDecryptEncryptedDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*OnDecryptEncryptedDataKeyFilter) String() string { + return "AwsKmsKeyring.OnDecryptEncryptedDataKeyFilter" +} + +func Type_OnDecryptEncryptedDataKeyFilter_() _dafny.TypeDescriptor { + return type_OnDecryptEncryptedDataKeyFilter_{} +} + +type type_OnDecryptEncryptedDataKeyFilter_ struct { +} + +func (_this type_OnDecryptEncryptedDataKeyFilter_) Default() interface{} { + return (*OnDecryptEncryptedDataKeyFilter)(nil) +} + +func (_this type_OnDecryptEncryptedDataKeyFilter_) String() string { + return "AwsKmsKeyring.OnDecryptEncryptedDataKeyFilter" +} +func (_this *OnDecryptEncryptedDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &OnDecryptEncryptedDataKeyFilter{} +var _ m_Actions.DeterministicAction = &OnDecryptEncryptedDataKeyFilter{} +var _ _dafny.TraitOffspring = &OnDecryptEncryptedDataKeyFilter{} + +func (_this *OnDecryptEncryptedDataKeyFilter) Ctor__(awsKmsKey _dafny.Sequence) { + { + (_this)._awsKmsKey = awsKmsKey + } +} +func (_this *OnDecryptEncryptedDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + if !_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()) { + res = m_Wrappers.Companion_Result_.Create_Success_(false) + return res + } + if !(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo())) { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) + return res + } + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _0_valueOrError0 + _0_valueOrError0 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer54 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg55 interface{}) interface{} { + return coer54(arg55.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_keyId _dafny.Sequence + _ = _1_keyId + _1_keyId = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _2_valueOrError1 + _2_valueOrError1 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_1_keyId)).MapFailure(func(coer55 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg56 interface{}) interface{} { + return coer55(arg56.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_2_valueOrError1).IsFailure() { + res = (_2_valueOrError1).PropagateFailure() + return res + } + var _3___v0 m_AwsArnParsing.AwsArn + _ = _3___v0 + _3___v0 = (_2_valueOrError1).Extract().(m_AwsArnParsing.AwsArn) + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Equal((_this).AwsKmsKey(), _1_keyId)) + return res + return res + } +} +func (_this *OnDecryptEncryptedDataKeyFilter) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} + +// End of class OnDecryptEncryptedDataKeyFilter + +// Definition of class DecryptSingleEncryptedDataKey +type DecryptSingleEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_DecryptSingleEncryptedDataKey_() *DecryptSingleEncryptedDataKey { + _this := DecryptSingleEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_DecryptSingleEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleEncryptedDataKey_ = CompanionStruct_DecryptSingleEncryptedDataKey_{} + +func (_this *DecryptSingleEncryptedDataKey) Equals(other *DecryptSingleEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleEncryptedDataKey) String() string { + return "AwsKmsKeyring.DecryptSingleEncryptedDataKey" +} + +func Type_DecryptSingleEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleEncryptedDataKey_{} +} + +type type_DecryptSingleEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleEncryptedDataKey_) String() string { + return "AwsKmsKeyring.DecryptSingleEncryptedDataKey" +} +func (_this *DecryptSingleEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleEncryptedDataKey{} + +func (_this *DecryptSingleEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._grantTokens = grantTokens + } +} +func (_this *DecryptSingleEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_kmsUnwrap *KmsUnwrapKeyMaterial + _ = _0_kmsUnwrap + var _nw0 *KmsUnwrapKeyMaterial = New_KmsUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _0_kmsUnwrap = _nw0 + var _1_unwrapOutputRes m_Wrappers.Result + _ = _1_unwrapOutputRes + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _0_kmsUnwrap) + _1_unwrapOutputRes = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(Companion_KmsUnwrapInfo_.Default())) + _ = _2_valueOrError0 + _2_valueOrError0 = _1_unwrapOutputRes + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _3_unwrapOutput + _3_unwrapOutput = (_2_valueOrError0).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError1 + _4_valueOrError1 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_3_unwrapOutput).Dtor_plaintextDataKey(), (_3_unwrapOutput).Dtor_symmetricSigningKey()) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _5_result + _5_result = (_4_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_5_result) + return res + return res + } +} +func (_this *DecryptSingleEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleEncryptedDataKey) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *DecryptSingleEncryptedDataKey) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *DecryptSingleEncryptedDataKey) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class DecryptSingleEncryptedDataKey + +// Definition of datatype KmsUnwrapInfo +type KmsUnwrapInfo struct { + Data_KmsUnwrapInfo_ +} + +func (_this KmsUnwrapInfo) Get_() Data_KmsUnwrapInfo_ { + return _this.Data_KmsUnwrapInfo_ +} + +type Data_KmsUnwrapInfo_ interface { + isKmsUnwrapInfo() +} + +type CompanionStruct_KmsUnwrapInfo_ struct { +} + +var Companion_KmsUnwrapInfo_ = CompanionStruct_KmsUnwrapInfo_{} + +type KmsUnwrapInfo_KmsUnwrapInfo struct { +} + +func (KmsUnwrapInfo_KmsUnwrapInfo) isKmsUnwrapInfo() {} + +func (CompanionStruct_KmsUnwrapInfo_) Create_KmsUnwrapInfo_() KmsUnwrapInfo { + return KmsUnwrapInfo{KmsUnwrapInfo_KmsUnwrapInfo{}} +} + +func (_this KmsUnwrapInfo) Is_KmsUnwrapInfo() bool { + _, ok := _this.Get_().(KmsUnwrapInfo_KmsUnwrapInfo) + return ok +} + +func (CompanionStruct_KmsUnwrapInfo_) Default() KmsUnwrapInfo { + return Companion_KmsUnwrapInfo_.Create_KmsUnwrapInfo_() +} + +func (_ CompanionStruct_KmsUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_KmsUnwrapInfo_.Create_KmsUnwrapInfo_(), true + default: + return KmsUnwrapInfo{}, false + } + } +} + +func (_this KmsUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case KmsUnwrapInfo_KmsUnwrapInfo: + { + return "AwsKmsKeyring.KmsUnwrapInfo.KmsUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this KmsUnwrapInfo) Equals(other KmsUnwrapInfo) bool { + switch _this.Get_().(type) { + case KmsUnwrapInfo_KmsUnwrapInfo: + { + _, ok := other.Get_().(KmsUnwrapInfo_KmsUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_KmsUnwrapInfo_() _dafny.TypeDescriptor { + return type_KmsUnwrapInfo_{} +} + +type type_KmsUnwrapInfo_ struct { +} + +func (_this type_KmsUnwrapInfo_) Default() interface{} { + return Companion_KmsUnwrapInfo_.Default() +} + +func (_this type_KmsUnwrapInfo_) String() string { + return "AwsKmsKeyring.KmsUnwrapInfo" +} +func (_this KmsUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsUnwrapInfo{} + +// End of datatype KmsUnwrapInfo + +// Definition of datatype KmsWrapInfo +type KmsWrapInfo struct { + Data_KmsWrapInfo_ +} + +func (_this KmsWrapInfo) Get_() Data_KmsWrapInfo_ { + return _this.Data_KmsWrapInfo_ +} + +type Data_KmsWrapInfo_ interface { + isKmsWrapInfo() +} + +type CompanionStruct_KmsWrapInfo_ struct { +} + +var Companion_KmsWrapInfo_ = CompanionStruct_KmsWrapInfo_{} + +type KmsWrapInfo_KmsWrapInfo struct { + KmsKeyArn _dafny.Sequence +} + +func (KmsWrapInfo_KmsWrapInfo) isKmsWrapInfo() {} + +func (CompanionStruct_KmsWrapInfo_) Create_KmsWrapInfo_(KmsKeyArn _dafny.Sequence) KmsWrapInfo { + return KmsWrapInfo{KmsWrapInfo_KmsWrapInfo{KmsKeyArn}} +} + +func (_this KmsWrapInfo) Is_KmsWrapInfo() bool { + _, ok := _this.Get_().(KmsWrapInfo_KmsWrapInfo) + return ok +} + +func (CompanionStruct_KmsWrapInfo_) Default() KmsWrapInfo { + return Companion_KmsWrapInfo_.Create_KmsWrapInfo_(_dafny.EmptySeq.SetString()) +} + +func (_this KmsWrapInfo) Dtor_kmsKeyArn() _dafny.Sequence { + return _this.Get_().(KmsWrapInfo_KmsWrapInfo).KmsKeyArn +} + +func (_this KmsWrapInfo) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case KmsWrapInfo_KmsWrapInfo: + { + return "AwsKmsKeyring.KmsWrapInfo.KmsWrapInfo" + "(" + _dafny.String(data.KmsKeyArn) + ")" + } + default: + { + return "" + } + } +} + +func (_this KmsWrapInfo) Equals(other KmsWrapInfo) bool { + switch data1 := _this.Get_().(type) { + case KmsWrapInfo_KmsWrapInfo: + { + data2, ok := other.Get_().(KmsWrapInfo_KmsWrapInfo) + return ok && data1.KmsKeyArn.Equals(data2.KmsKeyArn) + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_KmsWrapInfo_() _dafny.TypeDescriptor { + return type_KmsWrapInfo_{} +} + +type type_KmsWrapInfo_ struct { +} + +func (_this type_KmsWrapInfo_) Default() interface{} { + return Companion_KmsWrapInfo_.Default() +} + +func (_this type_KmsWrapInfo_) String() string { + return "AwsKmsKeyring.KmsWrapInfo" +} +func (_this KmsWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsWrapInfo{} + +// End of datatype KmsWrapInfo + +// Definition of class KmsUnwrapKeyMaterial +type KmsUnwrapKeyMaterial struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _grantTokens _dafny.Sequence + _awsKmsKey _dafny.Sequence +} + +func New_KmsUnwrapKeyMaterial_() *KmsUnwrapKeyMaterial { + _this := KmsUnwrapKeyMaterial{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._grantTokens = _dafny.EmptySeq + _this._awsKmsKey = _dafny.EmptySeq.SetString() + return &_this +} + +type CompanionStruct_KmsUnwrapKeyMaterial_ struct { +} + +var Companion_KmsUnwrapKeyMaterial_ = CompanionStruct_KmsUnwrapKeyMaterial_{} + +func (_this *KmsUnwrapKeyMaterial) Equals(other *KmsUnwrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsUnwrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsUnwrapKeyMaterial) String() string { + return "AwsKmsKeyring.KmsUnwrapKeyMaterial" +} + +func Type_KmsUnwrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsUnwrapKeyMaterial_{} +} + +type type_KmsUnwrapKeyMaterial_ struct { +} + +func (_this type_KmsUnwrapKeyMaterial_) Default() interface{} { + return (*KmsUnwrapKeyMaterial)(nil) +} + +func (_this type_KmsUnwrapKeyMaterial_) String() string { + return "AwsKmsKeyring.KmsUnwrapKeyMaterial" +} +func (_this *KmsUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &KmsUnwrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsUnwrapKeyMaterial{} +var _ m_Actions.Action = &KmsUnwrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsUnwrapKeyMaterial{} + +func (_this *KmsUnwrapKeyMaterial) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._grantTokens = grantTokens + } +} +func (_this *KmsUnwrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_KmsUnwrapInfo_.Default())) + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType((input).Dtor_wrappedMaterial()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Ciphertext length invalid"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _1_valueOrError1 + _1_valueOrError1 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext((input).Dtor_encryptionContext()) + if (_1_valueOrError1).IsFailure() { + res = (_1_valueOrError1).PropagateFailure() + return res + } + var _2_stringifiedEncCtx _dafny.Map + _ = _2_stringifiedEncCtx + _2_stringifiedEncCtx = (_1_valueOrError1).Extract().(_dafny.Map) + var _3_decryptRequest m_ComAmazonawsKmsTypes.DecryptRequest + _ = _3_decryptRequest + _3_decryptRequest = m_ComAmazonawsKmsTypes.Companion_DecryptRequest_.Create_DecryptRequest_((input).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_Some_(_2_stringifiedEncCtx), m_Wrappers.Companion_Option_.Create_Some_((_this).GrantTokens()), m_Wrappers.Companion_Option_.Create_Some_((_this).AwsKmsKey()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _4_maybeDecryptResponse m_Wrappers.Result + _ = _4_maybeDecryptResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Client()).Decrypt(_3_decryptRequest) + _4_maybeDecryptResponse = _out0 + var _5_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _5_valueOrError2 + _5_valueOrError2 = (_4_maybeDecryptResponse).MapFailure(func(coer56 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg57 interface{}) interface{} { + return coer56(arg57.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_6_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_6_e) + })) + if (_5_valueOrError2).IsFailure() { + res = (_5_valueOrError2).PropagateFailure() + return res + } + var _7_decryptResponse m_ComAmazonawsKmsTypes.DecryptResponse + _ = _7_decryptResponse + _7_decryptResponse = (_5_valueOrError2).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _8_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError3 + _8_valueOrError3 = m_Wrappers.Companion_Default___.Need((((((_7_decryptResponse).Dtor_KeyId()).Is_Some()) && (_dafny.Companion_Sequence_.Equal(((_7_decryptResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence), (_this).AwsKmsKey()))) && (((_7_decryptResponse).Dtor_Plaintext()).Is_Some())) && ((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))).Cmp(_dafny.IntOfUint32((((_7_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from KMS Decrypt"))) + if (_8_valueOrError3).IsFailure() { + res = (_8_valueOrError3).PropagateFailure() + return res + } + var _9_output m_MaterialWrapping.UnwrapOutput + _ = _9_output + _9_output = m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(((_7_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence), Companion_KmsUnwrapInfo_.Create_KmsUnwrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_9_output) + return res + return res + } +} +func (_this *KmsUnwrapKeyMaterial) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *KmsUnwrapKeyMaterial) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} +func (_this *KmsUnwrapKeyMaterial) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} + +// End of class KmsUnwrapKeyMaterial + +// Definition of class KmsGenerateAndWrapKeyMaterial +type KmsGenerateAndWrapKeyMaterial struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_KmsGenerateAndWrapKeyMaterial_() *KmsGenerateAndWrapKeyMaterial { + _this := KmsGenerateAndWrapKeyMaterial{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_KmsGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_KmsGenerateAndWrapKeyMaterial_ = CompanionStruct_KmsGenerateAndWrapKeyMaterial_{} + +func (_this *KmsGenerateAndWrapKeyMaterial) Equals(other *KmsGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsGenerateAndWrapKeyMaterial) String() string { + return "AwsKmsKeyring.KmsGenerateAndWrapKeyMaterial" +} + +func Type_KmsGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsGenerateAndWrapKeyMaterial_{} +} + +type type_KmsGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_KmsGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*KmsGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_KmsGenerateAndWrapKeyMaterial_) String() string { + return "AwsKmsKeyring.KmsGenerateAndWrapKeyMaterial" +} +func (_this *KmsGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &KmsGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &KmsGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsGenerateAndWrapKeyMaterial{} + +func (_this *KmsGenerateAndWrapKeyMaterial) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._grantTokens = grantTokens + } +} +func (_this *KmsGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_KmsWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _1_valueOrError0 + _1_valueOrError0 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext((input).Dtor_encryptionContext()) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2_stringifiedEncCtx _dafny.Map + _ = _2_stringifiedEncCtx + _2_stringifiedEncCtx = (_1_valueOrError0).Extract().(_dafny.Map) + var _3_generatorRequest m_ComAmazonawsKmsTypes.GenerateDataKeyRequest + _ = _3_generatorRequest + _3_generatorRequest = m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyRequest_.Create_GenerateDataKeyRequest_((_this).AwsKmsKey(), m_Wrappers.Companion_Option_.Create_Some_(_2_stringifiedEncCtx), m_Wrappers.Companion_Option_.Create_Some_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite)), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_((_this).GrantTokens()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _4_maybeGenerateResponse m_Wrappers.Result + _ = _4_maybeGenerateResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Client()).GenerateDataKey(_3_generatorRequest) + _4_maybeGenerateResponse = _out0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyResponse_.Default()) + _ = _5_valueOrError1 + _5_valueOrError1 = (_4_maybeGenerateResponse).MapFailure(func(coer57 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg58 interface{}) interface{} { + return coer57(arg58.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_6_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_6_e) + })) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _7_generateResponse m_ComAmazonawsKmsTypes.GenerateDataKeyResponse + _ = _7_generateResponse + _7_generateResponse = (_5_valueOrError1).Extract().(m_ComAmazonawsKmsTypes.GenerateDataKeyResponse) + var _8_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError2 + _8_valueOrError2 = m_Wrappers.Companion_Default___.Need((((_7_generateResponse).Dtor_KeyId()).Is_Some()) && ((m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(((_7_generateResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence))).Is_Success()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from KMS GenerateDataKey:: Invalid Key Id"))) + if (_8_valueOrError2).IsFailure() { + res = (_8_valueOrError2).PropagateFailure() + return res + } + var _9_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError3 + _9_valueOrError3 = m_Wrappers.Companion_Default___.Need((((_7_generateResponse).Dtor_Plaintext()).Is_Some()) && ((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))).Cmp(_dafny.IntOfUint32((((_7_generateResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS GenerateDataKey: Invalid data key"))) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _10_valueOrError4 + _10_valueOrError4 = m_Wrappers.Companion_Default___.Need((((_7_generateResponse).Dtor_CiphertextBlob()).Is_Some()) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType(((_7_generateResponse).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence))), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS GeneratedDataKey: Invalid ciphertext"))) + if (_10_valueOrError4).IsFailure() { + res = (_10_valueOrError4).PropagateFailure() + return res + } + var _11_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _11_valueOrError5 + _11_valueOrError5 = m_Wrappers.Companion_Default___.Need((true) && (((_7_generateResponse).Dtor_CiphertextForRecipient()).Is_None()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS GeneratedDataKey: Invalid CiphertextForRecipient"))) + if (_11_valueOrError5).IsFailure() { + res = (_11_valueOrError5).PropagateFailure() + return res + } + var _12_output m_MaterialWrapping.GenerateAndWrapOutput + _ = _12_output + _12_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(((_7_generateResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence), ((_7_generateResponse).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence), Companion_KmsWrapInfo_.Create_KmsWrapInfo_(((_7_generateResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence))) + res = m_Wrappers.Companion_Result_.Create_Success_(_12_output) + return res + return res + } +} +func (_this *KmsGenerateAndWrapKeyMaterial) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *KmsGenerateAndWrapKeyMaterial) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *KmsGenerateAndWrapKeyMaterial) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class KmsGenerateAndWrapKeyMaterial + +// Definition of class KmsWrapKeyMaterial +type KmsWrapKeyMaterial struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_KmsWrapKeyMaterial_() *KmsWrapKeyMaterial { + _this := KmsWrapKeyMaterial{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_KmsWrapKeyMaterial_ struct { +} + +var Companion_KmsWrapKeyMaterial_ = CompanionStruct_KmsWrapKeyMaterial_{} + +func (_this *KmsWrapKeyMaterial) Equals(other *KmsWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsWrapKeyMaterial) String() string { + return "AwsKmsKeyring.KmsWrapKeyMaterial" +} + +func Type_KmsWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsWrapKeyMaterial_{} +} + +type type_KmsWrapKeyMaterial_ struct { +} + +func (_this type_KmsWrapKeyMaterial_) Default() interface{} { + return (*KmsWrapKeyMaterial)(nil) +} + +func (_this type_KmsWrapKeyMaterial_) String() string { + return "AwsKmsKeyring.KmsWrapKeyMaterial" +} +func (_this *KmsWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &KmsWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsWrapKeyMaterial{} +var _ m_Actions.Action = &KmsWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsWrapKeyMaterial{} + +func (_this *KmsWrapKeyMaterial) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._grantTokens = grantTokens + } +} +func (_this *KmsWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_KmsWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _1_valueOrError0 + _1_valueOrError0 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext((input).Dtor_encryptionContext()) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2_stringifiedEncCtx _dafny.Map + _ = _2_stringifiedEncCtx + _2_stringifiedEncCtx = (_1_valueOrError0).Extract().(_dafny.Map) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__PlaintextType((input).Dtor_plaintextMaterial()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid Plaintext on KMS Encrypt"))) + if (_3_valueOrError1).IsFailure() { + res = (_3_valueOrError1).PropagateFailure() + return res + } + var _4_encryptRequest m_ComAmazonawsKmsTypes.EncryptRequest + _ = _4_encryptRequest + _4_encryptRequest = m_ComAmazonawsKmsTypes.Companion_EncryptRequest_.Create_EncryptRequest_((_this).AwsKmsKey(), (input).Dtor_plaintextMaterial(), m_Wrappers.Companion_Option_.Create_Some_(_2_stringifiedEncCtx), m_Wrappers.Companion_Option_.Create_Some_((_this).GrantTokens()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _5_maybeEncryptResponse m_Wrappers.Result + _ = _5_maybeEncryptResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Client()).Encrypt(_4_encryptRequest) + _5_maybeEncryptResponse = _out0 + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_EncryptResponse_.Default()) + _ = _6_valueOrError2 + _6_valueOrError2 = (_5_maybeEncryptResponse).MapFailure(func(coer58 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg59 interface{}) interface{} { + return coer58(arg59.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_7_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_7_e) + })) + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _8_encryptResponse m_ComAmazonawsKmsTypes.EncryptResponse + _ = _8_encryptResponse + _8_encryptResponse = (_6_valueOrError2).Extract().(m_ComAmazonawsKmsTypes.EncryptResponse) + var _9_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError3 + _9_valueOrError3 = m_Wrappers.Companion_Default___.Need((((_8_encryptResponse).Dtor_KeyId()).Is_Some()) && ((m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(((_8_encryptResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence))).Is_Success()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS Encrypt:: Invalid Key Id"))) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _10_valueOrError4 + _10_valueOrError4 = m_Wrappers.Companion_Default___.Need(((_8_encryptResponse).Dtor_CiphertextBlob()).Is_Some(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS Encrypt: Invalid Ciphertext Blob"))) + if (_10_valueOrError4).IsFailure() { + res = (_10_valueOrError4).PropagateFailure() + return res + } + var _11_output m_MaterialWrapping.WrapOutput + _ = _11_output + _11_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(((_8_encryptResponse).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence), Companion_KmsWrapInfo_.Create_KmsWrapInfo_(((_8_encryptResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence))) + res = m_Wrappers.Companion_Result_.Create_Success_(_11_output) + return res + return res + } +} +func (_this *KmsWrapKeyMaterial) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *KmsWrapKeyMaterial) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *KmsWrapKeyMaterial) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class KmsWrapKeyMaterial diff --git a/releases/go/mpl/AwsKmsMrkAreUnique/AwsKmsMrkAreUnique.go b/releases/go/mpl/AwsKmsMrkAreUnique/AwsKmsMrkAreUnique.go new file mode 100644 index 000000000..0fe84ba4f --- /dev/null +++ b/releases/go/mpl/AwsKmsMrkAreUnique/AwsKmsMrkAreUnique.go @@ -0,0 +1,274 @@ +// Package AwsKmsMrkAreUnique +// Dafny module AwsKmsMrkAreUnique compiled into Go + +package AwsKmsMrkAreUnique + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsMrkAreUnique.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) AwsKmsMrkAreUnique(identifiers _dafny.Sequence) m_Wrappers.Outcome { + var _0_mrks _dafny.Sequence = m_Seq.Companion_Default___.Filter(func(coer32 func(m_AwsArnParsing.AwsKmsIdentifier) bool) func(interface{}) bool { + return func(arg32 interface{}) bool { + return coer32(arg32.(m_AwsArnParsing.AwsKmsIdentifier)) + } + }(m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsIdentifier), identifiers) + _ = _0_mrks + if (_dafny.IntOfUint32((_0_mrks).Cardinality())).Sign() == 0 { + return m_Wrappers.Companion_Outcome_.Create_Pass_() + } else { + var _1_mrkKeyIds _dafny.Sequence = m_Seq.Companion_Default___.Map(func(coer33 func(m_AwsArnParsing.AwsKmsIdentifier) _dafny.Sequence) func(interface{}) interface{} { + return func(arg33 interface{}) interface{} { + return coer33(arg33.(m_AwsArnParsing.AwsKmsIdentifier)) + } + }(Companion_Default___.GetKeyId), _0_mrks) + _ = _1_mrkKeyIds + var _2_setMrks _dafny.Set = m_Seq.Companion_Default___.ToSet(_1_mrkKeyIds) + _ = _2_setMrks + if (_dafny.IntOfUint32((_1_mrkKeyIds).Cardinality())).Cmp((_2_setMrks).Cardinality()) == 0 { + return m_Wrappers.Companion_Outcome_.Create_Pass_() + } else { + var _3_duplicateMrkIds _dafny.Set = func() _dafny.Set { + var _coll0 = _dafny.NewBuilder() + _ = _coll0 + for _iter9 := _dafny.Iterate((_1_mrkKeyIds).Elements()); ; { + _compr_0, _ok9 := _iter9() + if !_ok9 { + break + } + var _4_x _dafny.Sequence + _4_x = interface{}(_compr_0).(_dafny.Sequence) + if (_dafny.Companion_Sequence_.Contains(_1_mrkKeyIds, _4_x)) && (((_dafny.MultiSetFromSeq(_1_mrkKeyIds)).Multiplicity(_4_x)).Cmp(_dafny.One) >= 0) { + _coll0.Add(_4_x) + } + } + return _coll0.ToSet() + }() + _ = _3_duplicateMrkIds + var _5_isDuplicate func(m_AwsArnParsing.AwsKmsIdentifier) bool = (func(_6_duplicateMrkIds _dafny.Set) func(m_AwsArnParsing.AwsKmsIdentifier) bool { + return func(_7_identifier m_AwsArnParsing.AwsKmsIdentifier) bool { + return (_6_duplicateMrkIds).Contains(Companion_Default___.GetKeyId(_7_identifier)) + } + })(_3_duplicateMrkIds) + _ = _5_isDuplicate + var _8_identifierToString func(m_AwsArnParsing.AwsKmsIdentifier) _dafny.Sequence = func(_9_i m_AwsArnParsing.AwsKmsIdentifier) _dafny.Sequence { + return (_9_i).ToString() + } + _ = _8_identifierToString + var _10_duplicateIdentifiers _dafny.Sequence = m_Seq.Companion_Default___.Filter(func(coer34 func(m_AwsArnParsing.AwsKmsIdentifier) bool) func(interface{}) bool { + return func(arg34 interface{}) bool { + return coer34(arg34.(m_AwsArnParsing.AwsKmsIdentifier)) + } + }(_5_isDuplicate), identifiers) + _ = _10_duplicateIdentifiers + var _11_duplicates _dafny.Sequence = m_Seq.Companion_Default___.Map(func(coer35 func(m_AwsArnParsing.AwsKmsIdentifier) _dafny.Sequence) func(interface{}) interface{} { + return func(arg35 interface{}) interface{} { + return coer35(arg35.(m_AwsArnParsing.AwsKmsIdentifier)) + } + }(_8_identifierToString), _10_duplicateIdentifiers) + _ = _11_duplicates + if (_dafny.IntOfUint32((_11_duplicates).Cardinality())).Sign() == 0 { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Impossible"))) + } else { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Related multi-Region keys: "), m_StandardLibrary.Companion_Default___.Join(_11_duplicates, _dafny.SeqOfString(","))), _dafny.SeqOfString("are not allowed.")))) + } + } + } +} +func (_static *CompanionStruct_Default___) GetKeyId(identifier m_AwsArnParsing.AwsKmsIdentifier) _dafny.Sequence { + var _source0 m_AwsArnParsing.AwsKmsIdentifier = identifier + _ = _source0 + { + if _source0.Is_AwsKmsArnIdentifier() { + var _0_a m_AwsArnParsing.AwsArn = _source0.Get_().(m_AwsArnParsing.AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _0_a + return ((_0_a).Dtor_resource()).Dtor_value() + } + } + { + var _1_i m_AwsArnParsing.AwsResource = _source0.Get_().(m_AwsArnParsing.AwsKmsIdentifier_AwsKmsRawResourceIdentifier).R + _ = _1_i + return (_1_i).Dtor_value() + } +} + +// End of class Default__ diff --git a/releases/go/mpl/AwsKmsMrkDiscoveryKeyring/AwsKmsMrkDiscoveryKeyring.go b/releases/go/mpl/AwsKmsMrkDiscoveryKeyring/AwsKmsMrkDiscoveryKeyring.go new file mode 100644 index 000000000..bbf01fa06 --- /dev/null +++ b/releases/go/mpl/AwsKmsMrkDiscoveryKeyring/AwsKmsMrkDiscoveryKeyring.go @@ -0,0 +1,711 @@ +// Package AwsKmsMrkDiscoveryKeyring +// Dafny module AwsKmsMrkDiscoveryKeyring compiled into Go + +package AwsKmsMrkDiscoveryKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsMrkDiscoveryKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ToStringForRegion(arn m_AwsArnParsing.AwsArn, region _dafny.Sequence) _dafny.Sequence { + if m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsArn(arn) { + return (arn).ToArnString(m_Wrappers.Companion_Option_.Create_Some_(region)) + } else { + return (arn).ToString() + } +} +func (_static *CompanionStruct_Default___) DiscoveryMatch(arn m_AwsArnParsing.AwsArn, discoveryFilter m_Wrappers.Option, region _dafny.Sequence) bool { + return (func() bool { + var _source0 m_Wrappers.Option = discoveryFilter + _ = _source0 + { + if _source0.Is_Some() { + var _0_filter m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter = _source0.Get_().(m_Wrappers.Option_Some).Value.(m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter) + _ = _0_filter + return (_dafny.Companion_Sequence_.Equal((_0_filter).Dtor_partition(), (arn).Dtor_partition())) && (_dafny.Companion_Sequence_.Contains((_0_filter).Dtor_accountIds(), (arn).Dtor_account())) + } + } + { + return true + } + }()) && ((func() bool { + if !(m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsArn(arn)) { + return _dafny.Companion_Sequence_.Equal(region, (arn).Dtor_region()) + } + return true + })()) +} + +// End of class Default__ + +// Definition of class AwsKmsMrkDiscoveryKeyring +type AwsKmsMrkDiscoveryKeyring struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _region _dafny.Sequence + _discoveryFilter m_Wrappers.Option + _grantTokens _dafny.Sequence +} + +func New_AwsKmsMrkDiscoveryKeyring_() *AwsKmsMrkDiscoveryKeyring { + _this := AwsKmsMrkDiscoveryKeyring{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._region = _dafny.EmptySeq.SetString() + _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsMrkDiscoveryKeyring_ struct { +} + +var Companion_AwsKmsMrkDiscoveryKeyring_ = CompanionStruct_AwsKmsMrkDiscoveryKeyring_{} + +func (_this *AwsKmsMrkDiscoveryKeyring) Equals(other *AwsKmsMrkDiscoveryKeyring) bool { + return _this == other +} + +func (_this *AwsKmsMrkDiscoveryKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsMrkDiscoveryKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsMrkDiscoveryKeyring) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring" +} + +func Type_AwsKmsMrkDiscoveryKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsMrkDiscoveryKeyring_{} +} + +type type_AwsKmsMrkDiscoveryKeyring_ struct { +} + +func (_this type_AwsKmsMrkDiscoveryKeyring_) Default() interface{} { + return (*AwsKmsMrkDiscoveryKeyring)(nil) +} + +func (_this type_AwsKmsMrkDiscoveryKeyring_) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring" +} +func (_this *AwsKmsMrkDiscoveryKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsMrkDiscoveryKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsMrkDiscoveryKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsMrkDiscoveryKeyring{} + +func (_this *AwsKmsMrkDiscoveryKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out4 +} +func (_this *AwsKmsMrkDiscoveryKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out4 +} +func (_this *AwsKmsMrkDiscoveryKeyring) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, region _dafny.Sequence, discoveryFilter m_Wrappers.Option, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._region = region + (_this)._discoveryFilter = discoveryFilter + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption is not supported with a Discovery Keyring."))) + return output + return output + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_encryptedDataKeys _dafny.Sequence + _ = _1_encryptedDataKeys + _1_encryptedDataKeys = (input).Dtor_encryptedDataKeys() + var _2_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _2_suite + _2_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError0 + _3_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _4_edkFilterTransform *AwsKmsEncryptedDataKeyFilterTransform + _ = _4_edkFilterTransform + var _nw0 *AwsKmsEncryptedDataKeyFilterTransform = New_AwsKmsEncryptedDataKeyFilterTransform_() + _ = _nw0 + _nw0.Ctor__((_this).Region(), (_this).DiscoveryFilter()) + _4_edkFilterTransform = _nw0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.DeterministicFlatMapWithResult(_4_edkFilterTransform, _1_encryptedDataKeys) + _5_valueOrError1 = _out0 + if (_5_valueOrError1).IsFailure() { + output = (_5_valueOrError1).PropagateFailure() + return output + } + var _6_edksToAttempt _dafny.Sequence + _ = _6_edksToAttempt + _6_edksToAttempt = (_5_valueOrError1).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_6_edksToAttempt).Cardinality())).Sign() == 0 { + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _7_valueOrError2 + _7_valueOrError2 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + var _8_errorMessage _dafny.Sequence + _ = _8_errorMessage + _8_errorMessage = (_7_valueOrError2).Extract().(_dafny.Sequence) + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_8_errorMessage)) + return output + } + var _9_decryptAction *AwsKmsEncryptedDataKeyDecryptor + _ = _9_decryptAction + var _nw1 *AwsKmsEncryptedDataKeyDecryptor = New_AwsKmsEncryptedDataKeyDecryptor_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).Client(), (_this).Region(), (_this).GrantTokens()) + _9_decryptAction = _nw1 + var _10_outcome m_Wrappers.Result + _ = _10_outcome + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.ReduceToSuccess(_9_decryptAction, _6_edksToAttempt) + _10_outcome = _out1 + var _source0 m_Wrappers.Result = _10_outcome + _ = _source0 + { + { + if _source0.Is_Success() { + var _11_mat m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = _source0.Get_().(m_Wrappers.Result_Success).Value.(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + _ = _11_mat + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_11_mat)) + goto Lmatch0 + } + } + { + var _12_errors _dafny.Sequence = _source0.Get_().(m_Wrappers.Result_Failure).Error.(_dafny.Sequence) + _ = _12_errors + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_12_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`."))) + } + goto Lmatch0 + } + Lmatch0: + return output + return output + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) Region() _dafny.Sequence { + { + return _this._region + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) DiscoveryFilter() m_Wrappers.Option { + { + return _this._discoveryFilter + } +} +func (_this *AwsKmsMrkDiscoveryKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class AwsKmsMrkDiscoveryKeyring + +// Definition of class AwsKmsEncryptedDataKeyFilterTransform +type AwsKmsEncryptedDataKeyFilterTransform struct { + _region _dafny.Sequence + _discoveryFilter m_Wrappers.Option +} + +func New_AwsKmsEncryptedDataKeyFilterTransform_() *AwsKmsEncryptedDataKeyFilterTransform { + _this := AwsKmsEncryptedDataKeyFilterTransform{} + + _this._region = _dafny.EmptySeq.SetString() + _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKeyFilterTransform_ struct { +} + +var Companion_AwsKmsEncryptedDataKeyFilterTransform_ = CompanionStruct_AwsKmsEncryptedDataKeyFilterTransform_{} + +func (_this *AwsKmsEncryptedDataKeyFilterTransform) Equals(other *AwsKmsEncryptedDataKeyFilterTransform) bool { + return _this == other +} + +func (_this *AwsKmsEncryptedDataKeyFilterTransform) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEncryptedDataKeyFilterTransform) + return ok && _this.Equals(other) +} + +func (*AwsKmsEncryptedDataKeyFilterTransform) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsEncryptedDataKeyFilterTransform" +} + +func Type_AwsKmsEncryptedDataKeyFilterTransform_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKeyFilterTransform_{} +} + +type type_AwsKmsEncryptedDataKeyFilterTransform_ struct { +} + +func (_this type_AwsKmsEncryptedDataKeyFilterTransform_) Default() interface{} { + return (*AwsKmsEncryptedDataKeyFilterTransform)(nil) +} + +func (_this type_AwsKmsEncryptedDataKeyFilterTransform_) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsEncryptedDataKeyFilterTransform" +} +func (_this *AwsKmsEncryptedDataKeyFilterTransform) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &AwsKmsEncryptedDataKeyFilterTransform{} +var _ m_Actions.DeterministicAction = &AwsKmsEncryptedDataKeyFilterTransform{} +var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyFilterTransform{} + +func (_this *AwsKmsEncryptedDataKeyFilterTransform) Ctor__(region _dafny.Sequence, discoveryFilter m_Wrappers.Option) { + { + (_this)._region = region + (_this)._discoveryFilter = discoveryFilter + } +} +func (_this *AwsKmsEncryptedDataKeyFilterTransform) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + if !_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()) { + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf()) + return res + } + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _1_valueOrError1 + _1_valueOrError1 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer67 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg68 interface{}) interface{} { + return coer67(arg68.(_dafny.Sequence)) + } + }(func(_2_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_2_e) + })) + if (_1_valueOrError1).IsFailure() { + res = (_1_valueOrError1).PropagateFailure() + return res + } + var _3_keyId _dafny.Sequence + _ = _3_keyId + _3_keyId = (_1_valueOrError1).Extract().(_dafny.Sequence) + var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError2 + _4_valueOrError2 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_3_keyId)).MapFailure(func(coer68 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg69 interface{}) interface{} { + return coer68(arg69.(_dafny.Sequence)) + } + }(func(_5_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_5_e) + })) + if (_4_valueOrError2).IsFailure() { + res = (_4_valueOrError2).PropagateFailure() + return res + } + var _6_arn m_AwsArnParsing.AwsArn + _ = _6_arn + _6_arn = (_4_valueOrError2).Extract().(m_AwsArnParsing.AwsArn) + var _7_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError3 + _7_valueOrError3 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(((_6_arn).Dtor_resource()).Dtor_resourceType(), _dafny.SeqOfString("key")), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Only AWS KMS Keys supported"))) + if (_7_valueOrError3).IsFailure() { + res = (_7_valueOrError3).PropagateFailure() + return res + } + if !(Companion_Default___.DiscoveryMatch(_6_arn, (_this).DiscoveryFilter(), (_this).Region())) { + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf()) + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf(m_Constants.Companion_AwsKmsEdkHelper_.Create_AwsKmsEdkHelper_(edk, _6_arn))) + return res + return res + } +} +func (_this *AwsKmsEncryptedDataKeyFilterTransform) Region() _dafny.Sequence { + { + return _this._region + } +} +func (_this *AwsKmsEncryptedDataKeyFilterTransform) DiscoveryFilter() m_Wrappers.Option { + { + return _this._discoveryFilter + } +} + +// End of class AwsKmsEncryptedDataKeyFilterTransform + +// Definition of class AwsKmsEncryptedDataKeyDecryptor +type AwsKmsEncryptedDataKeyDecryptor struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _client m_ComAmazonawsKmsTypes.IKMSClient + _region _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_AwsKmsEncryptedDataKeyDecryptor_() *AwsKmsEncryptedDataKeyDecryptor { + _this := AwsKmsEncryptedDataKeyDecryptor{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._region = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_ struct { +} + +var Companion_AwsKmsEncryptedDataKeyDecryptor_ = CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_{} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) Equals(other *AwsKmsEncryptedDataKeyDecryptor) bool { + return _this == other +} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsEncryptedDataKeyDecryptor) + return ok && _this.Equals(other) +} + +func (*AwsKmsEncryptedDataKeyDecryptor) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" +} + +func Type_AwsKmsEncryptedDataKeyDecryptor_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKeyDecryptor_{} +} + +type type_AwsKmsEncryptedDataKeyDecryptor_ struct { +} + +func (_this type_AwsKmsEncryptedDataKeyDecryptor_) Default() interface{} { + return (*AwsKmsEncryptedDataKeyDecryptor)(nil) +} + +func (_this type_AwsKmsEncryptedDataKeyDecryptor_) String() string { + return "AwsKmsMrkDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &AwsKmsEncryptedDataKeyDecryptor{} +var _ m_Actions.Action = &AwsKmsEncryptedDataKeyDecryptor{} +var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyDecryptor{} + +func (_this *AwsKmsEncryptedDataKeyDecryptor) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, region _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._client = client + (_this)._region = region + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Invoke(helper interface{}) interface{} { + { + var helper m_Constants.AwsKmsEdkHelper = helper.(m_Constants.AwsKmsEdkHelper) + _ = helper + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_awsKmsKey _dafny.Sequence + _ = _0_awsKmsKey + _0_awsKmsKey = Companion_Default___.ToStringForRegion((helper).Dtor_arn(), (_this).Region()) + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _1_valueOrError0 + _1_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId(_0_awsKmsKey) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2___v0 _dafny.Tuple + _ = _2___v0 + _2___v0 = (_1_valueOrError0).Extract().(_dafny.Tuple) + var _3_kmsUnwrap *m_AwsKmsKeyring.KmsUnwrapKeyMaterial + _ = _3_kmsUnwrap + var _nw0 *m_AwsKmsKeyring.KmsUnwrapKeyMaterial = m_AwsKmsKeyring.New_KmsUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), _0_awsKmsKey, (_this).GrantTokens()) + _3_kmsUnwrap = _nw0 + var _4_unwrapOutputRes m_Wrappers.Result + _ = _4_unwrapOutputRes + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial(((helper).Dtor_edk()).Dtor_ciphertext(), (_this).Materials(), _3_kmsUnwrap) + _4_unwrapOutputRes = _out0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_AwsKmsKeyring.Companion_KmsUnwrapInfo_.Default())) + _ = _5_valueOrError1 + _5_valueOrError1 = _4_unwrapOutputRes + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _6_unwrapOutput + _6_unwrapOutput = (_5_valueOrError1).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + res = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_6_unwrapOutput).Dtor_plaintextDataKey(), (_6_unwrapOutput).Dtor_symmetricSigningKey()) + return res + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) Region() _dafny.Sequence { + { + return _this._region + } +} +func (_this *AwsKmsEncryptedDataKeyDecryptor) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class AwsKmsEncryptedDataKeyDecryptor diff --git a/releases/go/mpl/AwsKmsMrkKeyring/AwsKmsMrkKeyring.go b/releases/go/mpl/AwsKmsMrkKeyring/AwsKmsMrkKeyring.go new file mode 100644 index 000000000..c95a68abe --- /dev/null +++ b/releases/go/mpl/AwsKmsMrkKeyring/AwsKmsMrkKeyring.go @@ -0,0 +1,608 @@ +// Package AwsKmsMrkKeyring +// Dafny module AwsKmsMrkKeyring compiled into Go + +package AwsKmsMrkKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class AwsKmsMrkKeyring +type AwsKmsMrkKeyring struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence + _awsKmsArn m_AwsArnParsing.AwsKmsIdentifier +} + +func New_AwsKmsMrkKeyring_() *AwsKmsMrkKeyring { + _this := AwsKmsMrkKeyring{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + _this._awsKmsArn = m_AwsArnParsing.AwsKmsIdentifier{} + return &_this +} + +type CompanionStruct_AwsKmsMrkKeyring_ struct { +} + +var Companion_AwsKmsMrkKeyring_ = CompanionStruct_AwsKmsMrkKeyring_{} + +func (_this *AwsKmsMrkKeyring) Equals(other *AwsKmsMrkKeyring) bool { + return _this == other +} + +func (_this *AwsKmsMrkKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsMrkKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsMrkKeyring) String() string { + return "AwsKmsMrkKeyring.AwsKmsMrkKeyring" +} + +func Type_AwsKmsMrkKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsMrkKeyring_{} +} + +type type_AwsKmsMrkKeyring_ struct { +} + +func (_this type_AwsKmsMrkKeyring_) Default() interface{} { + return (*AwsKmsMrkKeyring)(nil) +} + +func (_this type_AwsKmsMrkKeyring_) String() string { + return "AwsKmsMrkKeyring.AwsKmsMrkKeyring" +} +func (_this *AwsKmsMrkKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsMrkKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsMrkKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsMrkKeyring{} + +func (_this *AwsKmsMrkKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out5 +} +func (_this *AwsKmsMrkKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out5 +} +func (_this *AwsKmsMrkKeyring) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + var _0_parsedAwsKmsId m_Wrappers.Result + _ = _0_parsedAwsKmsId + _0_parsedAwsKmsId = m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(awsKmsKey) + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._awsKmsArn = (_0_parsedAwsKmsId).Dtor_value().(m_AwsArnParsing.AwsKmsIdentifier) + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsMrkKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptyMap) + _ = _2_valueOrError0 + _2_valueOrError0 = m_AwsKmsUtils.Companion_Default___.StringifyEncryptionContext(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_2_valueOrError0).IsFailure() { + output = (_2_valueOrError0).PropagateFailure() + return output + } + var _3_stringifiedEncCtx _dafny.Map + _ = _3_stringifiedEncCtx + _3_stringifiedEncCtx = (_2_valueOrError0).Extract().(_dafny.Map) + var _4_kmsGenerateAndWrap *m_AwsKmsKeyring.KmsGenerateAndWrapKeyMaterial + _ = _4_kmsGenerateAndWrap + var _nw0 *m_AwsKmsKeyring.KmsGenerateAndWrapKeyMaterial = m_AwsKmsKeyring.New_KmsGenerateAndWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _4_kmsGenerateAndWrap = _nw0 + var _5_kmsWrap *m_AwsKmsKeyring.KmsWrapKeyMaterial + _ = _5_kmsWrap + var _nw1 *m_AwsKmsKeyring.KmsWrapKeyMaterial = m_AwsKmsKeyring.New_KmsWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _5_kmsWrap = _nw1 + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(m_AwsKmsKeyring.Companion_KmsWrapInfo_.Default())) + _ = _6_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_0_materials, _5_kmsWrap, _4_kmsGenerateAndWrap) + _6_valueOrError1 = _out0 + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _7_wrapOutput + _7_wrapOutput = (_6_valueOrError1).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _8_kmsKeyArn _dafny.Sequence + _ = _8_kmsKeyArn + _8_kmsKeyArn = ((_7_wrapOutput).Dtor_wrapInfo().(m_AwsKmsKeyring.KmsWrapInfo)).Dtor_kmsKeyArn() + var _9_symmetricSigningKeyList m_Wrappers.Option + _ = _9_symmetricSigningKeyList + if ((_7_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _9_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_7_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _9_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _10_valueOrError2 + _10_valueOrError2 = (m_UTF8.Encode(_8_kmsKeyArn)).MapFailure(func(coer69 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg70 interface{}) interface{} { + return coer69(arg70.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_10_valueOrError2).IsFailure() { + output = (_10_valueOrError2).PropagateFailure() + return output + } + var _11_providerInfo _dafny.Sequence + _ = _11_providerInfo + _11_providerInfo = (_10_valueOrError2).Extract().(_dafny.Sequence) + var _12_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _12_valueOrError3 + _12_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_11_providerInfo).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT16__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from AWS KMS GenerateDataKey: Key ID too long."))) + if (_12_valueOrError3).IsFailure() { + output = (_12_valueOrError3).PropagateFailure() + return output + } + var _13_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _13_edk + _13_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.PROVIDER__ID(), _11_providerInfo, (_7_wrapOutput).Dtor_wrappedMaterial()) + if (_7_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _14_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _14_valueOrError4 + _14_valueOrError4 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_0_materials, (_7_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_13_edk), _9_symmetricSigningKeyList) + if (_14_valueOrError4).IsFailure() { + output = (_14_valueOrError4).PropagateFailure() + return output + } + var _15_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _15_result + _15_result = (_14_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_15_result)) + return output + } else if (_7_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _16_valueOrError5 m_Wrappers.Result = m_Wrappers.Result{} + _ = _16_valueOrError5 + _16_valueOrError5 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_0_materials, _dafny.SeqOf(_13_edk), _9_symmetricSigningKeyList) + if (_16_valueOrError5).IsFailure() { + output = (_16_valueOrError5).PropagateFailure() + return output + } + var _17_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _17_result + _17_result = (_16_valueOrError5).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_17_result)) + return output + } + return output + } +} +func (_this *AwsKmsMrkKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError0).IsFailure() { + output = (_2_valueOrError0).PropagateFailure() + return output + } + var _3_filter *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter + _ = _3_filter + var _nw0 *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter = m_AwsKmsUtils.New_OnDecryptMrkAwareEncryptedDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).AwsKmsArn(), m_Constants.Companion_Default___.PROVIDER__ID()) + _3_filter = _nw0 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_3_filter, (input).Dtor_encryptedDataKeys()) + _4_valueOrError1 = _out0 + if (_4_valueOrError1).IsFailure() { + output = (_4_valueOrError1).PropagateFailure() + return output + } + var _5_edksToAttempt _dafny.Sequence + _ = _5_edksToAttempt + _5_edksToAttempt = (_4_valueOrError1).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_5_edksToAttempt).Cardinality())).Sign() == 0 { + var _6_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _6_valueOrError2 + _6_valueOrError2 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_6_valueOrError2).IsFailure() { + output = (_6_valueOrError2).PropagateFailure() + return output + } + var _7_errorMessage _dafny.Sequence + _ = _7_errorMessage + _7_errorMessage = (_6_valueOrError2).Extract().(_dafny.Sequence) + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_7_errorMessage)) + return output + } + var _8_decryptClosure *DecryptSingleEncryptedDataKey + _ = _8_decryptClosure + var _nw1 *DecryptSingleEncryptedDataKey = New_DecryptSingleEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _8_decryptClosure = _nw1 + var _9_outcome m_Wrappers.Result + _ = _9_outcome + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.ReduceToSuccess(_8_decryptClosure, _5_edksToAttempt) + _9_outcome = _out1 + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError3 + _10_valueOrError3 = (_9_outcome).MapFailure(func(coer70 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg71 interface{}) interface{} { + return coer70(arg71.(_dafny.Sequence)) + } + }(func(_11_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_11_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_10_valueOrError3).IsFailure() { + output = (_10_valueOrError3).PropagateFailure() + return output + } + var _12_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _12_SealedDecryptionMaterials + _12_SealedDecryptionMaterials = (_10_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_12_SealedDecryptionMaterials)) + return output + return output + } +} +func (_this *AwsKmsMrkKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *AwsKmsMrkKeyring) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *AwsKmsMrkKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} +func (_this *AwsKmsMrkKeyring) AwsKmsArn() m_AwsArnParsing.AwsKmsIdentifier { + { + return _this._awsKmsArn + } +} + +// End of class AwsKmsMrkKeyring + +// Definition of class DecryptSingleEncryptedDataKey +type DecryptSingleEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_DecryptSingleEncryptedDataKey_() *DecryptSingleEncryptedDataKey { + _this := DecryptSingleEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_DecryptSingleEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleEncryptedDataKey_ = CompanionStruct_DecryptSingleEncryptedDataKey_{} + +func (_this *DecryptSingleEncryptedDataKey) Equals(other *DecryptSingleEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleEncryptedDataKey) String() string { + return "AwsKmsMrkKeyring.DecryptSingleEncryptedDataKey" +} + +func Type_DecryptSingleEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleEncryptedDataKey_{} +} + +type type_DecryptSingleEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleEncryptedDataKey_) String() string { + return "AwsKmsMrkKeyring.DecryptSingleEncryptedDataKey" +} +func (_this *DecryptSingleEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleEncryptedDataKey{} + +func (_this *DecryptSingleEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._grantTokens = grantTokens + } +} +func (_this *DecryptSingleEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_kmsUnwrap *m_AwsKmsKeyring.KmsUnwrapKeyMaterial + _ = _0_kmsUnwrap + var _nw0 *m_AwsKmsKeyring.KmsUnwrapKeyMaterial = m_AwsKmsKeyring.New_KmsUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).GrantTokens()) + _0_kmsUnwrap = _nw0 + var _1_unwrapOutputRes m_Wrappers.Result + _ = _1_unwrapOutputRes + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _0_kmsUnwrap) + _1_unwrapOutputRes = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_AwsKmsKeyring.Companion_KmsUnwrapInfo_.Default())) + _ = _2_valueOrError0 + _2_valueOrError0 = _1_unwrapOutputRes + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _3_unwrapOutput + _3_unwrapOutput = (_2_valueOrError0).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError1 + _4_valueOrError1 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_3_unwrapOutput).Dtor_plaintextDataKey(), (_3_unwrapOutput).Dtor_symmetricSigningKey()) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _5_result + _5_result = (_4_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_5_result) + return res + return res + } +} +func (_this *DecryptSingleEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleEncryptedDataKey) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *DecryptSingleEncryptedDataKey) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *DecryptSingleEncryptedDataKey) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class DecryptSingleEncryptedDataKey diff --git a/releases/go/mpl/AwsKmsMrkMatchForDecrypt/AwsKmsMrkMatchForDecrypt.go b/releases/go/mpl/AwsKmsMrkMatchForDecrypt/AwsKmsMrkMatchForDecrypt.go new file mode 100644 index 000000000..4b1f72300 --- /dev/null +++ b/releases/go/mpl/AwsKmsMrkMatchForDecrypt/AwsKmsMrkMatchForDecrypt.go @@ -0,0 +1,184 @@ +// Package AwsKmsMrkMatchForDecrypt +// Dafny module AwsKmsMrkMatchForDecrypt compiled into Go + +package AwsKmsMrkMatchForDecrypt + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsMrkMatchForDecrypt.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) AwsKmsMrkMatchForDecrypt(configuredAwsKmsIdentifier m_AwsArnParsing.AwsKmsIdentifier, messageAwsKmsIdentifer m_AwsArnParsing.AwsKmsIdentifier) bool { + if (configuredAwsKmsIdentifier).Equals(messageAwsKmsIdentifer) { + return true + } else { + var _source0 _dafny.Tuple = _dafny.TupleOf(messageAwsKmsIdentifer, configuredAwsKmsIdentifier) + _ = _source0 + { + var _00 m_AwsArnParsing.AwsKmsIdentifier = (*(_source0).IndexInt(0)).(m_AwsArnParsing.AwsKmsIdentifier) + _ = _00 + if _00.Is_AwsKmsArnIdentifier() { + var _0_configuredAwsKmsArn m_AwsArnParsing.AwsArn = _00.Get_().(m_AwsArnParsing.AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _0_configuredAwsKmsArn + var _10 m_AwsArnParsing.AwsKmsIdentifier = (*(_source0).IndexInt(1)).(m_AwsArnParsing.AwsKmsIdentifier) + _ = _10 + if _10.Is_AwsKmsArnIdentifier() { + var _1_messageAwsKmsArn m_AwsArnParsing.AwsArn = _10.Get_().(m_AwsArnParsing.AwsKmsIdentifier_AwsKmsArnIdentifier).A + _ = _1_messageAwsKmsArn + if (!(m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsArn(_0_configuredAwsKmsArn))) || (!(m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsArn(_1_messageAwsKmsArn))) { + return false + } else { + return (((_dafny.Companion_Sequence_.Equal((_1_messageAwsKmsArn).Dtor_partition(), (_0_configuredAwsKmsArn).Dtor_partition())) && (_dafny.Companion_Sequence_.Equal((_1_messageAwsKmsArn).Dtor_service(), (_0_configuredAwsKmsArn).Dtor_service()))) && (_dafny.Companion_Sequence_.Equal((_1_messageAwsKmsArn).Dtor_account(), (_0_configuredAwsKmsArn).Dtor_account()))) && (((_1_messageAwsKmsArn).Dtor_resource()).Equals((_0_configuredAwsKmsArn).Dtor_resource())) + } + } + } + } + { + return false + } + } +} + +// End of class Default__ diff --git a/releases/go/mpl/AwsKmsRsaKeyring/AwsKmsRsaKeyring.go b/releases/go/mpl/AwsKmsRsaKeyring/AwsKmsRsaKeyring.go new file mode 100644 index 000000000..e43f0cf45 --- /dev/null +++ b/releases/go/mpl/AwsKmsRsaKeyring/AwsKmsRsaKeyring.go @@ -0,0 +1,1390 @@ +// Package AwsKmsRsaKeyring +// Dafny module AwsKmsRsaKeyring compiled into Go + +package AwsKmsRsaKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsRsaKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) EncryptionContextDigest(cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, encryptionContext _dafny.Map) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_canonicalEC _dafny.Sequence + _ = _1_canonicalEC + _1_canonicalEC = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_DigestInput m_AwsCryptographyPrimitivesTypes.DigestInput + _ = _2_DigestInput + _2_DigestInput = m_AwsCryptographyPrimitivesTypes.Companion_DigestInput_.Create_DigestInput_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_(), _1_canonicalEC) + var _3_maybeDigest m_Wrappers.Result + _ = _3_maybeDigest + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (cryptoPrimitives).Digest(_2_DigestInput) + _3_maybeDigest = _out0 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + _4_valueOrError1 = (_3_maybeDigest).MapFailure(func(coer97 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg98 interface{}) interface{} { + return coer97(arg98.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e) + })) + if (_4_valueOrError1).IsFailure() { + output = (_4_valueOrError1).PropagateFailure() + return output + } + var _6_digest _dafny.Sequence + _ = _6_digest + _6_digest = (_4_valueOrError1).Extract().(_dafny.Sequence) + output = m_Wrappers.Companion_Result_.Create_Success_(_6_digest) + return output + return output +} +func (_static *CompanionStruct_Default___) MIN__KMS__RSA__KEY__LEN() int32 { + return int32(2048) +} + +// End of class Default__ + +// Definition of class AwsKmsRsaKeyring +type AwsKmsRsaKeyring struct { + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _client m_Wrappers.Option + _paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec + _awsKmsKey _dafny.Sequence + _publicKey m_Wrappers.Option + _awsKmsArn m_AwsArnParsing.AwsKmsIdentifier + _grantTokens _dafny.Sequence +} + +func New_AwsKmsRsaKeyring_() *AwsKmsRsaKeyring { + _this := AwsKmsRsaKeyring{} + + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._client = m_Wrappers.Companion_Option_.Default() + _this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default() + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._publicKey = m_Wrappers.Companion_Option_.Default() + _this._awsKmsArn = m_AwsArnParsing.AwsKmsIdentifier{} + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_AwsKmsRsaKeyring_ struct { +} + +var Companion_AwsKmsRsaKeyring_ = CompanionStruct_AwsKmsRsaKeyring_{} + +func (_this *AwsKmsRsaKeyring) Equals(other *AwsKmsRsaKeyring) bool { + return _this == other +} + +func (_this *AwsKmsRsaKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AwsKmsRsaKeyring) + return ok && _this.Equals(other) +} + +func (*AwsKmsRsaKeyring) String() string { + return "AwsKmsRsaKeyring.AwsKmsRsaKeyring" +} + +func Type_AwsKmsRsaKeyring_() _dafny.TypeDescriptor { + return type_AwsKmsRsaKeyring_{} +} + +type type_AwsKmsRsaKeyring_ struct { +} + +func (_this type_AwsKmsRsaKeyring_) Default() interface{} { + return (*AwsKmsRsaKeyring)(nil) +} + +func (_this type_AwsKmsRsaKeyring_) String() string { + return "AwsKmsRsaKeyring.AwsKmsRsaKeyring" +} +func (_this *AwsKmsRsaKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &AwsKmsRsaKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsRsaKeyring{} +var _ _dafny.TraitOffspring = &AwsKmsRsaKeyring{} + +func (_this *AwsKmsRsaKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out7 m_Wrappers.Result + _ = _out7 + _out7 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out7 +} +func (_this *AwsKmsRsaKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out7 m_Wrappers.Result + _ = _out7 + _out7 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out7 +} +func (_this *AwsKmsRsaKeyring) Ctor__(publicKey m_Wrappers.Option, awsKmsKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, client m_Wrappers.Option, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, grantTokens _dafny.Sequence) { + { + var _0_parsedAwsKmsId m_Wrappers.Result + _ = _0_parsedAwsKmsId + _0_parsedAwsKmsId = m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(awsKmsKey) + (_this)._publicKey = publicKey + (_this)._awsKmsKey = awsKmsKey + (_this)._awsKmsArn = (_0_parsedAwsKmsId).Dtor_value().(m_AwsArnParsing.AwsKmsIdentifier) + (_this)._paddingScheme = paddingScheme + (_this)._client = client + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._grantTokens = grantTokens + } +} +func (_this *AwsKmsRsaKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((_this).PublicKey()).Is_Some()) && ((_dafny.IntOfUint32((((_this).PublicKey()).Extract().(_dafny.Sequence)).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A AwsKmsRsaKeyring without a public key cannot provide OnEncrypt"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(((((input).Dtor_materials()).Dtor_algorithmSuite()).Dtor_signature()).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("AwsKmsRsaKeyring cannot be used with an Algorithm Suite with asymmetric signing."), _dafny.SeqOfString(" Please specify an algorithm suite without asymmetric signing.")))) + if (_1_valueOrError1).IsFailure() { + res = (_1_valueOrError1).PropagateFailure() + return res + } + var _2_wrap *KmsRsaWrapKeyMaterial + _ = _2_wrap + var _nw0 *KmsRsaWrapKeyMaterial = New_KmsRsaWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _2_wrap = _nw0 + var _3_generateAndWrap *KmsRsaGenerateAndWrapKeyMaterial + _ = _3_generateAndWrap + var _nw1 *KmsRsaGenerateAndWrapKeyMaterial = New_KmsRsaGenerateAndWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _3_generateAndWrap = _nw1 + var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_KmsRsaWrapInfo_.Default())) + _ = _4_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial((input).Dtor_materials(), _2_wrap, _3_generateAndWrap) + _4_valueOrError2 = _out0 + if (_4_valueOrError2).IsFailure() { + res = (_4_valueOrError2).PropagateFailure() + return res + } + var _5_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _5_wrapOutput + _5_wrapOutput = (_4_valueOrError2).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _6_symmetricSigningKeyList m_Wrappers.Option + _ = _6_symmetricSigningKeyList + if ((_5_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_5_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _7_edk + _7_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.RSA__PROVIDER__ID(), (m_UTF8.Encode((_this).AwsKmsKey())).Dtor_value().(_dafny.Sequence), (_5_wrapOutput).Dtor_wrappedMaterial()) + var _8_returnMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials = m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials{} + _ = _8_returnMaterials + if (_5_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _9_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _9_valueOrError3 + _9_valueOrError3 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey((input).Dtor_materials(), (_5_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + _8_returnMaterials = (_9_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + } else if (_5_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _10_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError4 + _10_valueOrError4 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys((input).Dtor_materials(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList) + if (_10_valueOrError4).IsFailure() { + res = (_10_valueOrError4).PropagateFailure() + return res + } + _8_returnMaterials = (_10_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + } + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_8_returnMaterials)) + return res + return res + } +} +func (_this *AwsKmsRsaKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(((_this).Client()).Is_Some(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("An AwsKmsRsaKeyring without an AWS KMS client cannot provide OnDecrypt"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _1_materials + _1_materials = (input).Dtor_materials() + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError1 + _2_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_1_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError1).IsFailure() { + res = (_2_valueOrError1).PropagateFailure() + return res + } + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError2 + _3_valueOrError2 = m_Wrappers.Companion_Default___.Need(((((input).Dtor_materials()).Dtor_algorithmSuite()).Dtor_signature()).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("AwsKmsRsaKeyring cannot be used with an Algorithm Suite with asymmetric signing."), _dafny.SeqOfString(" Please specify an algorithm suite without asymmetric signing.")))) + if (_3_valueOrError2).IsFailure() { + res = (_3_valueOrError2).PropagateFailure() + return res + } + var _4_filter *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter + _ = _4_filter + var _nw0 *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter = m_AwsKmsUtils.New_OnDecryptMrkAwareEncryptedDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).AwsKmsArn(), m_Constants.Companion_Default___.RSA__PROVIDER__ID()) + _4_filter = _nw0 + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError3 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_4_filter, (input).Dtor_encryptedDataKeys()) + _5_valueOrError3 = _out0 + if (_5_valueOrError3).IsFailure() { + res = (_5_valueOrError3).PropagateFailure() + return res + } + var _6_edksToAttempt _dafny.Sequence + _ = _6_edksToAttempt + _6_edksToAttempt = (_5_valueOrError3).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_6_edksToAttempt).Cardinality())).Sign() == 0 { + var _7_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _7_valueOrError4 + _7_valueOrError4 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_7_valueOrError4).IsFailure() { + res = (_7_valueOrError4).PropagateFailure() + return res + } + var _8_errorMessage _dafny.Sequence + _ = _8_errorMessage + _8_errorMessage = (_7_valueOrError4).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_8_errorMessage)) + return res + } + var _9_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _9_valueOrError5 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.EncryptionContextDigest((_this).CryptoPrimitives(), (_1_materials).Dtor_encryptionContext()) + _9_valueOrError5 = _out1 + if (_9_valueOrError5).IsFailure() { + res = (_9_valueOrError5).PropagateFailure() + return res + } + var _10_encryptionContextDigest _dafny.Sequence + _ = _10_encryptionContextDigest + _10_encryptionContextDigest = (_9_valueOrError5).Extract().(_dafny.Sequence) + var _11_decryptClosure m_Actions.ActionWithResult + _ = _11_decryptClosure + var _nw1 *DecryptSingleAWSRSAEncryptedDataKey = New_DecryptSingleAWSRSAEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_1_materials, m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_(((_this).Client()).Dtor_value()), (_this).AwsKmsKey(), (_this).PaddingScheme(), _10_encryptionContextDigest, (_this).GrantTokens()) + _11_decryptClosure = _nw1 + var _12_outcome m_Wrappers.Result + _ = _12_outcome + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_Actions.Companion_Default___.ReduceToSuccess(_11_decryptClosure, _6_edksToAttempt) + _12_outcome = _out2 + var _13_valueOrError6 m_Wrappers.Result = m_Wrappers.Result{} + _ = _13_valueOrError6 + _13_valueOrError6 = (_12_outcome).MapFailure(func(coer98 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg99 interface{}) interface{} { + return coer98(arg99.(_dafny.Sequence)) + } + }(func(_14_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_14_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_13_valueOrError6).IsFailure() { + res = (_13_valueOrError6).PropagateFailure() + return res + } + var _15_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _15_SealedDecryptionMaterials + _15_SealedDecryptionMaterials = (_13_valueOrError6).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_15_SealedDecryptionMaterials)) + return res + return res + } +} +func (_this *AwsKmsRsaKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *AwsKmsRsaKeyring) Client() m_Wrappers.Option { + { + return _this._client + } +} +func (_this *AwsKmsRsaKeyring) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + { + return _this._paddingScheme + } +} +func (_this *AwsKmsRsaKeyring) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *AwsKmsRsaKeyring) PublicKey() m_Wrappers.Option { + { + return _this._publicKey + } +} +func (_this *AwsKmsRsaKeyring) AwsKmsArn() m_AwsArnParsing.AwsKmsIdentifier { + { + return _this._awsKmsArn + } +} +func (_this *AwsKmsRsaKeyring) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class AwsKmsRsaKeyring + +// Definition of class DecryptSingleAWSRSAEncryptedDataKey +type DecryptSingleAWSRSAEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _client m_ComAmazonawsKmsTypes.IKMSClient + _awsKmsKey _dafny.Sequence + _paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec + _encryptionContextDigest _dafny.Sequence + _grantTokens _dafny.Sequence +} + +func New_DecryptSingleAWSRSAEncryptedDataKey_() *DecryptSingleAWSRSAEncryptedDataKey { + _this := DecryptSingleAWSRSAEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default() + _this._encryptionContextDigest = _dafny.EmptySeq + _this._grantTokens = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_DecryptSingleAWSRSAEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleAWSRSAEncryptedDataKey_ = CompanionStruct_DecryptSingleAWSRSAEncryptedDataKey_{} + +func (_this *DecryptSingleAWSRSAEncryptedDataKey) Equals(other *DecryptSingleAWSRSAEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleAWSRSAEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleAWSRSAEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleAWSRSAEncryptedDataKey) String() string { + return "AwsKmsRsaKeyring.DecryptSingleAWSRSAEncryptedDataKey" +} + +func Type_DecryptSingleAWSRSAEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleAWSRSAEncryptedDataKey_{} +} + +type type_DecryptSingleAWSRSAEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleAWSRSAEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleAWSRSAEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleAWSRSAEncryptedDataKey_) String() string { + return "AwsKmsRsaKeyring.DecryptSingleAWSRSAEncryptedDataKey" +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleAWSRSAEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleAWSRSAEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleAWSRSAEncryptedDataKey{} + +func (_this *DecryptSingleAWSRSAEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, encryptionContextDigest _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._materials = materials + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._paddingScheme = paddingScheme + (_this)._encryptionContextDigest = encryptionContextDigest + (_this)._grantTokens = grantTokens + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_unwrap *KmsRsaUnwrapKeyMaterial + _ = _0_unwrap + var _nw0 *KmsRsaUnwrapKeyMaterial = New_KmsRsaUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).PaddingScheme(), (_this).EncryptionContextDigest(), (_this).GrantTokens()) + _0_unwrap = _nw0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(Companion_KmsRsaUnwrapInfo_.Default())) + _ = _1_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _0_unwrap) + _1_valueOrError0 = _out0 + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _2_unwrapOutput + _2_unwrapOutput = (_1_valueOrError0).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError1 + _3_valueOrError1 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_2_unwrapOutput).Dtor_plaintextDataKey(), (_2_unwrapOutput).Dtor_symmetricSigningKey()) + if (_3_valueOrError1).IsFailure() { + res = (_3_valueOrError1).PropagateFailure() + return res + } + var _4_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _4_result + _4_result = (_3_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_4_result) + return res + return res + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + { + return _this._paddingScheme + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) EncryptionContextDigest() _dafny.Sequence { + { + return _this._encryptionContextDigest + } +} +func (_this *DecryptSingleAWSRSAEncryptedDataKey) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} + +// End of class DecryptSingleAWSRSAEncryptedDataKey + +// Definition of datatype KmsRsaUnwrapInfo +type KmsRsaUnwrapInfo struct { + Data_KmsRsaUnwrapInfo_ +} + +func (_this KmsRsaUnwrapInfo) Get_() Data_KmsRsaUnwrapInfo_ { + return _this.Data_KmsRsaUnwrapInfo_ +} + +type Data_KmsRsaUnwrapInfo_ interface { + isKmsRsaUnwrapInfo() +} + +type CompanionStruct_KmsRsaUnwrapInfo_ struct { +} + +var Companion_KmsRsaUnwrapInfo_ = CompanionStruct_KmsRsaUnwrapInfo_{} + +type KmsRsaUnwrapInfo_KmsRsaUnwrapInfo struct { +} + +func (KmsRsaUnwrapInfo_KmsRsaUnwrapInfo) isKmsRsaUnwrapInfo() {} + +func (CompanionStruct_KmsRsaUnwrapInfo_) Create_KmsRsaUnwrapInfo_() KmsRsaUnwrapInfo { + return KmsRsaUnwrapInfo{KmsRsaUnwrapInfo_KmsRsaUnwrapInfo{}} +} + +func (_this KmsRsaUnwrapInfo) Is_KmsRsaUnwrapInfo() bool { + _, ok := _this.Get_().(KmsRsaUnwrapInfo_KmsRsaUnwrapInfo) + return ok +} + +func (CompanionStruct_KmsRsaUnwrapInfo_) Default() KmsRsaUnwrapInfo { + return Companion_KmsRsaUnwrapInfo_.Create_KmsRsaUnwrapInfo_() +} + +func (_ CompanionStruct_KmsRsaUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_KmsRsaUnwrapInfo_.Create_KmsRsaUnwrapInfo_(), true + default: + return KmsRsaUnwrapInfo{}, false + } + } +} + +func (_this KmsRsaUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case KmsRsaUnwrapInfo_KmsRsaUnwrapInfo: + { + return "AwsKmsRsaKeyring.KmsRsaUnwrapInfo.KmsRsaUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this KmsRsaUnwrapInfo) Equals(other KmsRsaUnwrapInfo) bool { + switch _this.Get_().(type) { + case KmsRsaUnwrapInfo_KmsRsaUnwrapInfo: + { + _, ok := other.Get_().(KmsRsaUnwrapInfo_KmsRsaUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsRsaUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsRsaUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_KmsRsaUnwrapInfo_() _dafny.TypeDescriptor { + return type_KmsRsaUnwrapInfo_{} +} + +type type_KmsRsaUnwrapInfo_ struct { +} + +func (_this type_KmsRsaUnwrapInfo_) Default() interface{} { + return Companion_KmsRsaUnwrapInfo_.Default() +} + +func (_this type_KmsRsaUnwrapInfo_) String() string { + return "AwsKmsRsaKeyring.KmsRsaUnwrapInfo" +} +func (_this KmsRsaUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsRsaUnwrapInfo{} + +// End of datatype KmsRsaUnwrapInfo + +// Definition of datatype KmsRsaWrapInfo +type KmsRsaWrapInfo struct { + Data_KmsRsaWrapInfo_ +} + +func (_this KmsRsaWrapInfo) Get_() Data_KmsRsaWrapInfo_ { + return _this.Data_KmsRsaWrapInfo_ +} + +type Data_KmsRsaWrapInfo_ interface { + isKmsRsaWrapInfo() +} + +type CompanionStruct_KmsRsaWrapInfo_ struct { +} + +var Companion_KmsRsaWrapInfo_ = CompanionStruct_KmsRsaWrapInfo_{} + +type KmsRsaWrapInfo_KmsRsaWrapInfo struct { +} + +func (KmsRsaWrapInfo_KmsRsaWrapInfo) isKmsRsaWrapInfo() {} + +func (CompanionStruct_KmsRsaWrapInfo_) Create_KmsRsaWrapInfo_() KmsRsaWrapInfo { + return KmsRsaWrapInfo{KmsRsaWrapInfo_KmsRsaWrapInfo{}} +} + +func (_this KmsRsaWrapInfo) Is_KmsRsaWrapInfo() bool { + _, ok := _this.Get_().(KmsRsaWrapInfo_KmsRsaWrapInfo) + return ok +} + +func (CompanionStruct_KmsRsaWrapInfo_) Default() KmsRsaWrapInfo { + return Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_() +} + +func (_ CompanionStruct_KmsRsaWrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_(), true + default: + return KmsRsaWrapInfo{}, false + } + } +} + +func (_this KmsRsaWrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case KmsRsaWrapInfo_KmsRsaWrapInfo: + { + return "AwsKmsRsaKeyring.KmsRsaWrapInfo.KmsRsaWrapInfo" + } + default: + { + return "" + } + } +} + +func (_this KmsRsaWrapInfo) Equals(other KmsRsaWrapInfo) bool { + switch _this.Get_().(type) { + case KmsRsaWrapInfo_KmsRsaWrapInfo: + { + _, ok := other.Get_().(KmsRsaWrapInfo_KmsRsaWrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this KmsRsaWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(KmsRsaWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_KmsRsaWrapInfo_() _dafny.TypeDescriptor { + return type_KmsRsaWrapInfo_{} +} + +type type_KmsRsaWrapInfo_ struct { +} + +func (_this type_KmsRsaWrapInfo_) Default() interface{} { + return Companion_KmsRsaWrapInfo_.Default() +} + +func (_this type_KmsRsaWrapInfo_) String() string { + return "AwsKmsRsaKeyring.KmsRsaWrapInfo" +} +func (_this KmsRsaWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = KmsRsaWrapInfo{} + +// End of datatype KmsRsaWrapInfo + +// Definition of class KmsRsaGenerateAndWrapKeyMaterial +type KmsRsaGenerateAndWrapKeyMaterial struct { + _publicKey _dafny.Sequence + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec +} + +func New_KmsRsaGenerateAndWrapKeyMaterial_() *KmsRsaGenerateAndWrapKeyMaterial { + _this := KmsRsaGenerateAndWrapKeyMaterial{} + + _this._publicKey = _dafny.EmptySeq + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default() + return &_this +} + +type CompanionStruct_KmsRsaGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_KmsRsaGenerateAndWrapKeyMaterial_ = CompanionStruct_KmsRsaGenerateAndWrapKeyMaterial_{} + +func (_this *KmsRsaGenerateAndWrapKeyMaterial) Equals(other *KmsRsaGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsRsaGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsRsaGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsRsaGenerateAndWrapKeyMaterial) String() string { + return "AwsKmsRsaKeyring.KmsRsaGenerateAndWrapKeyMaterial" +} + +func Type_KmsRsaGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsRsaGenerateAndWrapKeyMaterial_{} +} + +type type_KmsRsaGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_KmsRsaGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*KmsRsaGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_KmsRsaGenerateAndWrapKeyMaterial_) String() string { + return "AwsKmsRsaKeyring.KmsRsaGenerateAndWrapKeyMaterial" +} +func (_this *KmsRsaGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &KmsRsaGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsRsaGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &KmsRsaGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsRsaGenerateAndWrapKeyMaterial{} + +func (_this *KmsRsaGenerateAndWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._publicKey = publicKey + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._paddingScheme = paddingScheme + } +} +func (_this *KmsRsaGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default())) + _ = res + var _0_generateBytesResult m_Wrappers.Result + _ = _0_generateBytesResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))) + _0_generateBytesResult = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_generateBytesResult).MapFailure(func(coer99 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg100 interface{}) interface{} { + return coer99(arg100.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_plaintextMaterial _dafny.Sequence + _ = _3_plaintextMaterial + _3_plaintextMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence) + var _4_wrap *KmsRsaWrapKeyMaterial + _ = _4_wrap + var _nw0 *KmsRsaWrapKeyMaterial = New_KmsRsaWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).PublicKey(), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _4_wrap = _nw0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default())) + _ = _5_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = (_4_wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_3_plaintextMaterial, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext())) + _5_valueOrError1 = _out1.(m_Wrappers.Result) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_wrapOutput m_MaterialWrapping.WrapOutput + _ = _6_wrapOutput + _6_wrapOutput = (_5_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + var _7_output m_MaterialWrapping.GenerateAndWrapOutput + _ = _7_output + _7_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_3_plaintextMaterial, (_6_wrapOutput).Dtor_wrappedMaterial(), Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_7_output) + return res + return res + } +} +func (_this *KmsRsaGenerateAndWrapKeyMaterial) PublicKey() _dafny.Sequence { + { + return _this._publicKey + } +} +func (_this *KmsRsaGenerateAndWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *KmsRsaGenerateAndWrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + { + return _this._paddingScheme + } +} + +// End of class KmsRsaGenerateAndWrapKeyMaterial + +// Definition of class KmsRsaWrapKeyMaterial +type KmsRsaWrapKeyMaterial struct { + _publicKey _dafny.Sequence + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec +} + +func New_KmsRsaWrapKeyMaterial_() *KmsRsaWrapKeyMaterial { + _this := KmsRsaWrapKeyMaterial{} + + _this._publicKey = _dafny.EmptySeq + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default() + return &_this +} + +type CompanionStruct_KmsRsaWrapKeyMaterial_ struct { +} + +var Companion_KmsRsaWrapKeyMaterial_ = CompanionStruct_KmsRsaWrapKeyMaterial_{} + +func (_this *KmsRsaWrapKeyMaterial) Equals(other *KmsRsaWrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsRsaWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsRsaWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsRsaWrapKeyMaterial) String() string { + return "AwsKmsRsaKeyring.KmsRsaWrapKeyMaterial" +} + +func Type_KmsRsaWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsRsaWrapKeyMaterial_{} +} + +type type_KmsRsaWrapKeyMaterial_ struct { +} + +func (_this type_KmsRsaWrapKeyMaterial_) Default() interface{} { + return (*KmsRsaWrapKeyMaterial)(nil) +} + +func (_this type_KmsRsaWrapKeyMaterial_) String() string { + return "AwsKmsRsaKeyring.KmsRsaWrapKeyMaterial" +} +func (_this *KmsRsaWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &KmsRsaWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsRsaWrapKeyMaterial{} +var _ m_Actions.Action = &KmsRsaWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsRsaWrapKeyMaterial{} + +func (_this *KmsRsaWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._publicKey = publicKey + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._paddingScheme = paddingScheme + } +} +func (_this *KmsRsaWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default())) + _ = res + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.EncryptionContextDigest((_this).CryptoPrimitives(), (input).Dtor_encryptionContext()) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_encryptionContextDigest _dafny.Sequence + _ = _1_encryptionContextDigest + _1_encryptionContextDigest = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_padding m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _ = _2_padding + var _source0 m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec = (_this).PaddingScheme() + _ = _source0 + { + { + if _source0.Is_RSAES__OAEP__SHA__1() { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA1_() + goto Lmatch0 + } + } + { + _2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA256_() + } + goto Lmatch0 + } + Lmatch0: + var _3_RSAEncryptOutput m_Wrappers.Result + _ = _3_RSAEncryptOutput + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = ((_this).CryptoPrimitives()).RSAEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_RSAEncryptInput_.Create_RSAEncryptInput_(_2_padding, (_this).PublicKey(), _dafny.Companion_Sequence_.Concatenate(_1_encryptionContextDigest, (input).Dtor_plaintextMaterial()))) + _3_RSAEncryptOutput = _out1 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + _4_valueOrError1 = (_3_RSAEncryptOutput).MapFailure(func(coer100 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg101 interface{}) interface{} { + return coer100(arg101.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e) + })) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _6_ciphertext _dafny.Sequence + _ = _6_ciphertext + _6_ciphertext = (_4_valueOrError1).Extract().(_dafny.Sequence) + var _7_output m_MaterialWrapping.WrapOutput + _ = _7_output + _7_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_6_ciphertext, Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_7_output) + return res + return res + } +} +func (_this *KmsRsaWrapKeyMaterial) PublicKey() _dafny.Sequence { + { + return _this._publicKey + } +} +func (_this *KmsRsaWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *KmsRsaWrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + { + return _this._paddingScheme + } +} + +// End of class KmsRsaWrapKeyMaterial + +// Definition of class KmsRsaUnwrapKeyMaterial +type KmsRsaUnwrapKeyMaterial struct { + _client m_ComAmazonawsKmsTypes.IKMSClient + _grantTokens _dafny.Sequence + _awsKmsKey _dafny.Sequence + _paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec + _encryptionContextDigest _dafny.Sequence +} + +func New_KmsRsaUnwrapKeyMaterial_() *KmsRsaUnwrapKeyMaterial { + _this := KmsRsaUnwrapKeyMaterial{} + + _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _this._grantTokens = _dafny.EmptySeq + _this._awsKmsKey = _dafny.EmptySeq.SetString() + _this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default() + _this._encryptionContextDigest = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_KmsRsaUnwrapKeyMaterial_ struct { +} + +var Companion_KmsRsaUnwrapKeyMaterial_ = CompanionStruct_KmsRsaUnwrapKeyMaterial_{} + +func (_this *KmsRsaUnwrapKeyMaterial) Equals(other *KmsRsaUnwrapKeyMaterial) bool { + return _this == other +} + +func (_this *KmsRsaUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KmsRsaUnwrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*KmsRsaUnwrapKeyMaterial) String() string { + return "AwsKmsRsaKeyring.KmsRsaUnwrapKeyMaterial" +} + +func Type_KmsRsaUnwrapKeyMaterial_() _dafny.TypeDescriptor { + return type_KmsRsaUnwrapKeyMaterial_{} +} + +type type_KmsRsaUnwrapKeyMaterial_ struct { +} + +func (_this type_KmsRsaUnwrapKeyMaterial_) Default() interface{} { + return (*KmsRsaUnwrapKeyMaterial)(nil) +} + +func (_this type_KmsRsaUnwrapKeyMaterial_) String() string { + return "AwsKmsRsaKeyring.KmsRsaUnwrapKeyMaterial" +} +func (_this *KmsRsaUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &KmsRsaUnwrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &KmsRsaUnwrapKeyMaterial{} +var _ m_Actions.Action = &KmsRsaUnwrapKeyMaterial{} +var _ _dafny.TraitOffspring = &KmsRsaUnwrapKeyMaterial{} + +func (_this *KmsRsaUnwrapKeyMaterial) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, encryptionContextDigest _dafny.Sequence, grantTokens _dafny.Sequence) { + { + (_this)._client = client + (_this)._awsKmsKey = awsKmsKey + (_this)._paddingScheme = paddingScheme + (_this)._encryptionContextDigest = encryptionContextDigest + (_this)._grantTokens = grantTokens + } +} +func (_this *KmsRsaUnwrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_KmsRsaUnwrapInfo_.Default())) + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType((input).Dtor_wrappedMaterial()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Ciphertext length invalid"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_decryptRequest m_ComAmazonawsKmsTypes.DecryptRequest + _ = _1_decryptRequest + _1_decryptRequest = m_ComAmazonawsKmsTypes.Companion_DecryptRequest_.Create_DecryptRequest_((input).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_((_this).GrantTokens()), m_Wrappers.Companion_Option_.Create_Some_((_this).AwsKmsKey()), m_Wrappers.Companion_Option_.Create_Some_((_this).PaddingScheme()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeDecryptResponse m_Wrappers.Result + _ = _2_maybeDecryptResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Client()).Decrypt(_1_decryptRequest) + _2_maybeDecryptResponse = _out0 + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _3_valueOrError1 + _3_valueOrError1 = (_2_maybeDecryptResponse).MapFailure(func(coer101 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg102 interface{}) interface{} { + return coer101(arg102.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_4_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_4_e) + })) + if (_3_valueOrError1).IsFailure() { + res = (_3_valueOrError1).PropagateFailure() + return res + } + var _5_decryptResponse m_ComAmazonawsKmsTypes.DecryptResponse + _ = _5_decryptResponse + _5_decryptResponse = (_3_valueOrError1).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError2 + _6_valueOrError2 = m_Wrappers.Companion_Default___.Need(((((_5_decryptResponse).Dtor_KeyId()).Is_Some()) && (_dafny.Companion_Sequence_.Equal(((_5_decryptResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence), (_this).AwsKmsKey()))) && (((_5_decryptResponse).Dtor_Plaintext()).Is_Some()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from KMS Decrypt"))) + if (_6_valueOrError2).IsFailure() { + res = (_6_valueOrError2).PropagateFailure() + return res + } + var _7_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError3 + _7_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.Companion_Sequence_.IsPrefixOf((_this).EncryptionContextDigest(), ((_5_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence))) && (((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))).Plus(_dafny.IntOfUint32(((_this).EncryptionContextDigest()).Cardinality()))).Cmp(_dafny.IntOfUint32((((_5_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context digest does not match expected value."))) + if (_7_valueOrError3).IsFailure() { + res = (_7_valueOrError3).PropagateFailure() + return res + } + var _8_output m_MaterialWrapping.UnwrapOutput + _ = _8_output + _8_output = m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_((((_5_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)).Drop((_dafny.IntOfUint32(((_this).EncryptionContextDigest()).Cardinality())).Uint32()), Companion_KmsRsaUnwrapInfo_.Create_KmsRsaUnwrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_8_output) + return res + return res + } +} +func (_this *KmsRsaUnwrapKeyMaterial) Client() m_ComAmazonawsKmsTypes.IKMSClient { + { + return _this._client + } +} +func (_this *KmsRsaUnwrapKeyMaterial) GrantTokens() _dafny.Sequence { + { + return _this._grantTokens + } +} +func (_this *KmsRsaUnwrapKeyMaterial) AwsKmsKey() _dafny.Sequence { + { + return _this._awsKmsKey + } +} +func (_this *KmsRsaUnwrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + { + return _this._paddingScheme + } +} +func (_this *KmsRsaUnwrapKeyMaterial) EncryptionContextDigest() _dafny.Sequence { + { + return _this._encryptionContextDigest + } +} + +// End of class KmsRsaUnwrapKeyMaterial diff --git a/releases/go/mpl/AwsKmsUtils/AwsKmsUtils.go b/releases/go/mpl/AwsKmsUtils/AwsKmsUtils.go new file mode 100644 index 000000000..b36f4ccf8 --- /dev/null +++ b/releases/go/mpl/AwsKmsUtils/AwsKmsUtils.go @@ -0,0 +1,525 @@ +// Package AwsKmsUtils +// Dafny module AwsKmsUtils compiled into Go + +package AwsKmsUtils + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "AwsKmsUtils.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) StringifyEncryptionContext(utf8EncCtx _dafny.Map) m_Wrappers.Result { + if ((utf8EncCtx).Cardinality()).Sign() == 0 { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.NewMapBuilder().ToMap()) + } else { + var _0_stringifyResults _dafny.Map = func() _dafny.Map { + var _coll0 = _dafny.NewMapBuilder() + _ = _coll0 + for _iter0 := _dafny.Iterate(((utf8EncCtx).Keys()).Elements()); ; { + _compr_0, _ok0 := _iter0() + if !_ok0 { + break + } + var _1_utf8Key _dafny.Sequence + _1_utf8Key = interface{}(_compr_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_1_utf8Key) { + if ((utf8EncCtx).Keys()).Contains(_1_utf8Key) { + _coll0.Add(_1_utf8Key, Companion_Default___.StringifyEncryptionContextPair(_1_utf8Key, (utf8EncCtx).Get(_1_utf8Key).(_dafny.Sequence))) + } + } + } + return _coll0.ToMap() + }() + _ = _0_stringifyResults + if _dafny.Quantifier(((_0_stringifyResults).Values()).Elements(), false, func(_exists_var_0 m_Wrappers.Result) bool { + var _2_r m_Wrappers.Result + _2_r = interface{}(_exists_var_0).(m_Wrappers.Result) + return (((_0_stringifyResults).Values()).Contains(_2_r)) && ((_2_r).Is_Failure()) + }) { + return m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context contains invalid UTF8"))) + } else { + var _3_stringKeysUnique bool = _dafny.Quantifier((_0_stringifyResults).Keys().Elements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _4_k _dafny.Sequence + _4_k = interface{}(_forall_var_0).(_dafny.Sequence) + return _dafny.Quantifier((_0_stringifyResults).Keys().Elements(), true, func(_forall_var_1 _dafny.Sequence) bool { + var _5_k_k _dafny.Sequence + _5_k_k = interface{}(_forall_var_1).(_dafny.Sequence) + return !(((_0_stringifyResults).Contains(_4_k)) && ((_0_stringifyResults).Contains(_5_k_k))) || (!(!_dafny.Companion_Sequence_.Equal(_4_k, _5_k_k)) || (!_dafny.Companion_Sequence_.Equal((*(((_0_stringifyResults).Get(_4_k).(m_Wrappers.Result)).Dtor_value().(_dafny.Tuple)).IndexInt(0)).(_dafny.Sequence), (*(((_0_stringifyResults).Get(_5_k_k).(m_Wrappers.Result)).Dtor_value().(_dafny.Tuple)).IndexInt(0)).(_dafny.Sequence)))) + }) + }) + _ = _3_stringKeysUnique + if !(_3_stringKeysUnique) { + return m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context keys are not unique"))) + } else { + return m_Wrappers.Companion_Result_.Create_Success_(func() _dafny.Map { + var _coll1 = _dafny.NewMapBuilder() + _ = _coll1 + for _iter1 := _dafny.Iterate(((_0_stringifyResults).Values()).Elements()); ; { + _compr_1, _ok1 := _iter1() + if !_ok1 { + break + } + var _6_r m_Wrappers.Result + _6_r = interface{}(_compr_1).(m_Wrappers.Result) + if ((_0_stringifyResults).Values()).Contains(_6_r) { + _coll1.Add((*((_6_r).Dtor_value().(_dafny.Tuple)).IndexInt(0)).(_dafny.Sequence), (*((_6_r).Dtor_value().(_dafny.Tuple)).IndexInt(1)).(_dafny.Sequence)) + } + } + return _coll1.ToMap() + }()) + } + } + } +} +func (_static *CompanionStruct_Default___) StringifyEncryptionContextPair(utf8Key _dafny.Sequence, utf8Value _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = (m_UTF8.Decode(utf8Key)).MapFailure(func(coer1 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg1 interface{}) interface{} { + return coer1(arg1.(_dafny.Sequence)) + } + }(Companion_Default___.WrapStringToError)) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_key _dafny.Sequence = (_0_valueOrError0).Extract().(_dafny.Sequence) + _ = _1_key + var _2_valueOrError1 m_Wrappers.Result = (m_UTF8.Decode(utf8Value)).MapFailure(func(coer2 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg2 interface{}) interface{} { + return coer2(arg2.(_dafny.Sequence)) + } + }(Companion_Default___.WrapStringToError)) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_value _dafny.Sequence = (_2_valueOrError1).Extract().(_dafny.Sequence) + _ = _3_value + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf(_1_key, _3_value)) + } + } +} +func (_static *CompanionStruct_Default___) WrapStringToError(e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(e) +} +func (_static *CompanionStruct_Default___) ValidateKmsKeyId(keyId _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(keyId)).MapFailure(func(coer3 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg3 interface{}) interface{} { + return coer3(arg3.(_dafny.Sequence)) + } + }(Companion_Default___.WrapStringToError)) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1___v0 m_AwsArnParsing.AwsKmsIdentifier = (_0_valueOrError0).Extract().(m_AwsArnParsing.AwsKmsIdentifier) + _ = _1___v0 + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.IsASCIIString(keyId), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Key identifier is not ASCII"))) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((keyId).Cardinality())).Sign() == 1) && ((_dafny.IntOfUint32((keyId).Cardinality())).Cmp(m_AwsArnParsing.Companion_Default___.MAX__AWS__KMS__IDENTIFIER__LENGTH()) <= 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Key identifier is too long"))) + _ = _3_valueOrError2 + if (_3_valueOrError2).IsFailure() { + return (_3_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } + } + } +} +func (_static *CompanionStruct_Default___) GetValidGrantTokens(grantTokens m_Wrappers.Option) m_Wrappers.Result { + var _0_tokens _dafny.Sequence = (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence) + _ = _0_tokens + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((_0_tokens).Cardinality())).Sign() != -1) && ((_dafny.IntOfUint32((_0_tokens).Cardinality())).Cmp(_dafny.IntOfInt64(10)) <= 0), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Grant token list can have no more than 10 tokens"))) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier((_0_tokens).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _3_token _dafny.Sequence + _3_token = interface{}(_forall_var_0).(_dafny.Sequence) + return !(_dafny.Companion_Sequence_.Contains(_0_tokens, _3_token)) || (((_dafny.One).Cmp(_dafny.IntOfUint32((_3_token).Cardinality())) <= 0) && ((_dafny.IntOfUint32((_3_token).Cardinality())).Cmp(_dafny.IntOfInt64(8192)) <= 0)) + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Grant token list contains a grant token with invalid length"))) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_0_tokens) + } + } +} +func (_static *CompanionStruct_Default___) GetEcdhPublicKey(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_getPublicKeyRequest m_ComAmazonawsKmsTypes.GetPublicKeyRequest + _ = _0_getPublicKeyRequest + _0_getPublicKeyRequest = m_ComAmazonawsKmsTypes.Companion_GetPublicKeyRequest_.Create_GetPublicKeyRequest_(awsKmsKey, m_Wrappers.Companion_Option_.Create_None_()) + var _1_maybePublicKeyResponse m_Wrappers.Result + _ = _1_maybePublicKeyResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (client).GetPublicKey(_0_getPublicKeyRequest) + _1_maybePublicKeyResponse = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GetPublicKeyResponse_.Default()) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_maybePublicKeyResponse).MapFailure(func(coer4 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg4 interface{}) interface{} { + return coer4(arg4.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_3_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_getPublicKeyResponse m_ComAmazonawsKmsTypes.GetPublicKeyResponse + _ = _4_getPublicKeyResponse + _4_getPublicKeyResponse = (_2_valueOrError0).Extract().(m_ComAmazonawsKmsTypes.GetPublicKeyResponse) + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError1 + _5_valueOrError1 = m_Wrappers.Companion_Default___.Need(((((((_4_getPublicKeyResponse).Dtor_KeyId()).Is_Some()) && (_dafny.Companion_Sequence_.Equal(((_4_getPublicKeyResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence), awsKmsKey))) && (((_4_getPublicKeyResponse).Dtor_KeyUsage()).Is_Some())) && ((((_4_getPublicKeyResponse).Dtor_KeyUsage()).Dtor_value().(m_ComAmazonawsKmsTypes.KeyUsageType)).Equals(m_ComAmazonawsKmsTypes.Companion_KeyUsageType_.Create_KEY__AGREEMENT_()))) && (((_4_getPublicKeyResponse).Dtor_PublicKey()).Is_Some()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid response from KMS GetPublicKey"))) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(((_4_getPublicKeyResponse).Dtor_PublicKey()).Dtor_value().(_dafny.Sequence)) + return res + return res +} +func (_static *CompanionStruct_Default___) ParseKeyNamespaceAndName(keyNamespace _dafny.Sequence, keyName _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = (m_UTF8.Encode(keyNamespace)).MapFailure(func(coer5 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg5 interface{}) interface{} { + return coer5(arg5.(_dafny.Sequence)) + } + }(func(_1_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Key namespace could not be UTF8-encoded"), _1_e)) + })) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _2_namespace _dafny.Sequence = (_0_valueOrError0).Extract().(_dafny.Sequence) + _ = _2_namespace + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_2_namespace).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT16__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Key namespace too long"))) + _ = _3_valueOrError1 + if (_3_valueOrError1).IsFailure() { + return (_3_valueOrError1).PropagateFailure() + } else { + var _4_valueOrError2 m_Wrappers.Result = (m_UTF8.Encode(keyName)).MapFailure(func(coer6 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg6 interface{}) interface{} { + return coer6(arg6.(_dafny.Sequence)) + } + }(func(_5_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Key name could not be UTF8-encoded"), _5_e)) + })) + _ = _4_valueOrError2 + if (_4_valueOrError2).IsFailure() { + return (_4_valueOrError2).PropagateFailure() + } else { + var _6_name _dafny.Sequence = (_4_valueOrError2).Extract().(_dafny.Sequence) + _ = _6_name + var _7_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_6_name).Cardinality())).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT16__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Key name too long"))) + _ = _7_valueOrError3 + if (_7_valueOrError3).IsFailure() { + return (_7_valueOrError3).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf(_2_namespace, _6_name)) + } + } + } + } +} +func (_static *CompanionStruct_Default___) ValidateDiscoveryFilter(filter m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32(((filter).Dtor_accountIds()).Cardinality())).Sign() == 1, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Discovery filter must have at least one account ID"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((filter).Dtor_accountIds()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _2_accountId _dafny.Sequence + _2_accountId = interface{}(_forall_var_0).(_dafny.Sequence) + return !(_dafny.Companion_Sequence_.Contains((filter).Dtor_accountIds(), _2_accountId)) || ((_dafny.IntOfUint32((_2_accountId).Cardinality())).Sign() == 1) + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Discovery filter account IDs cannot be blank"))) + _ = _1_valueOrError1 + if (_1_valueOrError1).IsFailure() { + return (_1_valueOrError1).PropagateFailure() + } else { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32(((filter).Dtor_partition()).Cardinality())).Sign() == 1, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Discovery filter partition cannot be blank"))) + _ = _3_valueOrError2 + if (_3_valueOrError2).IsFailure() { + return (_3_valueOrError2).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + } + } + } +} + +// End of class Default__ + +// Definition of class OnDecryptMrkAwareEncryptedDataKeyFilter +type OnDecryptMrkAwareEncryptedDataKeyFilter struct { + _awsKmsKey m_AwsArnParsing.AwsKmsIdentifier + _providerId _dafny.Sequence +} + +func New_OnDecryptMrkAwareEncryptedDataKeyFilter_() *OnDecryptMrkAwareEncryptedDataKeyFilter { + _this := OnDecryptMrkAwareEncryptedDataKeyFilter{} + + _this._awsKmsKey = m_AwsArnParsing.AwsKmsIdentifier{} + _this._providerId = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + return &_this +} + +type CompanionStruct_OnDecryptMrkAwareEncryptedDataKeyFilter_ struct { +} + +var Companion_OnDecryptMrkAwareEncryptedDataKeyFilter_ = CompanionStruct_OnDecryptMrkAwareEncryptedDataKeyFilter_{} + +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) Equals(other *OnDecryptMrkAwareEncryptedDataKeyFilter) bool { + return _this == other +} + +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OnDecryptMrkAwareEncryptedDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*OnDecryptMrkAwareEncryptedDataKeyFilter) String() string { + return "AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter" +} + +func Type_OnDecryptMrkAwareEncryptedDataKeyFilter_() _dafny.TypeDescriptor { + return type_OnDecryptMrkAwareEncryptedDataKeyFilter_{} +} + +type type_OnDecryptMrkAwareEncryptedDataKeyFilter_ struct { +} + +func (_this type_OnDecryptMrkAwareEncryptedDataKeyFilter_) Default() interface{} { + return (*OnDecryptMrkAwareEncryptedDataKeyFilter)(nil) +} + +func (_this type_OnDecryptMrkAwareEncryptedDataKeyFilter_) String() string { + return "AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter" +} +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &OnDecryptMrkAwareEncryptedDataKeyFilter{} +var _ m_Actions.DeterministicAction = &OnDecryptMrkAwareEncryptedDataKeyFilter{} +var _ _dafny.TraitOffspring = &OnDecryptMrkAwareEncryptedDataKeyFilter{} + +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) Ctor__(awsKmsKey m_AwsArnParsing.AwsKmsIdentifier, providerId _dafny.Sequence) { + { + (_this)._awsKmsKey = awsKmsKey + (_this)._providerId = providerId + } +} +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + if !_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), (_this).ProviderId()) { + res = m_Wrappers.Companion_Result_.Create_Success_(false) + return res + } + if !(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo())) { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) + return res + } + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _0_valueOrError0 + _0_valueOrError0 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer7 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg7 interface{}) interface{} { + return coer7(arg7.(_dafny.Sequence)) + } + }(Companion_Default___.WrapStringToError)) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_keyId _dafny.Sequence + _ = _1_keyId + _1_keyId = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _2_valueOrError1 + _2_valueOrError1 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_1_keyId)).MapFailure(func(coer8 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg8 interface{}) interface{} { + return coer8(arg8.(_dafny.Sequence)) + } + }(Companion_Default___.WrapStringToError)) + if (_2_valueOrError1).IsFailure() { + res = (_2_valueOrError1).PropagateFailure() + return res + } + var _3_arn m_AwsArnParsing.AwsArn + _ = _3_arn + _3_arn = (_2_valueOrError1).Extract().(m_AwsArnParsing.AwsArn) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsKmsMrkMatchForDecrypt.Companion_Default___.AwsKmsMrkMatchForDecrypt((_this).AwsKmsKey(), m_AwsArnParsing.Companion_AwsKmsIdentifier_.Create_AwsKmsArnIdentifier_(_3_arn))) + return res + return res + } +} +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) AwsKmsKey() m_AwsArnParsing.AwsKmsIdentifier { + { + return _this._awsKmsKey + } +} +func (_this *OnDecryptMrkAwareEncryptedDataKeyFilter) ProviderId() _dafny.Sequence { + { + return _this._providerId + } +} + +// End of class OnDecryptMrkAwareEncryptedDataKeyFilter diff --git a/releases/go/mpl/CHANGELOG.md b/releases/go/mpl/CHANGELOG.md new file mode 100644 index 000000000..f7e4706bb --- /dev/null +++ b/releases/go/mpl/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +# [0.0.1] (2025-01-14) + +Initial release for Go based on MPL [1.8.0](../../../CHANGELOG.md) diff --git a/releases/go/mpl/CMM/CMM.go b/releases/go/mpl/CMM/CMM.go new file mode 100644 index 000000000..6f593fe08 --- /dev/null +++ b/releases/go/mpl/CMM/CMM.go @@ -0,0 +1,298 @@ +// Package CMM +// Dafny module CMM compiled into Go + +package CMM + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "CMM.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) RequiredEncryptionContextKeys_q(requiredEncryptionContextKeys m_Wrappers.Option, encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) bool { + return _dafny.Quantifier(((requiredEncryptionContextKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _0_k _dafny.Sequence + _0_k = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_0_k) { + return !(_dafny.Companion_Sequence_.Contains((requiredEncryptionContextKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence), _0_k)) || (_dafny.Companion_Sequence_.Contains((encryptionMaterials).Dtor_requiredEncryptionContextKeys(), _0_k)) + } else { + return true + } + }) +} +func (_static *CompanionStruct_Default___) EncryptionContextComplete(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput, decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + var _0_reproducedEncryptionContext _dafny.Map = ((input).Dtor_reproducedEncryptionContext()).UnwrapOr(_dafny.NewMapBuilder().ToMap()).(_dafny.Map) + _ = _0_reproducedEncryptionContext + return _dafny.Quantifier(((_0_reproducedEncryptionContext).Keys()).Elements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_k _dafny.Sequence + _1_k = interface{}(_forall_var_0).(_dafny.Sequence) + return !(((_0_reproducedEncryptionContext).Keys()).Contains(_1_k)) || ((((decryptionMaterials).Dtor_encryptionContext()).Contains(_1_k)) && (_dafny.Companion_Sequence_.Equal(((decryptionMaterials).Dtor_encryptionContext()).Get(_1_k).(_dafny.Sequence), (_0_reproducedEncryptionContext).Get(_1_k).(_dafny.Sequence)))) + }) +} +func (_static *CompanionStruct_Default___) ReproducedEncryptionContext_q(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) bool { + var _0_reproducedEncryptionContext _dafny.Map = ((input).Dtor_reproducedEncryptionContext()).UnwrapOr(_dafny.NewMapBuilder().ToMap()).(_dafny.Map) + _ = _0_reproducedEncryptionContext + return _dafny.Quantifier(((_0_reproducedEncryptionContext).Keys()).Elements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_k _dafny.Sequence + _1_k = interface{}(_forall_var_0).(_dafny.Sequence) + return !((((_0_reproducedEncryptionContext).Keys()).Contains(_1_k)) && (((input).Dtor_encryptionContext()).Contains(_1_k))) || (_dafny.Companion_Sequence_.Equal(((input).Dtor_encryptionContext()).Get(_1_k).(_dafny.Sequence), (_0_reproducedEncryptionContext).Get(_1_k).(_dafny.Sequence))) + }) +} + +// End of class Default__ + +// Definition of trait VerifiableInterface +type VerifiableInterface interface { + String() string + DecryptMaterials(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result + GetEncryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result + GetEncryptionMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result + DecryptMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result +} +type CompanionStruct_VerifiableInterface_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_VerifiableInterface_ = CompanionStruct_VerifiableInterface_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_VerifiableInterface_) CastTo_(x interface{}) VerifiableInterface { + var t VerifiableInterface + t, _ = x.(VerifiableInterface) + return t +} + +// End of trait VerifiableInterface diff --git a/releases/go/mpl/CacheConstants/CacheConstants.go b/releases/go/mpl/CacheConstants/CacheConstants.go new file mode 100644 index 000000000..d78e74fd5 --- /dev/null +++ b/releases/go/mpl/CacheConstants/CacheConstants.go @@ -0,0 +1,246 @@ +// Package CacheConstants +// Dafny module CacheConstants compiled into Go + +package CacheConstants + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "CacheConstants.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) NULL__BYTE() _dafny.Sequence { + return _dafny.SeqOf(uint8(0)) +} +func (_static *CompanionStruct_Default___) RESOURCE__ID__CACHING__CMM() _dafny.Sequence { + return _dafny.SeqOf(uint8(1)) +} +func (_static *CompanionStruct_Default___) RESOURCE__ID__HIERARCHICAL__KEYRING() _dafny.Sequence { + return _dafny.SeqOf(uint8(2)) +} +func (_static *CompanionStruct_Default___) SCOPE__ID__ENCRYPT() _dafny.Sequence { + return _dafny.SeqOf(uint8(1)) +} +func (_static *CompanionStruct_Default___) SCOPE__ID__DECRYPT() _dafny.Sequence { + return _dafny.SeqOf(uint8(2)) +} +func (_static *CompanionStruct_Default___) SCOPE__ID__SEARCHABLE__ENCRYPTION() _dafny.Sequence { + return _dafny.SeqOf(uint8(3)) +} + +// End of class Default__ diff --git a/releases/go/mpl/CanonicalEncryptionContext/CanonicalEncryptionContext.go b/releases/go/mpl/CanonicalEncryptionContext/CanonicalEncryptionContext.go new file mode 100644 index 000000000..81d192661 --- /dev/null +++ b/releases/go/mpl/CanonicalEncryptionContext/CanonicalEncryptionContext.go @@ -0,0 +1,249 @@ +// Package CanonicalEncryptionContext +// Dafny module CanonicalEncryptionContext compiled into Go + +package CanonicalEncryptionContext + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_SortedSets "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/SortedSets" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "CanonicalEncryptionContext.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) EncryptionContextToAAD(encryptionContext _dafny.Map) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((encryptionContext).Cardinality()).Cmp(m_StandardLibrary_UInt.Companion_Default___.UINT16__LIMIT()) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption Context is too large"))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_keys _dafny.Sequence = m_SortedSets.SetToOrderedSequence2((encryptionContext).Keys(), func(coer36 func(uint8, uint8) bool) func(interface{}, interface{}) bool { + return func(arg36 interface{}, arg37 interface{}) bool { + return coer36(arg36.(uint8), arg37.(uint8)) + } + }(m_StandardLibrary_UInt.Companion_Default___.UInt8Less)) + _ = _1_keys + if (_dafny.IntOfUint32((_1_keys).Cardinality())).Sign() == 0 { + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf()) + } else { + var _2_KeyIntoPairBytes func(_dafny.Sequence) m_Wrappers.Result = (func(_3_encryptionContext _dafny.Map) func(_dafny.Sequence) m_Wrappers.Result { + return func(_4_k _dafny.Sequence) m_Wrappers.Result { + return func(_pat_let4_0 _dafny.Sequence) m_Wrappers.Result { + return func(_5_v _dafny.Sequence) m_Wrappers.Result { + return func(_pat_let5_0 m_Wrappers.Outcome) m_Wrappers.Result { + return func(_6_valueOrError1 m_Wrappers.Outcome) m_Wrappers.Result { + return (func() m_Wrappers.Result { + if (_6_valueOrError1).IsFailure() { + return (_6_valueOrError1).PropagateFailure() + } + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(m_StandardLibrary_UInt.Companion_Default___.UInt16ToSeq(uint16((_4_k).Cardinality())), _4_k), m_StandardLibrary_UInt.Companion_Default___.UInt16ToSeq(uint16((_5_v).Cardinality()))), _5_v)) + })() + }(_pat_let5_0) + }(m_Wrappers.Companion_Default___.Need((m_StandardLibrary_UInt.Companion_Default___.HasUint16Len(_4_k)) && (m_StandardLibrary_UInt.Companion_Default___.HasUint16Len(_5_v)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unable to serialize encryption context")))) + }(_pat_let4_0) + }((_3_encryptionContext).Get(_4_k).(_dafny.Sequence)) + } + })(encryptionContext) + _ = _2_KeyIntoPairBytes + var _7_valueOrError2 m_Wrappers.Result = m_Seq.Companion_Default___.MapWithResult(func(coer37 func(_dafny.Sequence) m_Wrappers.Result) func(interface{}) m_Wrappers.Result { + return func(arg38 interface{}) m_Wrappers.Result { + return coer37(arg38.(_dafny.Sequence)) + } + }(_2_KeyIntoPairBytes), _1_keys) + _ = _7_valueOrError2 + if (_7_valueOrError2).IsFailure() { + return (_7_valueOrError2).PropagateFailure() + } else { + var _8_pairsBytes _dafny.Sequence = (_7_valueOrError2).Extract().(_dafny.Sequence) + _ = _8_pairsBytes + var _9_allBytes _dafny.Sequence = _dafny.Companion_Sequence_.Concatenate(m_StandardLibrary_UInt.Companion_Default___.UInt16ToSeq(uint16((_1_keys).Cardinality())), m_Seq.Companion_Default___.Flatten(_8_pairsBytes)) + _ = _9_allBytes + return m_Wrappers.Companion_Result_.Create_Success_(_9_allBytes) + } + } + } +} + +// End of class Default__ diff --git a/releases/go/mpl/Commitment/Commitment.go b/releases/go/mpl/Commitment/Commitment.go new file mode 100644 index 000000000..133ac5899 --- /dev/null +++ b/releases/go/mpl/Commitment/Commitment.go @@ -0,0 +1,268 @@ +// Package Commitment +// Dafny module Commitment compiled into Go + +package Commitment + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Commitment.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ValidateCommitmentPolicyOnEncrypt(algorithm m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId, commitmentPolicy m_AwsCryptographyMaterialProvidersTypes.CommitmentPolicy) m_Wrappers.Outcome { + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = m_AlgorithmSuites.Companion_Default___.GetSuite(algorithm) + _ = _0_suite + if ((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKCommitmentPolicy_.Create_FORBID__ENCRYPT__ALLOW__DECRYPT_()))) && (!(((_0_suite).Dtor_commitment()).Is_None())) { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfoOnEncrypt_(_dafny.SeqOfString("Configuration conflict. Commitment policy requires only non-committing algorithm suites"))) + } else if ((((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKCommitmentPolicy_.Create_REQUIRE__ENCRYPT__ALLOW__DECRYPT_()))) || ((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKCommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_())))) || ((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_DBE_(m_AwsCryptographyMaterialProvidersTypes.Companion_DBECommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_())))) && (((_0_suite).Dtor_commitment()).Is_None()) { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfoOnEncrypt_(_dafny.SeqOfString("Configuration conflict. Commitment policy requires only committing algorithm suites"))) + } else { + return m_Wrappers.Companion_Outcome_.Create_Pass_() + } +} +func (_static *CompanionStruct_Default___) ValidateCommitmentPolicyOnDecrypt(algorithm m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId, commitmentPolicy m_AwsCryptographyMaterialProvidersTypes.CommitmentPolicy) m_Wrappers.Outcome { + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = m_AlgorithmSuites.Companion_Default___.GetSuite(algorithm) + _ = _0_suite + if ((true) && (((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKCommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_()))) || ((commitmentPolicy).Equals(m_AwsCryptographyMaterialProvidersTypes.Companion_CommitmentPolicy_.Create_DBE_(m_AwsCryptographyMaterialProvidersTypes.Companion_DBECommitmentPolicy_.Create_REQUIRE__ENCRYPT__REQUIRE__DECRYPT_()))))) && (((_0_suite).Dtor_commitment()).Is_None()) { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfoOnDecrypt_(_dafny.SeqOfString("Configuration conflict. Commitment policy requires only committing algorithm suites"))) + } else { + return m_Wrappers.Companion_Outcome_.Create_Pass_() + } +} + +// End of class Default__ diff --git a/releases/go/mpl/Constants/Constants.go b/releases/go/mpl/Constants/Constants.go new file mode 100644 index 000000000..5252a0e8a --- /dev/null +++ b/releases/go/mpl/Constants/Constants.go @@ -0,0 +1,441 @@ +// Package Constants +// Dafny module Constants compiled into Go + +package Constants + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Constants.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__RPL__INDEX() uint32 { + return uint32(1) +} +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN() _dafny.Int { + return _dafny.IntOfInt64(4) +} +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__RPK__INDEX() uint32 { + return (Companion_Default___.ECDH__PROVIDER__INFO__RPL__INDEX()) + ((Companion_Default___.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN()).Uint32()) +} +func (_static *CompanionStruct_Default___) ECDH__AES__256__ENC__KEY__LENGTH() int32 { + return int32(32) +} +func (_static *CompanionStruct_Default___) ECDH__AES__256__ENC__TAG__LENGTH() int32 { + return int32(16) +} +func (_static *CompanionStruct_Default___) ECDH__AES__256__ENC__IV__LENGTH() int32 { + return int32(12) +} +func (_static *CompanionStruct_Default___) ECDH__AES__256__ENC__ALG() m_AwsCryptographyPrimitivesTypes.AES__GCM { + return m_AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(Companion_Default___.ECDH__AES__256__ENC__KEY__LENGTH(), Companion_Default___.ECDH__AES__256__ENC__TAG__LENGTH(), Companion_Default___.ECDH__AES__256__ENC__IV__LENGTH()) +} +func (_static *CompanionStruct_Default___) PROVIDER__ID() _dafny.Sequence { + var _0_s _dafny.Sequence = _dafny.SeqOf(uint8(97), uint8(119), uint8(115), uint8(45), uint8(107), uint8(109), uint8(115)) + _ = _0_s + return _0_s +} +func (_static *CompanionStruct_Default___) UINT32__TO__SEQ__LEN() _dafny.Int { + return _dafny.IntOfInt64(4) +} +func (_static *CompanionStruct_Default___) KDF__SALT__LEN() int32 { + return int32(32) +} +func (_static *CompanionStruct_Default___) KDF__EXPECTED__LEN() int32 { + return int32(64) +} +func (_static *CompanionStruct_Default___) ECDH__COMMITMENT__KEY__LENGTH() _dafny.Int { + return _dafny.IntOfInt64(32) +} +func (_static *CompanionStruct_Default___) ECDH__COMMITMENT__KEY__INDEX() _dafny.Int { + return _dafny.IntOfInt64(32) +} +func (_static *CompanionStruct_Default___) ECDH__WRAPPED__KEY__MATERIAL__INDEX() _dafny.Int { + return _dafny.IntOfInt64(64) +} +func (_static *CompanionStruct_Default___) ECDH__KDF__STRING() _dafny.Sequence { + return _dafny.SeqOfString("ecdh-key-derivation") +} +func (_static *CompanionStruct_Default___) ECDH__KDF__PRF__STRING() _dafny.Sequence { + return _dafny.SeqOfString("HMAC_SHA384") +} +func (_static *CompanionStruct_Default___) ECDH__KDF__DELIMETER() _dafny.Sequence { + return _dafny.SeqOf(uint8(0)) +} +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__256__LEN() uint32 { + return uint32(75) +} +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__384__LEN() uint32 { + return uint32(107) +} +func (_static *CompanionStruct_Default___) ECDH__PROVIDER__INFO__521__LEN() uint32 { + return uint32(143) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__LEN__ECC__NIST__256() _dafny.Int { + return _dafny.IntOfInt64(91) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__LEN__ECC__NIST__384() _dafny.Int { + return _dafny.IntOfInt64(120) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__LEN__ECC__NIST__521() _dafny.Int { + return _dafny.IntOfInt64(158) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__256() _dafny.Int { + return _dafny.IntOfInt64(33) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__384() _dafny.Int { + return _dafny.IntOfInt64(49) +} +func (_static *CompanionStruct_Default___) ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__521() _dafny.Int { + return _dafny.IntOfInt64(67) +} +func (_static *CompanionStruct_Default___) CIPHERTEXT__WRAPPED__MATERIAL__INDEX() _dafny.Int { + return _dafny.IntOfInt64(68) +} +func (_static *CompanionStruct_Default___) PROVIDER__ID__HIERARCHY() _dafny.Sequence { + var _0_s _dafny.Sequence = _dafny.SeqOf(uint8(97), uint8(119), uint8(115), uint8(45), uint8(107), uint8(109), uint8(115), uint8(45), uint8(104), uint8(105), uint8(101), uint8(114), uint8(97), uint8(114), uint8(99), uint8(104), uint8(121)) + _ = _0_s + return _0_s +} +func (_static *CompanionStruct_Default___) RSA__PROVIDER__ID() _dafny.Sequence { + var _0_s _dafny.Sequence = _dafny.SeqOf(uint8(97), uint8(119), uint8(115), uint8(45), uint8(107), uint8(109), uint8(115), uint8(45), uint8(114), uint8(115), uint8(97)) + _ = _0_s + return _0_s +} +func (_static *CompanionStruct_Default___) KMS__ECDH__PROVIDER__ID() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("aws-kms-ecdh")) +} +func (_static *CompanionStruct_Default___) RAW__ECDH__PROVIDER__ID() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("raw-ecdh")) +} +func (_static *CompanionStruct_Default___) ECDH__KDF__PRF__NAME() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("HMAC_SHA384")) +} +func (_static *CompanionStruct_Default___) ECDH__KDF__UTF8() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("ecdh-key-derivation")) +} + +// End of class Default__ + +// Definition of class AwsKmsEncryptedDataKey +type AwsKmsEncryptedDataKey struct { +} + +func New_AwsKmsEncryptedDataKey_() *AwsKmsEncryptedDataKey { + _this := AwsKmsEncryptedDataKey{} + + return &_this +} + +type CompanionStruct_AwsKmsEncryptedDataKey_ struct { +} + +var Companion_AwsKmsEncryptedDataKey_ = CompanionStruct_AwsKmsEncryptedDataKey_{} + +func (*AwsKmsEncryptedDataKey) String() string { + return "Constants.AwsKmsEncryptedDataKey" +} + +// End of class AwsKmsEncryptedDataKey + +func Type_AwsKmsEncryptedDataKey_() _dafny.TypeDescriptor { + return type_AwsKmsEncryptedDataKey_{} +} + +type type_AwsKmsEncryptedDataKey_ struct { +} + +func (_this type_AwsKmsEncryptedDataKey_) Default() interface{} { + return m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Default() +} + +func (_this type_AwsKmsEncryptedDataKey_) String() string { + return "Constants.AwsKmsEncryptedDataKey" +} +func (_this *CompanionStruct_AwsKmsEncryptedDataKey_) Is_(__source m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) bool { + var _0_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = (__source) + _ = _0_edk + return (_dafny.Companion_Sequence_.Equal((_0_edk).Dtor_keyProviderId(), Companion_Default___.PROVIDER__ID())) && (m_UTF8.Companion_Default___.ValidUTF8Seq((_0_edk).Dtor_keyProviderInfo())) +} + +// Definition of datatype AwsKmsEdkHelper +type AwsKmsEdkHelper struct { + Data_AwsKmsEdkHelper_ +} + +func (_this AwsKmsEdkHelper) Get_() Data_AwsKmsEdkHelper_ { + return _this.Data_AwsKmsEdkHelper_ +} + +type Data_AwsKmsEdkHelper_ interface { + isAwsKmsEdkHelper() +} + +type CompanionStruct_AwsKmsEdkHelper_ struct { +} + +var Companion_AwsKmsEdkHelper_ = CompanionStruct_AwsKmsEdkHelper_{} + +type AwsKmsEdkHelper_AwsKmsEdkHelper struct { + Edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + Arn m_AwsArnParsing.AwsArn +} + +func (AwsKmsEdkHelper_AwsKmsEdkHelper) isAwsKmsEdkHelper() {} + +func (CompanionStruct_AwsKmsEdkHelper_) Create_AwsKmsEdkHelper_(Edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey, Arn m_AwsArnParsing.AwsArn) AwsKmsEdkHelper { + return AwsKmsEdkHelper{AwsKmsEdkHelper_AwsKmsEdkHelper{Edk, Arn}} +} + +func (_this AwsKmsEdkHelper) Is_AwsKmsEdkHelper() bool { + _, ok := _this.Get_().(AwsKmsEdkHelper_AwsKmsEdkHelper) + return ok +} + +func (CompanionStruct_AwsKmsEdkHelper_) Default() AwsKmsEdkHelper { + return Companion_AwsKmsEdkHelper_.Create_AwsKmsEdkHelper_(m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Default(), m_AwsArnParsing.Companion_AwsArn_.Default()) +} + +func (_this AwsKmsEdkHelper) Dtor_edk() m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey { + return _this.Get_().(AwsKmsEdkHelper_AwsKmsEdkHelper).Edk +} + +func (_this AwsKmsEdkHelper) Dtor_arn() m_AwsArnParsing.AwsArn { + return _this.Get_().(AwsKmsEdkHelper_AwsKmsEdkHelper).Arn +} + +func (_this AwsKmsEdkHelper) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AwsKmsEdkHelper_AwsKmsEdkHelper: + { + return "Constants.AwsKmsEdkHelper.AwsKmsEdkHelper" + "(" + _dafny.String(data.Edk) + ", " + _dafny.String(data.Arn) + ")" + } + default: + { + return "" + } + } +} + +func (_this AwsKmsEdkHelper) Equals(other AwsKmsEdkHelper) bool { + switch data1 := _this.Get_().(type) { + case AwsKmsEdkHelper_AwsKmsEdkHelper: + { + data2, ok := other.Get_().(AwsKmsEdkHelper_AwsKmsEdkHelper) + return ok && data1.Edk.Equals(data2.Edk) && data1.Arn.Equals(data2.Arn) + } + default: + { + return false // unexpected + } + } +} + +func (_this AwsKmsEdkHelper) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AwsKmsEdkHelper) + return ok && _this.Equals(typed) +} + +func Type_AwsKmsEdkHelper_() _dafny.TypeDescriptor { + return type_AwsKmsEdkHelper_{} +} + +type type_AwsKmsEdkHelper_ struct { +} + +func (_this type_AwsKmsEdkHelper_) Default() interface{} { + return Companion_AwsKmsEdkHelper_.Default() +} + +func (_this type_AwsKmsEdkHelper_) String() string { + return "Constants.AwsKmsEdkHelper" +} +func (_this AwsKmsEdkHelper) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AwsKmsEdkHelper{} + +// End of datatype AwsKmsEdkHelper diff --git a/releases/go/mpl/CreateKeyStoreTable/CreateKeyStoreTable.go b/releases/go/mpl/CreateKeyStoreTable/CreateKeyStoreTable.go new file mode 100644 index 000000000..8b9775971 --- /dev/null +++ b/releases/go/mpl/CreateKeyStoreTable/CreateKeyStoreTable.go @@ -0,0 +1,270 @@ +// Package CreateKeyStoreTable +// Dafny module CreateKeyStoreTable compiled into Go + +package CreateKeyStoreTable + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "CreateKeyStoreTable.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) KeyStoreHasExpectedConstruction_q(t m_ComAmazonawsDynamodbTypes.TableDescription) bool { + return (((((((t).Dtor_AttributeDefinitions()).Is_Some()) && (((t).Dtor_KeySchema()).Is_Some())) && (((t).Dtor_TableName()).Is_Some())) && (((t).Dtor_TableArn()).Is_Some())) && ((m_Seq.Companion_Default___.ToSet(Companion_Default___.ATTRIBUTE__DEFINITIONS())).IsSubsetOf(m_Seq.Companion_Default___.ToSet(((t).Dtor_AttributeDefinitions()).Dtor_value().(_dafny.Sequence))))) && ((m_Seq.Companion_Default___.ToSet(Companion_Default___.KEY__SCHEMA())).IsSubsetOf(m_Seq.Companion_Default___.ToSet(((t).Dtor_KeySchema()).Dtor_value().(_dafny.Sequence)))) +} +func (_static *CompanionStruct_Default___) CreateKeyStoreTable(tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = res + var _0_maybeDescribeTableResponse m_Wrappers.Result + _ = _0_maybeDescribeTableResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).DescribeTable(m_ComAmazonawsDynamodbTypes.Companion_DescribeTableInput_.Create_DescribeTableInput_(tableName)) + _0_maybeDescribeTableResponse = _out0 + if (_0_maybeDescribeTableResponse).Is_Failure() { + var _1_error m_ComAmazonawsDynamodbTypes.Error + _ = _1_error + _1_error = (_0_maybeDescribeTableResponse).Dtor_error().(m_ComAmazonawsDynamodbTypes.Error) + if (_1_error).Is_ResourceNotFoundException() { + var _2_maybeCreateTableResponse m_Wrappers.Result + _ = _2_maybeCreateTableResponse + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (ddbClient).CreateTable(m_ComAmazonawsDynamodbTypes.Companion_CreateTableInput_.Create_CreateTableInput_(Companion_Default___.ATTRIBUTE__DEFINITIONS(), tableName, Companion_Default___.KEY__SCHEMA(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_(m_ComAmazonawsDynamodbTypes.Companion_BillingMode_.Create_PAY__PER__REQUEST_()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_())) + _2_maybeCreateTableResponse = _out1 + if (_2_maybeCreateTableResponse).Is_Failure() { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_((_2_maybeCreateTableResponse).Dtor_error().(m_ComAmazonawsDynamodbTypes.Error))) + } else { + var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError0 + _3_valueOrError0 = m_Wrappers.Companion_Default___.Need((((((_2_maybeCreateTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.CreateTableOutput)).Dtor_TableDescription()).Is_Some()) && (Companion_Default___.KeyStoreHasExpectedConstruction_q((((_2_maybeCreateTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.CreateTableOutput)).Dtor_TableDescription()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)))) && (m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__TableArn((((((_2_maybeCreateTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.CreateTableOutput)).Dtor_TableDescription()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)).Dtor_TableArn()).Dtor_value().(_dafny.Sequence))), Companion_Default___.E(_dafny.SeqOfString("Configured table name does not conform to expected Key Store construction."))) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_((((((_2_maybeCreateTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.CreateTableOutput)).Dtor_TableDescription()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)).Dtor_TableArn()).Dtor_value().(_dafny.Sequence)) + } + } else { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_1_error)) + } + } else { + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError1 + _4_valueOrError1 = m_Wrappers.Companion_Default___.Need((((((_0_maybeDescribeTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.DescribeTableOutput)).Dtor_Table()).Is_Some()) && (Companion_Default___.KeyStoreHasExpectedConstruction_q((((_0_maybeDescribeTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.DescribeTableOutput)).Dtor_Table()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)))) && (m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__TableArn((((((_0_maybeDescribeTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.DescribeTableOutput)).Dtor_Table()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)).Dtor_TableArn()).Dtor_value().(_dafny.Sequence))), Companion_Default___.E(_dafny.SeqOfString("Configured table name does not conform to expected Key Store construction."))) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_((((((_0_maybeDescribeTableResponse).Dtor_value().(m_ComAmazonawsDynamodbTypes.DescribeTableOutput)).Dtor_Table()).Dtor_value().(m_ComAmazonawsDynamodbTypes.TableDescription)).Dtor_TableArn()).Dtor_value().(_dafny.Sequence)) + } + return res +} +func (_static *CompanionStruct_Default___) E(s _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(s) +} +func (_static *CompanionStruct_Default___) ATTRIBUTE__DEFINITIONS() _dafny.Sequence { + return _dafny.SeqOf(m_ComAmazonawsDynamodbTypes.Companion_AttributeDefinition_.Create_AttributeDefinition_(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_ScalarAttributeType_.Create_S_()), m_ComAmazonawsDynamodbTypes.Companion_AttributeDefinition_.Create_AttributeDefinition_(m_Structure.Companion_Default___.TYPE__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_ScalarAttributeType_.Create_S_())) +} +func (_static *CompanionStruct_Default___) KEY__SCHEMA() _dafny.Sequence { + return _dafny.SeqOf(m_ComAmazonawsDynamodbTypes.Companion_KeySchemaElement_.Create_KeySchemaElement_(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_KeyType_.Create_HASH_()), m_ComAmazonawsDynamodbTypes.Companion_KeySchemaElement_.Create_KeySchemaElement_(m_Structure.Companion_Default___.TYPE__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_KeyType_.Create_RANGE_())) +} + +// End of class Default__ + +// Definition of class KeyStoreDescription +type KeyStoreDescription struct { +} + +func New_KeyStoreDescription_() *KeyStoreDescription { + _this := KeyStoreDescription{} + + return &_this +} + +type CompanionStruct_KeyStoreDescription_ struct { +} + +var Companion_KeyStoreDescription_ = CompanionStruct_KeyStoreDescription_{} + +func (*KeyStoreDescription) String() string { + return "CreateKeyStoreTable.KeyStoreDescription" +} + +// End of class KeyStoreDescription + +func Type_KeyStoreDescription_() _dafny.TypeDescriptor { + return type_KeyStoreDescription_{} +} + +type type_KeyStoreDescription_ struct { +} + +func (_this type_KeyStoreDescription_) Default() interface{} { + return m_ComAmazonawsDynamodbTypes.Companion_TableDescription_.Default() +} + +func (_this type_KeyStoreDescription_) String() string { + return "CreateKeyStoreTable.KeyStoreDescription" +} +func (_this *CompanionStruct_KeyStoreDescription_) Is_(__source m_ComAmazonawsDynamodbTypes.TableDescription) bool { + var _0_t m_ComAmazonawsDynamodbTypes.TableDescription = (__source) + _ = _0_t + return Companion_Default___.KeyStoreHasExpectedConstruction_q(_0_t) +} diff --git a/releases/go/mpl/CreateKeys/CreateKeys.go b/releases/go/mpl/CreateKeys/CreateKeys.go new file mode 100644 index 000000000..455019075 --- /dev/null +++ b/releases/go/mpl/CreateKeys/CreateKeys.go @@ -0,0 +1,358 @@ +// Package CreateKeys +// Dafny module CreateKeys compiled into Go + +package CreateKeys + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "CreateKeys.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) CreateBranchAndBeaconKeys(branchKeyIdentifier _dafny.Sequence, customEncryptionContext _dafny.Map, timestamp _dafny.Sequence, branchKeyVersion _dafny.Sequence, ddbTableName _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_CreateKeyOutput_.Default()) + _ = output + var _0_decryptOnlyEncryptionContext _dafny.Map + _ = _0_decryptOnlyEncryptionContext + _0_decryptOnlyEncryptionContext = m_Structure.Companion_Default___.DecryptOnlyBranchKeyEncryptionContext(branchKeyIdentifier, branchKeyVersion, timestamp, logicalKeyStoreName, m_KMSKeystoreOperations.Companion_Default___.GetKeyId(kmsConfiguration), customEncryptionContext) + var _1_activeEncryptionContext _dafny.Map + _ = _1_activeEncryptionContext + _1_activeEncryptionContext = m_Structure.Companion_Default___.ActiveBranchKeyEncryptionContext(_0_decryptOnlyEncryptionContext) + var _2_beaconEncryptionContext _dafny.Map + _ = _2_beaconEncryptionContext + _2_beaconEncryptionContext = m_Structure.Companion_Default___.BeaconKeyEncryptionContext(_0_decryptOnlyEncryptionContext) + var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError0 + _3_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _0_decryptOnlyEncryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid KMS Key ARN configured for GenerateDataKeyWithoutPlaintext in CreateBranchAndBeaconKeys."))) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextResponse_.Default()) + _ = _4_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_KMSKeystoreOperations.Companion_Default___.GenerateKey(_0_decryptOnlyEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _4_valueOrError1 = _out0 + if (_4_valueOrError1).IsFailure() { + output = (_4_valueOrError1).PropagateFailure() + return output + } + var _5_wrappedDecryptOnlyBranchKey m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse + _ = _5_wrappedDecryptOnlyBranchKey + _5_wrappedDecryptOnlyBranchKey = (_4_valueOrError1).Extract().(m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse) + var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError2 + _6_valueOrError2 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _1_activeEncryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid KMS Key ARN configured for ReEncrypt in CreateBranchAndBeaconKeys."))) + if (_6_valueOrError2).IsFailure() { + output = (_6_valueOrError2).PropagateFailure() + return output + } + var _7_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_ReEncryptResponse_.Default()) + _ = _7_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_KMSKeystoreOperations.Companion_Default___.ReEncryptKey(((_5_wrappedDecryptOnlyBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence), _0_decryptOnlyEncryptionContext, _1_activeEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _7_valueOrError3 = _out1 + if (_7_valueOrError3).IsFailure() { + output = (_7_valueOrError3).PropagateFailure() + return output + } + var _8_wrappedActiveBranchKey m_ComAmazonawsKmsTypes.ReEncryptResponse + _ = _8_wrappedActiveBranchKey + _8_wrappedActiveBranchKey = (_7_valueOrError3).Extract().(m_ComAmazonawsKmsTypes.ReEncryptResponse) + var _9_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError4 + _9_valueOrError4 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _2_beaconEncryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid KMS Key ARN configured for GenerateDataKeyWithoutPlaintext(beacon key) in CreateBranchAndBeaconKeys."))) + if (_9_valueOrError4).IsFailure() { + output = (_9_valueOrError4).PropagateFailure() + return output + } + var _10_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextResponse_.Default()) + _ = _10_valueOrError5 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_KMSKeystoreOperations.Companion_Default___.GenerateKey(_2_beaconEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _10_valueOrError5 = _out2 + if (_10_valueOrError5).IsFailure() { + output = (_10_valueOrError5).PropagateFailure() + return output + } + var _11_wrappedBeaconKey m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse + _ = _11_wrappedBeaconKey + _11_wrappedBeaconKey = (_10_valueOrError5).Extract().(m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse) + var _12_decryptOnlyBranchKeyItem _dafny.Map + _ = _12_decryptOnlyBranchKeyItem + _12_decryptOnlyBranchKeyItem = m_Structure.Companion_Default___.ToAttributeMap(_0_decryptOnlyEncryptionContext, ((_5_wrappedDecryptOnlyBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence)) + var _13_activeBranchKeyItem _dafny.Map + _ = _13_activeBranchKeyItem + _13_activeBranchKeyItem = m_Structure.Companion_Default___.ToAttributeMap(_1_activeEncryptionContext, ((_8_wrappedActiveBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence)) + var _14_beaconKeyItem _dafny.Map + _ = _14_beaconKeyItem + _14_beaconKeyItem = m_Structure.Companion_Default___.ToAttributeMap(_2_beaconEncryptionContext, ((_11_wrappedBeaconKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence)) + var _15_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = _15_valueOrError6 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_DDBKeystoreOperations.Companion_Default___.WriteNewKeyToStore(_12_decryptOnlyBranchKeyItem, _13_activeBranchKeyItem, _14_beaconKeyItem, ddbTableName, ddbClient) + _15_valueOrError6 = _out3 + if (_15_valueOrError6).IsFailure() { + output = (_15_valueOrError6).PropagateFailure() + return output + } + var _16___v0 m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput + _ = _16___v0 + _16___v0 = (_15_valueOrError6).Extract().(m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_CreateKeyOutput_.Create_CreateKeyOutput_(branchKeyIdentifier)) + return output +} +func (_static *CompanionStruct_Default___) VersionActiveBranchKey(input m_AwsCryptographyKeyStoreTypes.VersionKeyInput, timestamp _dafny.Sequence, branchKeyVersion _dafny.Sequence, ddbTableName _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_VersionKeyOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_DDBKeystoreOperations.Companion_Default___.GetActiveBranchKeyItem((input).Dtor_branchKeyIdentifier(), ddbTableName, ddbClient) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_oldActiveItem _dafny.Map + _ = _1_oldActiveItem + _1_oldActiveItem = (_0_valueOrError0).Extract().(_dafny.Map) + var _2_oldActiveEncryptionContext _dafny.Map + _ = _2_oldActiveEncryptionContext + _2_oldActiveEncryptionContext = m_Structure.Companion_Default___.ToBranchKeyContext(_1_oldActiveItem, logicalKeyStoreName) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need((true) && (m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _2_oldActiveEncryptionContext)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.VERSION__KEY__KMS__KEY__ARN__DISAGREEMENT())) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_ReEncryptResponse_.Default()) + _ = _4_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_KMSKeystoreOperations.Companion_Default___.ReEncryptKey(((_1_oldActiveItem).Get(m_Structure.Companion_Default___.BRANCH__KEY__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_B(), _2_oldActiveEncryptionContext, _2_oldActiveEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _4_valueOrError2 = _out1 + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5___v1 m_ComAmazonawsKmsTypes.ReEncryptResponse + _ = _5___v1 + _5___v1 = (_4_valueOrError2).Extract().(m_ComAmazonawsKmsTypes.ReEncryptResponse) + var _6_decryptOnlyEncryptionContext _dafny.Map + _ = _6_decryptOnlyEncryptionContext + _6_decryptOnlyEncryptionContext = m_Structure.Companion_Default___.NewVersionFromActiveBranchKeyEncryptionContext(_2_oldActiveEncryptionContext, branchKeyVersion, timestamp) + var _7_activeEncryptionContext _dafny.Map + _ = _7_activeEncryptionContext + _7_activeEncryptionContext = m_Structure.Companion_Default___.ActiveBranchKeyEncryptionContext(_6_decryptOnlyEncryptionContext) + var _8_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextResponse_.Default()) + _ = _8_valueOrError3 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_KMSKeystoreOperations.Companion_Default___.GenerateKey(_6_decryptOnlyEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _8_valueOrError3 = _out2 + if (_8_valueOrError3).IsFailure() { + output = (_8_valueOrError3).PropagateFailure() + return output + } + var _9_wrappedDecryptOnlyBranchKey m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse + _ = _9_wrappedDecryptOnlyBranchKey + _9_wrappedDecryptOnlyBranchKey = (_8_valueOrError3).Extract().(m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse) + var _10_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_ReEncryptResponse_.Default()) + _ = _10_valueOrError4 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_KMSKeystoreOperations.Companion_Default___.ReEncryptKey(((_9_wrappedDecryptOnlyBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence), _6_decryptOnlyEncryptionContext, _7_activeEncryptionContext, kmsConfiguration, grantTokens, kmsClient) + _10_valueOrError4 = _out3 + if (_10_valueOrError4).IsFailure() { + output = (_10_valueOrError4).PropagateFailure() + return output + } + var _11_wrappedActiveBranchKey m_ComAmazonawsKmsTypes.ReEncryptResponse + _ = _11_wrappedActiveBranchKey + _11_wrappedActiveBranchKey = (_10_valueOrError4).Extract().(m_ComAmazonawsKmsTypes.ReEncryptResponse) + var _12_decryptOnlyBranchKeyItem _dafny.Map + _ = _12_decryptOnlyBranchKeyItem + _12_decryptOnlyBranchKeyItem = m_Structure.Companion_Default___.ToAttributeMap(_6_decryptOnlyEncryptionContext, ((_9_wrappedDecryptOnlyBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence)) + var _13_activeBranchKeyItem _dafny.Map + _ = _13_activeBranchKeyItem + _13_activeBranchKeyItem = m_Structure.Companion_Default___.ToAttributeMap(_7_activeEncryptionContext, ((_11_wrappedActiveBranchKey).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence)) + var _14_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = _14_valueOrError5 + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_DDBKeystoreOperations.Companion_Default___.WriteNewBranchKeyVersionToKeystore(_12_decryptOnlyBranchKeyItem, _13_activeBranchKeyItem, ddbTableName, ddbClient) + _14_valueOrError5 = _out4 + if (_14_valueOrError5).IsFailure() { + output = (_14_valueOrError5).PropagateFailure() + return output + } + var _15___v2 m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput + _ = _15___v2 + _15___v2 = (_14_valueOrError5).Extract().(m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_VersionKeyOutput_.Create_VersionKeyOutput_()) + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/DDBKeystoreOperations/DDBKeystoreOperations.go b/releases/go/mpl/DDBKeystoreOperations/DDBKeystoreOperations.go new file mode 100644 index 000000000..02f7f9e80 --- /dev/null +++ b/releases/go/mpl/DDBKeystoreOperations/DDBKeystoreOperations.go @@ -0,0 +1,534 @@ +// Package DDBKeystoreOperations +// Dafny module DDBKeystoreOperations compiled into Go + +package DDBKeystoreOperations + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "DDBKeystoreOperations.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) WriteNewKeyToStore(versionBranchKeyItem _dafny.Map, activeBranchKeyItem _dafny.Map, beaconKeyItem _dafny.Map, tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = output + var _0_items _dafny.Sequence + _ = _0_items + _0_items = _dafny.SeqOf(Companion_Default___.CreateTransactWritePutItem(versionBranchKeyItem, tableName, Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_()), Companion_Default___.CreateTransactWritePutItem(activeBranchKeyItem, tableName, Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_()), Companion_Default___.CreateTransactWritePutItem(beaconKeyItem, tableName, Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_())) + var _1_transactRequest m_ComAmazonawsDynamodbTypes.TransactWriteItemsInput + _ = _1_transactRequest + _1_transactRequest = m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsInput_.Create_TransactWriteItemsInput_(_0_items, m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeTransactWriteResponse m_Wrappers.Result + _ = _2_maybeTransactWriteResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).TransactWriteItems(_1_transactRequest) + _2_maybeTransactWriteResponse = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeTransactWriteResponse).MapFailure(func(coer14 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg14 interface{}) interface{} { + return coer14(arg14.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_4_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _5_transactWriteItemsResponse m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput + _ = _5_transactWriteItemsResponse + _5_transactWriteItemsResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput) + output = m_Wrappers.Companion_Result_.Create_Success_(_5_transactWriteItemsResponse) + return output +} +func (_static *CompanionStruct_Default___) WriteNewBranchKeyVersionToKeystore(versionBranchKeyItem _dafny.Map, activeBranchKeyItem _dafny.Map, tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = output + var _0_items _dafny.Sequence + _ = _0_items + _0_items = _dafny.SeqOf(Companion_Default___.CreateTransactWritePutItem(versionBranchKeyItem, tableName, Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_()), Companion_Default___.CreateTransactWritePutItem(activeBranchKeyItem, tableName, Companion_ConditionExpression_.Create_BRANCH__KEY__EXISTS_())) + var _1_transactRequest m_ComAmazonawsDynamodbTypes.TransactWriteItemsInput + _ = _1_transactRequest + _1_transactRequest = m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsInput_.Create_TransactWriteItemsInput_(_0_items, m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeTransactWriteResponse m_Wrappers.Result + _ = _2_maybeTransactWriteResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).TransactWriteItems(_1_transactRequest) + _2_maybeTransactWriteResponse = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItemsOutput_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeTransactWriteResponse).MapFailure(func(coer15 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg15 interface{}) interface{} { + return coer15(arg15.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_4_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _5_transactWriteItemsResponse m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput + _ = _5_transactWriteItemsResponse + _5_transactWriteItemsResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsDynamodbTypes.TransactWriteItemsOutput) + output = m_Wrappers.Companion_Result_.Create_Success_(_5_transactWriteItemsResponse) + return output +} +func (_static *CompanionStruct_Default___) GetActiveBranchKeyItem(branchKeyIdentifier _dafny.Sequence, tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_dynamoDbKey _dafny.Map + _ = _0_dynamoDbKey + _0_dynamoDbKey = _dafny.NewMapBuilder().ToMap().UpdateUnsafe(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(branchKeyIdentifier)).UpdateUnsafe(m_Structure.Companion_Default___.TYPE__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(m_Structure.Companion_Default___.BRANCH__KEY__ACTIVE__TYPE())) + var _1_ItemRequest m_ComAmazonawsDynamodbTypes.GetItemInput + _ = _1_ItemRequest + _1_ItemRequest = m_ComAmazonawsDynamodbTypes.Companion_GetItemInput_.Create_GetItemInput_(tableName, _0_dynamoDbKey, m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeGetItem m_Wrappers.Result + _ = _2_maybeGetItem + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).GetItem(_1_ItemRequest) + _2_maybeGetItem = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_GetItemOutput_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeGetItem).MapFailure(func(coer16 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg16 interface{}) interface{} { + return coer16(arg16.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_4_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _5_getItemResponse m_ComAmazonawsDynamodbTypes.GetItemOutput + _ = _5_getItemResponse + _5_getItemResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsDynamodbTypes.GetItemOutput) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((((_5_getItemResponse).Dtor_Item()).Is_Some()) && (((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Cardinality()).Cmp(_dafny.One) >= 0), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.NO__CORRESPONDING__BRANCH__KEY())) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need((m_Structure.Companion_Default___.ActiveBranchKeyItem_q(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map))) && (_dafny.Companion_Sequence_.Equal(((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Get(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), branchKeyIdentifier)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Item found is not a valid active branch key."))) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)) + return output +} +func (_static *CompanionStruct_Default___) GetVersionBranchKeyItem(branchKeyIdentifier _dafny.Sequence, branchKeyVersion _dafny.Sequence, tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_dynamoDbKey _dafny.Map + _ = _0_dynamoDbKey + _0_dynamoDbKey = _dafny.NewMapBuilder().ToMap().UpdateUnsafe(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(branchKeyIdentifier)).UpdateUnsafe(m_Structure.Companion_Default___.TYPE__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(_dafny.Companion_Sequence_.Concatenate(m_Structure.Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), branchKeyVersion))) + var _1_ItemRequest m_ComAmazonawsDynamodbTypes.GetItemInput + _ = _1_ItemRequest + _1_ItemRequest = m_ComAmazonawsDynamodbTypes.Companion_GetItemInput_.Create_GetItemInput_(tableName, _0_dynamoDbKey, m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeGetItem m_Wrappers.Result + _ = _2_maybeGetItem + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).GetItem(_1_ItemRequest) + _2_maybeGetItem = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_GetItemOutput_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeGetItem).MapFailure(func(coer17 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg17 interface{}) interface{} { + return coer17(arg17.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_4_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _5_getItemResponse m_ComAmazonawsDynamodbTypes.GetItemOutput + _ = _5_getItemResponse + _5_getItemResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsDynamodbTypes.GetItemOutput) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((((_5_getItemResponse).Dtor_Item()).Is_Some()) && (((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Cardinality()).Cmp(_dafny.One) >= 0), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.NO__CORRESPONDING__BRANCH__KEY())) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need(((m_Structure.Companion_Default___.VersionBranchKeyItem_q(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map))) && (_dafny.Companion_Sequence_.Equal(((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Get(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), branchKeyIdentifier))) && (_dafny.Companion_Sequence_.Equal(((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Get(m_Structure.Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), _dafny.Companion_Sequence_.Concatenate(m_Structure.Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), branchKeyVersion))), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Item found is not a valid branch key version."))) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)) + return output +} +func (_static *CompanionStruct_Default___) GetBeaconKeyItem(branchKeyIdentifier _dafny.Sequence, tableName _dafny.Sequence, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_dynamoDbKey _dafny.Map + _ = _0_dynamoDbKey + _0_dynamoDbKey = _dafny.NewMapBuilder().ToMap().UpdateUnsafe(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(branchKeyIdentifier)).UpdateUnsafe(m_Structure.Companion_Default___.TYPE__FIELD(), m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_(m_Structure.Companion_Default___.BEACON__KEY__TYPE__VALUE())) + var _1_ItemRequest m_ComAmazonawsDynamodbTypes.GetItemInput + _ = _1_ItemRequest + _1_ItemRequest = m_ComAmazonawsDynamodbTypes.Companion_GetItemInput_.Create_GetItemInput_(tableName, _0_dynamoDbKey, m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeGetItem m_Wrappers.Result + _ = _2_maybeGetItem + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (ddbClient).GetItem(_1_ItemRequest) + _2_maybeGetItem = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsDynamodbTypes.Companion_GetItemOutput_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeGetItem).MapFailure(func(coer18 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg18 interface{}) interface{} { + return coer18(arg18.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_4_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + output = (_3_valueOrError0).PropagateFailure() + return output + } + var _5_getItemResponse m_ComAmazonawsDynamodbTypes.GetItemOutput + _ = _5_getItemResponse + _5_getItemResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsDynamodbTypes.GetItemOutput) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((((_5_getItemResponse).Dtor_Item()).Is_Some()) && (((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Cardinality()).Cmp(_dafny.One) >= 0), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.NO__CORRESPONDING__BRANCH__KEY())) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need((m_Structure.Companion_Default___.BeaconKeyItem_q(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map))) && (_dafny.Companion_Sequence_.Equal(((((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)).Get(m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), branchKeyIdentifier)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Item found is not a valid beacon key."))) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(((_5_getItemResponse).Dtor_Item()).Dtor_value().(_dafny.Map)) + return output +} +func (_static *CompanionStruct_Default___) CreateTransactWritePutItem(item _dafny.Map, tableName _dafny.Sequence, conditionExpression ConditionExpression) m_ComAmazonawsDynamodbTypes.TransactWriteItem { + return m_ComAmazonawsDynamodbTypes.Companion_TransactWriteItem_.Create_TransactWriteItem_(m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_(m_ComAmazonawsDynamodbTypes.Companion_Put_.Create_Put_(item, tableName, m_Wrappers.Companion_Option_.Create_Some_(func() _dafny.Sequence { + var _source0 ConditionExpression = conditionExpression + _ = _source0 + { + if _source0.Is_BRANCH__KEY__NOT__EXIST() { + return Companion_Default___.BRANCH__KEY__NOT__EXIST__CONDITION() + } + } + { + return Companion_Default___.BRANCH__KEY__EXISTS__CONDITION() + } + }()), m_Wrappers.Companion_Option_.Create_Some_(Companion_Default___.BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAMES()), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_())), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAME() _dafny.Sequence { + return _dafny.SeqOfString("#BranchKeyIdentifierField") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAMES() _dafny.Map { + return _dafny.NewMapBuilder().ToMap().UpdateUnsafe(Companion_Default___.BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAME(), m_Structure.Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()) +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__NOT__EXIST__CONDITION() _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("attribute_not_exists("), Companion_Default___.BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAME()), _dafny.SeqOfString(")")) +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__EXISTS__CONDITION() _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("attribute_exists("), Companion_Default___.BRANCH__KEY__EXISTS__EXPRESSION__ATTRIBUTE__NAME()), _dafny.SeqOfString(")")) +} + +// End of class Default__ + +// Definition of datatype ConditionExpression +type ConditionExpression struct { + Data_ConditionExpression_ +} + +func (_this ConditionExpression) Get_() Data_ConditionExpression_ { + return _this.Data_ConditionExpression_ +} + +type Data_ConditionExpression_ interface { + isConditionExpression() +} + +type CompanionStruct_ConditionExpression_ struct { +} + +var Companion_ConditionExpression_ = CompanionStruct_ConditionExpression_{} + +type ConditionExpression_BRANCH__KEY__NOT__EXIST struct { +} + +func (ConditionExpression_BRANCH__KEY__NOT__EXIST) isConditionExpression() {} + +func (CompanionStruct_ConditionExpression_) Create_BRANCH__KEY__NOT__EXIST_() ConditionExpression { + return ConditionExpression{ConditionExpression_BRANCH__KEY__NOT__EXIST{}} +} + +func (_this ConditionExpression) Is_BRANCH__KEY__NOT__EXIST() bool { + _, ok := _this.Get_().(ConditionExpression_BRANCH__KEY__NOT__EXIST) + return ok +} + +type ConditionExpression_BRANCH__KEY__EXISTS struct { +} + +func (ConditionExpression_BRANCH__KEY__EXISTS) isConditionExpression() {} + +func (CompanionStruct_ConditionExpression_) Create_BRANCH__KEY__EXISTS_() ConditionExpression { + return ConditionExpression{ConditionExpression_BRANCH__KEY__EXISTS{}} +} + +func (_this ConditionExpression) Is_BRANCH__KEY__EXISTS() bool { + _, ok := _this.Get_().(ConditionExpression_BRANCH__KEY__EXISTS) + return ok +} + +func (CompanionStruct_ConditionExpression_) Default() ConditionExpression { + return Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_() +} + +func (_ CompanionStruct_ConditionExpression_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_ConditionExpression_.Create_BRANCH__KEY__NOT__EXIST_(), true + case 1: + return Companion_ConditionExpression_.Create_BRANCH__KEY__EXISTS_(), true + default: + return ConditionExpression{}, false + } + } +} + +func (_this ConditionExpression) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case ConditionExpression_BRANCH__KEY__NOT__EXIST: + { + return "DDBKeystoreOperations.ConditionExpression.BRANCH_KEY_NOT_EXIST" + } + case ConditionExpression_BRANCH__KEY__EXISTS: + { + return "DDBKeystoreOperations.ConditionExpression.BRANCH_KEY_EXISTS" + } + default: + { + return "" + } + } +} + +func (_this ConditionExpression) Equals(other ConditionExpression) bool { + switch _this.Get_().(type) { + case ConditionExpression_BRANCH__KEY__NOT__EXIST: + { + _, ok := other.Get_().(ConditionExpression_BRANCH__KEY__NOT__EXIST) + return ok + } + case ConditionExpression_BRANCH__KEY__EXISTS: + { + _, ok := other.Get_().(ConditionExpression_BRANCH__KEY__EXISTS) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this ConditionExpression) EqualsGeneric(other interface{}) bool { + typed, ok := other.(ConditionExpression) + return ok && _this.Equals(typed) +} + +func Type_ConditionExpression_() _dafny.TypeDescriptor { + return type_ConditionExpression_{} +} + +type type_ConditionExpression_ struct { +} + +func (_this type_ConditionExpression_) Default() interface{} { + return Companion_ConditionExpression_.Default() +} + +func (_this type_ConditionExpression_) String() string { + return "DDBKeystoreOperations.ConditionExpression" +} +func (_this ConditionExpression) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = ConditionExpression{} + +// End of datatype ConditionExpression diff --git a/releases/go/mpl/DefaultCMM/DefaultCMM.go b/releases/go/mpl/DefaultCMM/DefaultCMM.go new file mode 100644 index 000000000..86d9895a1 --- /dev/null +++ b/releases/go/mpl/DefaultCMM/DefaultCMM.go @@ -0,0 +1,484 @@ +// Package DefaultCMM +// Dafny module DefaultCMM compiled into Go + +package DefaultCMM + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_SortedSets "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/SortedSets" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ + +type Dummy__ struct{} + +// Definition of class DefaultCMM +type DefaultCMM struct { + _keyring m_AwsCryptographyMaterialProvidersTypes.IKeyring + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_DefaultCMM_() *DefaultCMM { + _this := DefaultCMM{} + + _this._keyring = (m_AwsCryptographyMaterialProvidersTypes.IKeyring)(nil) + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_DefaultCMM_ struct { +} + +var Companion_DefaultCMM_ = CompanionStruct_DefaultCMM_{} + +func (_this *DefaultCMM) Equals(other *DefaultCMM) bool { + return _this == other +} + +func (_this *DefaultCMM) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DefaultCMM) + return ok && _this.Equals(other) +} + +func (*DefaultCMM) String() string { + return "DefaultCMM.DefaultCMM" +} + +func Type_DefaultCMM_() _dafny.TypeDescriptor { + return type_DefaultCMM_{} +} + +type type_DefaultCMM_ struct { +} + +func (_this type_DefaultCMM_) Default() interface{} { + return (*DefaultCMM)(nil) +} + +func (_this type_DefaultCMM_) String() string { + return "DefaultCMM.DefaultCMM" +} +func (_this *DefaultCMM) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_CMM.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.TraitID_} +} + +var _ m_CMM.VerifiableInterface = &DefaultCMM{} +var _ m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager = &DefaultCMM{} +var _ _dafny.TraitOffspring = &DefaultCMM{} + +func (_this *DefaultCMM) DecryptMaterials(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.DecryptMaterials(_this, input) + return _out1 +} +func (_this *DefaultCMM) GetEncryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.GetEncryptionMaterials(_this, input) + return _out1 +} +func (_this *DefaultCMM) OfKeyring(k m_AwsCryptographyMaterialProvidersTypes.IKeyring, c *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyring = k + (_this)._cryptoPrimitives = c + } +} +func (_this *DefaultCMM) GetEncryptionMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(!((input).Dtor_encryptionContext()).Contains(m_Materials.Companion_Default___.EC__PUBLIC__KEY__FIELD()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Reserved Field found in EncryptionContext keys."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_algorithmId m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId + _ = _1_algorithmId + if ((input).Dtor_algorithmSuiteId()).Is_Some() { + _1_algorithmId = ((input).Dtor_algorithmSuiteId()).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId) + } else { + _1_algorithmId = m_Defaults.Companion_Default___.GetAlgorithmSuiteForCommitmentPolicy((input).Dtor_commitmentPolicy()) + } + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError1 + _2_valueOrError1 = m_Commitment.Companion_Default___.ValidateCommitmentPolicyOnEncrypt(_1_algorithmId, (input).Dtor_commitmentPolicy()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _3_suite + _3_suite = m_AlgorithmSuites.Companion_Default___.GetSuite(_1_algorithmId) + var _4_signingKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _4_signingKey + var _5_verificationKey m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _5_verificationKey + if ((_3_suite).Dtor_signature()).Is_ECDSA() { + var _6_maybeECDSAPair m_Wrappers.Result + _ = _6_maybeECDSAPair + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).GenerateECDSASignatureKey(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECDSASignatureKeyInput_.Create_GenerateECDSASignatureKeyInput_((((_3_suite).Dtor_signature()).Dtor_ECDSA()).Dtor_curve())) + _6_maybeECDSAPair = _out0 + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECDSASignatureKeyOutput_.Default()) + _ = _7_valueOrError2 + _7_valueOrError2 = (_6_maybeECDSAPair).MapFailure(func(coer129 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg130 interface{}) interface{} { + return coer129(arg130.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_8_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_8_e) + })) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + var _9_pair m_AwsCryptographyPrimitivesTypes.GenerateECDSASignatureKeyOutput + _ = _9_pair + _9_pair = (_7_valueOrError2).Extract().(m_AwsCryptographyPrimitivesTypes.GenerateECDSASignatureKeyOutput) + _4_signingKey = m_Wrappers.Companion_Option_.Create_Some_((_9_pair).Dtor_signingKey()) + _5_verificationKey = m_Wrappers.Companion_Option_.Create_Some_((_9_pair).Dtor_verificationKey()) + } else { + _4_signingKey = m_Wrappers.Companion_Option_.Create_None_() + _5_verificationKey = m_Wrappers.Companion_Option_.Create_None_() + } + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError3 + _10_valueOrError3 = m_Materials.Companion_Default___.InitializeEncryptionMaterials(m_AwsCryptographyMaterialProvidersTypes.Companion_InitializeEncryptionMaterialsInput_.Create_InitializeEncryptionMaterialsInput_(_1_algorithmId, (input).Dtor_encryptionContext(), ((input).Dtor_requiredEncryptionContextKeys()).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence), _4_signingKey, _5_verificationKey)) + if (_10_valueOrError3).IsFailure() { + output = (_10_valueOrError3).PropagateFailure() + return output + } + var _11_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _11_materials + _11_materials = (_10_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + var _12_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _12_valueOrError4 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = ((_this).Keyring()).OnEncrypt(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptInput_.Create_OnEncryptInput_(_11_materials)) + _12_valueOrError4 = _out1 + if (_12_valueOrError4).IsFailure() { + output = (_12_valueOrError4).PropagateFailure() + return output + } + var _13_result m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput + _ = _13_result + _13_result = (_12_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput) + var _14_encryptionMaterialsOutput m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput + _ = _14_encryptionMaterialsOutput + _14_encryptionMaterialsOutput = m_AwsCryptographyMaterialProvidersTypes.Companion_GetEncryptionMaterialsOutput_.Create_GetEncryptionMaterialsOutput_((_13_result).Dtor_materials()) + var _15_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _15_valueOrError5 + _15_valueOrError5 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.EncryptionMaterialsHasPlaintextDataKey((_14_encryptionMaterialsOutput).Dtor_encryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Could not retrieve materials required for encryption"))) + if (_15_valueOrError5).IsFailure() { + output = (_15_valueOrError5).PropagateFailure() + return output + } + var _16_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _16_valueOrError6 + _16_valueOrError6 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterialsTransition(_11_materials, (_14_encryptionMaterialsOutput).Dtor_encryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring returned an invalid response"))) + if (_16_valueOrError6).IsFailure() { + output = (_16_valueOrError6).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(_14_encryptionMaterialsOutput) + return output + } +} +func (_this *DefaultCMM) DecryptMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Commitment.Companion_Default___.ValidateCommitmentPolicyOnDecrypt((input).Dtor_algorithmSuiteId(), (input).Dtor_commitmentPolicy()) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_requiredEncryptionContextKeys _dafny.Sequence + _ = _1_requiredEncryptionContextKeys + _1_requiredEncryptionContextKeys = _dafny.SeqOf() + if ((input).Dtor_reproducedEncryptionContext()).Is_Some() { + var _2_keysSet _dafny.Set + _ = _2_keysSet + _2_keysSet = (((input).Dtor_reproducedEncryptionContext()).Dtor_value().(_dafny.Map)).Keys() + var _3_keysSeq _dafny.Sequence + _ = _3_keysSeq + var _out0 _dafny.Sequence + _ = _out0 + _out0 = m_SortedSets.SetToSequence(_2_keysSet) + _3_keysSeq = _out0 + var _4_i _dafny.Int + _ = _4_i + _4_i = _dafny.Zero + for (_4_i).Cmp(_dafny.IntOfUint32((_3_keysSeq).Cardinality())) < 0 { + var _5_key _dafny.Sequence + _ = _5_key + _5_key = (_3_keysSeq).Select((_4_i).Uint32()).(_dafny.Sequence) + if ((input).Dtor_encryptionContext()).Contains(_5_key) { + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal((((input).Dtor_reproducedEncryptionContext()).Dtor_value().(_dafny.Map)).Get(_5_key).(_dafny.Sequence), ((input).Dtor_encryptionContext()).Get(_5_key).(_dafny.Sequence)), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context does not match reproduced encryption context."))) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + } else { + _1_requiredEncryptionContextKeys = _dafny.Companion_Sequence_.Concatenate(_1_requiredEncryptionContextKeys, _dafny.SeqOf(_5_key)) + } + _4_i = (_4_i).Plus(_dafny.One) + } + } + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _7_valueOrError2 + _7_valueOrError2 = m_Materials.Companion_Default___.InitializeDecryptionMaterials(m_AwsCryptographyMaterialProvidersTypes.Companion_InitializeDecryptionMaterialsInput_.Create_InitializeDecryptionMaterialsInput_((input).Dtor_algorithmSuiteId(), ((input).Dtor_encryptionContext()).Merge(((input).Dtor_reproducedEncryptionContext()).UnwrapOr(_dafny.NewMapBuilder().ToMap()).(_dafny.Map)), _1_requiredEncryptionContextKeys)) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + var _8_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _8_materials + _8_materials = (_7_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + var _9_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _9_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = ((_this).Keyring()).OnDecrypt(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptInput_.Create_OnDecryptInput_(_8_materials, (input).Dtor_encryptedDataKeys())) + _9_valueOrError3 = _out1 + if (_9_valueOrError3).IsFailure() { + output = (_9_valueOrError3).PropagateFailure() + return output + } + var _10_result m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput + _ = _10_result + _10_result = (_9_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput) + var _11_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _11_valueOrError4 + _11_valueOrError4 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsTransitionIsValid(_8_materials, (_10_result).Dtor_materials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring.OnDecrypt failed to decrypt the plaintext data key."))) + if (_11_valueOrError4).IsFailure() { + output = (_11_valueOrError4).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_DecryptMaterialsOutput_.Create_DecryptMaterialsOutput_((_10_result).Dtor_materials())) + return output + return output + } +} +func (_this *DefaultCMM) Keyring() m_AwsCryptographyMaterialProvidersTypes.IKeyring { + { + return _this._keyring + } +} +func (_this *DefaultCMM) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class DefaultCMM diff --git a/releases/go/mpl/DefaultClientSupplier/DefaultClientSupplier.go b/releases/go/mpl/DefaultClientSupplier/DefaultClientSupplier.go new file mode 100644 index 000000000..48fb21d3a --- /dev/null +++ b/releases/go/mpl/DefaultClientSupplier/DefaultClientSupplier.go @@ -0,0 +1,299 @@ +// Package DefaultClientSupplier +// Dafny module DefaultClientSupplier compiled into Go + +package DefaultClientSupplier + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DefaultCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultCMM" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ +var _ m_DefaultCMM.Dummy__ + +type Dummy__ struct{} + +// Definition of class DefaultClientSupplier +type DefaultClientSupplier struct { + dummy byte +} + +func New_DefaultClientSupplier_() *DefaultClientSupplier { + _this := DefaultClientSupplier{} + + return &_this +} + +type CompanionStruct_DefaultClientSupplier_ struct { +} + +var Companion_DefaultClientSupplier_ = CompanionStruct_DefaultClientSupplier_{} + +func (_this *DefaultClientSupplier) Equals(other *DefaultClientSupplier) bool { + return _this == other +} + +func (_this *DefaultClientSupplier) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DefaultClientSupplier) + return ok && _this.Equals(other) +} + +func (*DefaultClientSupplier) String() string { + return "DefaultClientSupplier.DefaultClientSupplier" +} + +func Type_DefaultClientSupplier_() _dafny.TypeDescriptor { + return type_DefaultClientSupplier_{} +} + +type type_DefaultClientSupplier_ struct { +} + +func (_this type_DefaultClientSupplier_) Default() interface{} { + return (*DefaultClientSupplier)(nil) +} + +func (_this type_DefaultClientSupplier_) String() string { + return "DefaultClientSupplier.DefaultClientSupplier" +} +func (_this *DefaultClientSupplier) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.TraitID_} +} + +var _ m_AwsCryptographyMaterialProvidersTypes.IClientSupplier = &DefaultClientSupplier{} +var _ _dafny.TraitOffspring = &DefaultClientSupplier{} + +func (_this *DefaultClientSupplier) GetClient(input m_AwsCryptographyMaterialProvidersTypes.GetClientInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_IClientSupplier_.GetClient(_this, input) + return _out1 +} +func (_this *DefaultClientSupplier) Ctor__() { + { + } +} +func (_this *DefaultClientSupplier) GetClient_k(input m_AwsCryptographyMaterialProvidersTypes.GetClientInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_maybeClient m_Wrappers.Result + _ = _0_maybeClient + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Com_Amazonaws_Kms.Companion_Default___.KMSClientForRegion((input).Dtor_region()) + _0_maybeClient = _out0 + output = (_0_maybeClient).MapFailure(func(coer130 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg131 interface{}) interface{} { + return coer130(arg131.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_1_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_1_e) + })) + return output + return output + } +} + +// End of class DefaultClientSupplier diff --git a/releases/go/mpl/Defaults/Defaults.go b/releases/go/mpl/Defaults/Defaults.go new file mode 100644 index 000000000..1f8e827c1 --- /dev/null +++ b/releases/go/mpl/Defaults/Defaults.go @@ -0,0 +1,269 @@ +// Package Defaults +// Dafny module Defaults compiled into Go + +package Defaults + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Defaults.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) GetAlgorithmSuiteForCommitmentPolicy(commitmentPolicy m_AwsCryptographyMaterialProvidersTypes.CommitmentPolicy) m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + var _source0 m_AwsCryptographyMaterialProvidersTypes.CommitmentPolicy = commitmentPolicy + _ = _source0 + { + if _source0.Is_ESDK() { + var _0_c m_AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.CommitmentPolicy_ESDK).ESDK + _ = _0_c + var _source1 m_AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy = _0_c + _ = _source1 + { + if _source1.Is_FORBID__ENCRYPT__ALLOW__DECRYPT() { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__IV12__TAG16__HKDF__SHA384__ECDSA__P384_()) + } + } + { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_ESDK_(m_AwsCryptographyMaterialProvidersTypes.Companion_ESDKAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384_()) + } + } + } + { + return m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteId_.Create_DBE_(m_AwsCryptographyMaterialProvidersTypes.Companion_DBEAlgorithmSuiteId_.Create_ALG__AES__256__GCM__HKDF__SHA512__COMMIT__KEY__ECDSA__P384__SYMSIG__HMAC__SHA384_()) + } +} + +// End of class Default__ diff --git a/releases/go/mpl/DiscoveryMultiKeyring/DiscoveryMultiKeyring.go b/releases/go/mpl/DiscoveryMultiKeyring/DiscoveryMultiKeyring.go new file mode 100644 index 000000000..7ee9944df --- /dev/null +++ b/releases/go/mpl/DiscoveryMultiKeyring/DiscoveryMultiKeyring.go @@ -0,0 +1,267 @@ +// Package DiscoveryMultiKeyring +// Dafny module DiscoveryMultiKeyring compiled into Go + +package DiscoveryMultiKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "DiscoveryMultiKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DiscoveryMultiKeyring(regions _dafny.Sequence, discoveryFilter m_Wrappers.Option, clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier, grantTokens m_Wrappers.Option) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((regions).Cardinality())).Sign() == 1, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("No regions passed."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need((m_Seq.Companion_Default___.IndexOfOption(regions, _dafny.SeqOfString(""))).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Empty string is not a valid region."))) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_children _dafny.Sequence + _ = _2_children + _2_children = _dafny.SeqOf() + var _hi0 _dafny.Int = _dafny.IntOfUint32((regions).Cardinality()) + _ = _hi0 + for _3_i := _dafny.Zero; _3_i.Cmp(_hi0) < 0; _3_i = _3_i.Plus(_dafny.One) { + var _4_region _dafny.Sequence + _ = _4_region + _4_region = (regions).Select((_3_i).Uint32()).(_dafny.Sequence) + var _5_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _5_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_(_4_region)) + _5_valueOrError2 = _out0 + if (_5_valueOrError2).IsFailure() { + output = (_5_valueOrError2).PropagateFailure() + return output + } + var _6_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _6_client + _6_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_5_valueOrError2).Extract()) + var _7_keyring *m_AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring + _ = _7_keyring + var _nw0 *m_AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring = m_AwsKmsDiscoveryKeyring.New_AwsKmsDiscoveryKeyring_() + _ = _nw0 + _nw0.Ctor__(_6_client, discoveryFilter, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _7_keyring = _nw0 + _2_children = _dafny.Companion_Sequence_.Concatenate(_2_children, _dafny.SeqOf(_7_keyring)) + } + var _8_keyring *m_MultiKeyring.MultiKeyring + _ = _8_keyring + var _nw1 *m_MultiKeyring.MultiKeyring = m_MultiKeyring.New_MultiKeyring_() + _ = _nw1 + _nw1.Ctor__(m_Wrappers.Companion_Option_.Create_None_(), _2_children) + _8_keyring = _nw1 + output = m_Wrappers.Companion_Result_.Create_Success_(_8_keyring) + return output + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/EcdhEdkWrapping/EcdhEdkWrapping.go b/releases/go/mpl/EcdhEdkWrapping/EcdhEdkWrapping.go new file mode 100644 index 000000000..7b0026eba --- /dev/null +++ b/releases/go/mpl/EcdhEdkWrapping/EcdhEdkWrapping.go @@ -0,0 +1,1100 @@ +// Package EcdhEdkWrapping +// Dafny module EcdhEdkWrapping compiled into Go + +package EcdhEdkWrapping + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "EcdhEdkWrapping.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DeriveSharedKeyingMaterial(sharedSecret _dafny.Sequence, fixedInfo _dafny.Sequence, salt _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_maybeDerivedKeyingMaterial m_Wrappers.Result + _ = _0_maybeDerivedKeyingMaterial + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).KdfCounterMode(m_AwsCryptographyPrimitivesTypes.Companion_KdfCtrInput_.Create_KdfCtrInput_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_(), sharedSecret, m_Constants.Companion_Default___.KDF__EXPECTED__LEN(), m_Wrappers.Companion_Option_.Create_Some_(fixedInfo), m_Wrappers.Companion_Option_.Create_Some_(salt))) + _0_maybeDerivedKeyingMaterial = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeDerivedKeyingMaterial).MapFailure(func(coer102 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg103 interface{}) interface{} { + return coer102(arg103.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_derivedKeyingMaterial _dafny.Sequence + _ = _3_derivedKeyingMaterial + _3_derivedKeyingMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Success_(_3_derivedKeyingMaterial) + return res +} +func (_static *CompanionStruct_Default___) SerializeFixedInfo(ecdhKeyDerivationUtf8 _dafny.Sequence, curveSpecUtf8 _dafny.Sequence, senderPublicKey _dafny.Sequence, recipientPublicKey _dafny.Sequence, canonicalizedEC _dafny.Sequence, keyringVersion _dafny.Sequence) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(ecdhKeyDerivationUtf8, m_Constants.Companion_Default___.ECDH__KDF__DELIMETER()), curveSpecUtf8), m_Constants.Companion_Default___.ECDH__KDF__DELIMETER()), m_Constants.Companion_Default___.ECDH__KDF__PRF__NAME()), m_Constants.Companion_Default___.ECDH__KDF__DELIMETER()), senderPublicKey), recipientPublicKey), m_Constants.Companion_Default___.ECDH__KDF__DELIMETER()), keyringVersion), m_Constants.Companion_Default___.ECDH__KDF__DELIMETER()), canonicalizedEC) +} +func (_static *CompanionStruct_Default___) CurveSpecTypeToString(c m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec) _dafny.Sequence { + var _source0 m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec = c + _ = _source0 + { + if _source0.Is_ECC__NIST__P256() { + return _dafny.SeqOfString("p256") + } + } + { + if _source0.Is_ECC__NIST__P384() { + return _dafny.SeqOfString("p384") + } + } + { + if _source0.Is_ECC__NIST__P521() { + return _dafny.SeqOfString("p521") + } + } + { + return _dafny.SeqOfString("sm2") + } +} +func (_static *CompanionStruct_Default___) E(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} + +// End of class Default__ + +// Definition of datatype EcdhUnwrapInfo +type EcdhUnwrapInfo struct { + Data_EcdhUnwrapInfo_ +} + +func (_this EcdhUnwrapInfo) Get_() Data_EcdhUnwrapInfo_ { + return _this.Data_EcdhUnwrapInfo_ +} + +type Data_EcdhUnwrapInfo_ interface { + isEcdhUnwrapInfo() +} + +type CompanionStruct_EcdhUnwrapInfo_ struct { +} + +var Companion_EcdhUnwrapInfo_ = CompanionStruct_EcdhUnwrapInfo_{} + +type EcdhUnwrapInfo_EcdhUnwrapInfo struct { +} + +func (EcdhUnwrapInfo_EcdhUnwrapInfo) isEcdhUnwrapInfo() {} + +func (CompanionStruct_EcdhUnwrapInfo_) Create_EcdhUnwrapInfo_() EcdhUnwrapInfo { + return EcdhUnwrapInfo{EcdhUnwrapInfo_EcdhUnwrapInfo{}} +} + +func (_this EcdhUnwrapInfo) Is_EcdhUnwrapInfo() bool { + _, ok := _this.Get_().(EcdhUnwrapInfo_EcdhUnwrapInfo) + return ok +} + +func (CompanionStruct_EcdhUnwrapInfo_) Default() EcdhUnwrapInfo { + return Companion_EcdhUnwrapInfo_.Create_EcdhUnwrapInfo_() +} + +func (_ CompanionStruct_EcdhUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_EcdhUnwrapInfo_.Create_EcdhUnwrapInfo_(), true + default: + return EcdhUnwrapInfo{}, false + } + } +} + +func (_this EcdhUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case EcdhUnwrapInfo_EcdhUnwrapInfo: + { + return "EcdhEdkWrapping.EcdhUnwrapInfo.EcdhUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this EcdhUnwrapInfo) Equals(other EcdhUnwrapInfo) bool { + switch _this.Get_().(type) { + case EcdhUnwrapInfo_EcdhUnwrapInfo: + { + _, ok := other.Get_().(EcdhUnwrapInfo_EcdhUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this EcdhUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EcdhUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_EcdhUnwrapInfo_() _dafny.TypeDescriptor { + return type_EcdhUnwrapInfo_{} +} + +type type_EcdhUnwrapInfo_ struct { +} + +func (_this type_EcdhUnwrapInfo_) Default() interface{} { + return Companion_EcdhUnwrapInfo_.Default() +} + +func (_this type_EcdhUnwrapInfo_) String() string { + return "EcdhEdkWrapping.EcdhUnwrapInfo" +} +func (_this EcdhUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EcdhUnwrapInfo{} + +// End of datatype EcdhUnwrapInfo + +// Definition of datatype EcdhWrapInfo +type EcdhWrapInfo struct { + Data_EcdhWrapInfo_ +} + +func (_this EcdhWrapInfo) Get_() Data_EcdhWrapInfo_ { + return _this.Data_EcdhWrapInfo_ +} + +type Data_EcdhWrapInfo_ interface { + isEcdhWrapInfo() +} + +type CompanionStruct_EcdhWrapInfo_ struct { +} + +var Companion_EcdhWrapInfo_ = CompanionStruct_EcdhWrapInfo_{} + +type EcdhWrapInfo_EcdhWrapInfo struct { +} + +func (EcdhWrapInfo_EcdhWrapInfo) isEcdhWrapInfo() {} + +func (CompanionStruct_EcdhWrapInfo_) Create_EcdhWrapInfo_() EcdhWrapInfo { + return EcdhWrapInfo{EcdhWrapInfo_EcdhWrapInfo{}} +} + +func (_this EcdhWrapInfo) Is_EcdhWrapInfo() bool { + _, ok := _this.Get_().(EcdhWrapInfo_EcdhWrapInfo) + return ok +} + +func (CompanionStruct_EcdhWrapInfo_) Default() EcdhWrapInfo { + return Companion_EcdhWrapInfo_.Create_EcdhWrapInfo_() +} + +func (_ CompanionStruct_EcdhWrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_EcdhWrapInfo_.Create_EcdhWrapInfo_(), true + default: + return EcdhWrapInfo{}, false + } + } +} + +func (_this EcdhWrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case EcdhWrapInfo_EcdhWrapInfo: + { + return "EcdhEdkWrapping.EcdhWrapInfo.EcdhWrapInfo" + } + default: + { + return "" + } + } +} + +func (_this EcdhWrapInfo) Equals(other EcdhWrapInfo) bool { + switch _this.Get_().(type) { + case EcdhWrapInfo_EcdhWrapInfo: + { + _, ok := other.Get_().(EcdhWrapInfo_EcdhWrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this EcdhWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(EcdhWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_EcdhWrapInfo_() _dafny.TypeDescriptor { + return type_EcdhWrapInfo_{} +} + +type type_EcdhWrapInfo_ struct { +} + +func (_this type_EcdhWrapInfo_) Default() interface{} { + return Companion_EcdhWrapInfo_.Default() +} + +func (_this type_EcdhWrapInfo_) String() string { + return "EcdhEdkWrapping.EcdhWrapInfo" +} +func (_this EcdhWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = EcdhWrapInfo{} + +// End of datatype EcdhWrapInfo + +// Definition of class EcdhUnwrap +type EcdhUnwrap struct { + _senderPublicKey _dafny.Sequence + _recipientPublicKey _dafny.Sequence + _sharedSecret _dafny.Sequence + _keyringVersion _dafny.Sequence + _curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_EcdhUnwrap_() *EcdhUnwrap { + _this := EcdhUnwrap{} + + _this._senderPublicKey = _dafny.EmptySeq + _this._recipientPublicKey = _dafny.EmptySeq + _this._sharedSecret = _dafny.EmptySeq + _this._keyringVersion = _dafny.EmptySeq + _this._curveSpec = m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default() + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_EcdhUnwrap_ struct { +} + +var Companion_EcdhUnwrap_ = CompanionStruct_EcdhUnwrap_{} + +func (_this *EcdhUnwrap) Equals(other *EcdhUnwrap) bool { + return _this == other +} + +func (_this *EcdhUnwrap) EqualsGeneric(x interface{}) bool { + other, ok := x.(*EcdhUnwrap) + return ok && _this.Equals(other) +} + +func (*EcdhUnwrap) String() string { + return "EcdhEdkWrapping.EcdhUnwrap" +} + +func Type_EcdhUnwrap_() _dafny.TypeDescriptor { + return type_EcdhUnwrap_{} +} + +type type_EcdhUnwrap_ struct { +} + +func (_this type_EcdhUnwrap_) Default() interface{} { + return (*EcdhUnwrap)(nil) +} + +func (_this type_EcdhUnwrap_) String() string { + return "EcdhEdkWrapping.EcdhUnwrap" +} +func (_this *EcdhUnwrap) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &EcdhUnwrap{} +var _ m_Actions.ActionWithResult = &EcdhUnwrap{} +var _ m_Actions.Action = &EcdhUnwrap{} +var _ _dafny.TraitOffspring = &EcdhUnwrap{} + +func (_this *EcdhUnwrap) Ctor__(senderPublicKey _dafny.Sequence, recipientPublicKey _dafny.Sequence, sharedSecret _dafny.Sequence, keyringVersion _dafny.Sequence, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._senderPublicKey = senderPublicKey + (_this)._recipientPublicKey = recipientPublicKey + (_this)._sharedSecret = sharedSecret + (_this)._keyringVersion = keyringVersion + (_this)._curveSpec = curveSpec + (_this)._crypto = crypto + } +} +func (_this *EcdhUnwrap) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_EcdhUnwrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_wrappedMaterial _dafny.Sequence + _ = _1_wrappedMaterial + _1_wrappedMaterial = (input).Dtor_wrappedMaterial() + var _2_aad _dafny.Map + _ = _2_aad + _2_aad = (input).Dtor_encryptionContext() + var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError0 + _3_valueOrError0 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_1_wrappedMaterial).Cardinality())).Cmp(m_Constants.Companion_Default___.CIPHERTEXT__WRAPPED__MATERIAL__INDEX()) > 0, Companion_Default___.E(_dafny.SeqOfString("Recieved ciphertext is shorter than expected."))) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _4_KeyLength _dafny.Int + _ = _4_KeyLength + _4_KeyLength = _dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite)) + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError1 + _5_valueOrError1 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_1_wrappedMaterial).Cardinality())).Cmp((m_Constants.Companion_Default___.ECDH__WRAPPED__KEY__MATERIAL__INDEX()).Plus(_4_KeyLength)) > 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received EDK Ciphertext of incorrect length."))) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_kdfNonce _dafny.Sequence + _ = _6_kdfNonce + _6_kdfNonce = (_1_wrappedMaterial).Subsequence(0, (m_Constants.Companion_Default___.ECDH__COMMITMENT__KEY__INDEX()).Uint32()) + var _7_iv _dafny.Sequence + _ = _7_iv + _7_iv = _dafny.SeqCreate((_dafny.IntOfInt32((m_Constants.Companion_Default___.ECDH__AES__256__ENC__ALG()).Dtor_ivLength())).Uint32(), func(coer103 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { + return func(arg104 _dafny.Int) interface{} { + return coer103(arg104) + } + }(func(_8___v0 _dafny.Int) uint8 { + return uint8(0) + })) + var _9_commitmentKey _dafny.Sequence + _ = _9_commitmentKey + _9_commitmentKey = (_1_wrappedMaterial).Subsequence((m_Constants.Companion_Default___.ECDH__COMMITMENT__KEY__INDEX()).Uint32(), (m_Constants.Companion_Default___.ECDH__WRAPPED__KEY__MATERIAL__INDEX()).Uint32()) + var _10_wrappedKey _dafny.Sequence + _ = _10_wrappedKey + _10_wrappedKey = (_1_wrappedMaterial).Subsequence((m_Constants.Companion_Default___.ECDH__WRAPPED__KEY__MATERIAL__INDEX()).Uint32(), ((m_Constants.Companion_Default___.ECDH__WRAPPED__KEY__MATERIAL__INDEX()).Plus(_4_KeyLength)).Uint32()) + var _11_authTag _dafny.Sequence + _ = _11_authTag + _11_authTag = (_1_wrappedMaterial).Drop(((m_Constants.Companion_Default___.ECDH__WRAPPED__KEY__MATERIAL__INDEX()).Plus(_4_KeyLength)).Uint32()) + var _12_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _12_valueOrError2 + _12_valueOrError2 = (m_UTF8.Encode(Companion_Default___.CurveSpecTypeToString((_this).CurveSpec()))).MapFailure(func(coer104 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg105 interface{}) interface{} { + return coer104(arg105.(_dafny.Sequence)) + } + }(Companion_Default___.E)) + if (_12_valueOrError2).IsFailure() { + res = (_12_valueOrError2).PropagateFailure() + return res + } + var _13_curveSpecUtf8 _dafny.Sequence + _ = _13_curveSpecUtf8 + _13_curveSpecUtf8 = (_12_valueOrError2).Extract().(_dafny.Sequence) + var _14_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _14_valueOrError3 + _14_valueOrError3 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_14_valueOrError3).IsFailure() { + res = (_14_valueOrError3).PropagateFailure() + return res + } + var _15_canonicalizedEC _dafny.Sequence + _ = _15_canonicalizedEC + _15_canonicalizedEC = (_14_valueOrError3).Extract().(_dafny.Sequence) + var _16_fixedInfo _dafny.Sequence + _ = _16_fixedInfo + _16_fixedInfo = Companion_Default___.SerializeFixedInfo(m_Constants.Companion_Default___.ECDH__KDF__UTF8(), _13_curveSpecUtf8, (_this).SenderPublicKey(), (_this).RecipientPublicKey(), _15_canonicalizedEC, (_this).KeyringVersion()) + var _17_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _17_valueOrError4 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.DeriveSharedKeyingMaterial((_this).SharedSecret(), _16_fixedInfo, _6_kdfNonce, (_this).Crypto()) + _17_valueOrError4 = _out0 + if (_17_valueOrError4).IsFailure() { + res = (_17_valueOrError4).PropagateFailure() + return res + } + var _18_derivedKeyingMaterial _dafny.Sequence + _ = _18_derivedKeyingMaterial + _18_derivedKeyingMaterial = (_17_valueOrError4).Extract().(_dafny.Sequence) + var _19_calculatedCommitmentKey _dafny.Sequence + _ = _19_calculatedCommitmentKey + _19_calculatedCommitmentKey = (_18_derivedKeyingMaterial).Subsequence(0, 32) + var _20_sharedKeyingMaterial _dafny.Sequence + _ = _20_sharedKeyingMaterial + _20_sharedKeyingMaterial = (_18_derivedKeyingMaterial).Drop(32) + var _21_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _21_valueOrError5 + _21_valueOrError5 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_19_calculatedCommitmentKey).Cardinality())).Cmp(_dafny.IntOfUint32((_9_commitmentKey).Cardinality())) == 0, Companion_Default___.E(_dafny.SeqOfString("Calculated commitment key length does NOT match expected commitment key length"))) + if (_21_valueOrError5).IsFailure() { + res = (_21_valueOrError5).PropagateFailure() + return res + } + var _22_check_q bool + _ = _22_check_q + var _out1 bool + _ = _out1 + _out1 = (_this).CommitmentKeyCheck(_19_calculatedCommitmentKey, _9_commitmentKey) + _22_check_q = _out1 + var _23_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _23_valueOrError6 + _23_valueOrError6 = m_Wrappers.Companion_Default___.Need(_22_check_q, Companion_Default___.E(_dafny.SeqOfString("Commitment keys do not match"))) + if (_23_valueOrError6).IsFailure() { + res = (_23_valueOrError6).PropagateFailure() + return res + } + var _24_maybeUnwrappedPdk m_Wrappers.Result + _ = _24_maybeUnwrappedPdk + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = ((_this).Crypto()).AESDecrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESDecryptInput_.Create_AESDecryptInput_(m_Constants.Companion_Default___.ECDH__AES__256__ENC__ALG(), _20_sharedKeyingMaterial, _10_wrappedKey, _11_authTag, _7_iv, _16_fixedInfo)) + _24_maybeUnwrappedPdk = _out2 + var _25_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _25_valueOrError7 + _25_valueOrError7 = (_24_maybeUnwrappedPdk).MapFailure(func(coer105 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg106 interface{}) interface{} { + return coer105(arg106.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_26_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_26_e) + })) + if (_25_valueOrError7).IsFailure() { + res = (_25_valueOrError7).PropagateFailure() + return res + } + var _27_unwrappedPdk _dafny.Sequence + _ = _27_unwrappedPdk + _27_unwrappedPdk = (_25_valueOrError7).Extract().(_dafny.Sequence) + var _28_valueOrError8 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _28_valueOrError8 + _28_valueOrError8 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_27_unwrappedPdk).Cardinality())).Cmp(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))) == 0, Companion_Default___.E(_dafny.SeqOfString("Invalid Key Length"))) + if (_28_valueOrError8).IsFailure() { + res = (_28_valueOrError8).PropagateFailure() + return res + } + var _29_output m_MaterialWrapping.UnwrapOutput + _ = _29_output + _29_output = m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(_27_unwrappedPdk, Companion_EcdhUnwrapInfo_.Create_EcdhUnwrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_29_output) + return res + return res + } +} +func (_this *EcdhUnwrap) CommitmentKeyCheck(calculatedCommitmentKey _dafny.Sequence, serializedCommitmentKey _dafny.Sequence) bool { + { + var res bool = false + _ = res + var _0_diff_q uint8 + _ = _0_diff_q + _0_diff_q = uint8(0) + var _hi0 _dafny.Int = _dafny.IntOfUint32((serializedCommitmentKey).Cardinality()) + _ = _hi0 + for _1_i := _dafny.Zero; _1_i.Cmp(_hi0) < 0; _1_i = _1_i.Plus(_dafny.One) { + _0_diff_q = (_0_diff_q) | ((uint8((calculatedCommitmentKey).Select((_1_i).Uint32()).(uint8))) ^ (uint8((serializedCommitmentKey).Select((_1_i).Uint32()).(uint8)))) + } + res = (_0_diff_q) == (uint8(0)) + return res + } +} +func (_this *EcdhUnwrap) SenderPublicKey() _dafny.Sequence { + { + return _this._senderPublicKey + } +} +func (_this *EcdhUnwrap) RecipientPublicKey() _dafny.Sequence { + { + return _this._recipientPublicKey + } +} +func (_this *EcdhUnwrap) SharedSecret() _dafny.Sequence { + { + return _this._sharedSecret + } +} +func (_this *EcdhUnwrap) KeyringVersion() _dafny.Sequence { + { + return _this._keyringVersion + } +} +func (_this *EcdhUnwrap) CurveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + { + return _this._curveSpec + } +} +func (_this *EcdhUnwrap) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} + +// End of class EcdhUnwrap + +// Definition of class EcdhGenerateAndWrapKeyMaterial +type EcdhGenerateAndWrapKeyMaterial struct { + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient + _sharedSecret _dafny.Sequence + _fixedInfo _dafny.Sequence +} + +func New_EcdhGenerateAndWrapKeyMaterial_() *EcdhGenerateAndWrapKeyMaterial { + _this := EcdhGenerateAndWrapKeyMaterial{} + + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._sharedSecret = _dafny.EmptySeq + _this._fixedInfo = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_EcdhGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_EcdhGenerateAndWrapKeyMaterial_ = CompanionStruct_EcdhGenerateAndWrapKeyMaterial_{} + +func (_this *EcdhGenerateAndWrapKeyMaterial) Equals(other *EcdhGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *EcdhGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*EcdhGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*EcdhGenerateAndWrapKeyMaterial) String() string { + return "EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial" +} + +func Type_EcdhGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_EcdhGenerateAndWrapKeyMaterial_{} +} + +type type_EcdhGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_EcdhGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*EcdhGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_EcdhGenerateAndWrapKeyMaterial_) String() string { + return "EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial" +} +func (_this *EcdhGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &EcdhGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &EcdhGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &EcdhGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &EcdhGenerateAndWrapKeyMaterial{} + +func (_this *EcdhGenerateAndWrapKeyMaterial) Ctor__(sharedSecret _dafny.Sequence, fixedInfo _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._sharedSecret = sharedSecret + (_this)._fixedInfo = fixedInfo + (_this)._crypto = crypto + } +} +func (_this *EcdhGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_EcdhWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_pdkResult m_Wrappers.Result + _ = _1_pdkResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Crypto()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))) + _1_pdkResult = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_pdkResult).MapFailure(func(coer106 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg107 interface{}) interface{} { + return coer106(arg107.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_3_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_pdk _dafny.Sequence + _ = _4_pdk + _4_pdk = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _5_wrap *EcdhWrapKeyMaterial + _ = _5_wrap + var _nw0 *EcdhWrapKeyMaterial = New_EcdhWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).SharedSecret(), (_this).FixedInfo(), (_this).Crypto()) + _5_wrap = _nw0 + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_EcdhWrapInfo_.Default())) + _ = _6_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = (_5_wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_4_pdk, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext())) + _6_valueOrError1 = _out1.(m_Wrappers.Result) + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_wrapOutput m_MaterialWrapping.WrapOutput + _ = _7_wrapOutput + _7_wrapOutput = (_6_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + var _8_output m_MaterialWrapping.GenerateAndWrapOutput + _ = _8_output + _8_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_4_pdk, (_7_wrapOutput).Dtor_wrappedMaterial(), (_7_wrapOutput).Dtor_wrapInfo().(EcdhWrapInfo)) + res = m_Wrappers.Companion_Result_.Create_Success_(_8_output) + return res + return res + } +} +func (_this *EcdhGenerateAndWrapKeyMaterial) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} +func (_this *EcdhGenerateAndWrapKeyMaterial) SharedSecret() _dafny.Sequence { + { + return _this._sharedSecret + } +} +func (_this *EcdhGenerateAndWrapKeyMaterial) FixedInfo() _dafny.Sequence { + { + return _this._fixedInfo + } +} + +// End of class EcdhGenerateAndWrapKeyMaterial + +// Definition of class EcdhWrapKeyMaterial +type EcdhWrapKeyMaterial struct { + _crypto *m_AtomicPrimitives.AtomicPrimitivesClient + _fixedInfo _dafny.Sequence + _sharedSecret _dafny.Sequence +} + +func New_EcdhWrapKeyMaterial_() *EcdhWrapKeyMaterial { + _this := EcdhWrapKeyMaterial{} + + _this._crypto = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._fixedInfo = _dafny.EmptySeq + _this._sharedSecret = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_EcdhWrapKeyMaterial_ struct { +} + +var Companion_EcdhWrapKeyMaterial_ = CompanionStruct_EcdhWrapKeyMaterial_{} + +func (_this *EcdhWrapKeyMaterial) Equals(other *EcdhWrapKeyMaterial) bool { + return _this == other +} + +func (_this *EcdhWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*EcdhWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*EcdhWrapKeyMaterial) String() string { + return "EcdhEdkWrapping.EcdhWrapKeyMaterial" +} + +func Type_EcdhWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_EcdhWrapKeyMaterial_{} +} + +type type_EcdhWrapKeyMaterial_ struct { +} + +func (_this type_EcdhWrapKeyMaterial_) Default() interface{} { + return (*EcdhWrapKeyMaterial)(nil) +} + +func (_this type_EcdhWrapKeyMaterial_) String() string { + return "EcdhEdkWrapping.EcdhWrapKeyMaterial" +} +func (_this *EcdhWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &EcdhWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &EcdhWrapKeyMaterial{} +var _ m_Actions.Action = &EcdhWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &EcdhWrapKeyMaterial{} + +func (_this *EcdhWrapKeyMaterial) Ctor__(sharedSecret _dafny.Sequence, fixedInfo _dafny.Sequence, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._sharedSecret = sharedSecret + (_this)._fixedInfo = fixedInfo + (_this)._crypto = crypto + } +} +func (_this *EcdhWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_EcdhWrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2_canonicalizedEC _dafny.Sequence + _ = _2_canonicalizedEC + _2_canonicalizedEC = (_1_valueOrError0).Extract().(_dafny.Sequence) + var _3_maybeSalt m_Wrappers.Result + _ = _3_maybeSalt + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).Crypto()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_Constants.Companion_Default___.KDF__SALT__LEN())) + _3_maybeSalt = _out0 + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError1 + _4_valueOrError1 = (_3_maybeSalt).MapFailure(func(coer107 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg108 interface{}) interface{} { + return coer107(arg108.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e) + })) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _6_salt _dafny.Sequence + _ = _6_salt + _6_salt = (_4_valueOrError1).Extract().(_dafny.Sequence) + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _7_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.DeriveSharedKeyingMaterial((_this).SharedSecret(), (_this).FixedInfo(), _6_salt, (_this).Crypto()) + _7_valueOrError2 = _out1 + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_derivedKeyingMaterial _dafny.Sequence + _ = _8_derivedKeyingMaterial + _8_derivedKeyingMaterial = (_7_valueOrError2).Extract().(_dafny.Sequence) + var _9_commitmentKey _dafny.Sequence + _ = _9_commitmentKey + _9_commitmentKey = (_8_derivedKeyingMaterial).Subsequence(0, 32) + var _10_sharedKeyingMaterial _dafny.Sequence + _ = _10_sharedKeyingMaterial + _10_sharedKeyingMaterial = (_8_derivedKeyingMaterial).Drop(32) + var _11_iv _dafny.Sequence + _ = _11_iv + _11_iv = _dafny.SeqCreate((_dafny.IntOfInt32((m_Constants.Companion_Default___.ECDH__AES__256__ENC__ALG()).Dtor_ivLength())).Uint32(), func(coer108 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { + return func(arg109 _dafny.Int) interface{} { + return coer108(arg109) + } + }(func(_12___v3 _dafny.Int) uint8 { + return uint8(0) + })) + var _13_maybeWrappedPdk m_Wrappers.Result + _ = _13_maybeWrappedPdk + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = ((_this).Crypto()).AESEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_(m_Constants.Companion_Default___.ECDH__AES__256__ENC__ALG(), _11_iv, _10_sharedKeyingMaterial, (input).Dtor_plaintextMaterial(), (_this).FixedInfo())) + _13_maybeWrappedPdk = _out2 + var _14_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default()) + _ = _14_valueOrError3 + _14_valueOrError3 = (_13_maybeWrappedPdk).MapFailure(func(coer109 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg110 interface{}) interface{} { + return coer109(arg110.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_15_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_15_e) + })) + if (_14_valueOrError3).IsFailure() { + res = (_14_valueOrError3).PropagateFailure() + return res + } + var _16_wrappedPdk m_AwsCryptographyPrimitivesTypes.AESEncryptOutput + _ = _16_wrappedPdk + _16_wrappedPdk = (_14_valueOrError3).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) + var _17_output m_MaterialWrapping.WrapOutput + _ = _17_output + _17_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_6_salt, _9_commitmentKey), (_16_wrappedPdk).Dtor_cipherText()), (_16_wrappedPdk).Dtor_authTag()), Companion_EcdhWrapInfo_.Create_EcdhWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_17_output) + return res + return res + } +} +func (_this *EcdhWrapKeyMaterial) Crypto() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._crypto + } +} +func (_this *EcdhWrapKeyMaterial) FixedInfo() _dafny.Sequence { + { + return _this._fixedInfo + } +} +func (_this *EcdhWrapKeyMaterial) SharedSecret() _dafny.Sequence { + { + return _this._sharedSecret + } +} + +// End of class EcdhWrapKeyMaterial diff --git a/releases/go/mpl/EdkWrapping/EdkWrapping.go b/releases/go/mpl/EdkWrapping/EdkWrapping.go new file mode 100644 index 000000000..a47c891af --- /dev/null +++ b/releases/go/mpl/EdkWrapping/EdkWrapping.go @@ -0,0 +1,617 @@ +// Package EdkWrapping +// Dafny module EdkWrapping compiled into Go + +package EdkWrapping + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "EdkWrapping.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) WrapEdkMaterial(encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials, wrap m_MaterialWrapping.WrapMaterial, generateAndWrap m_MaterialWrapping.GenerateAndWrapMaterial) m_Wrappers.Result { + var ret m_Wrappers.Result = m_Wrappers.Result{} + _ = ret + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterials(encryptionMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid materials for encryption."))) + if (_0_valueOrError0).IsFailure() { + ret = (_0_valueOrError0).PropagateFailure() + return ret + } + if (((encryptionMaterials).Dtor_plaintextDataKey()).Is_Some()) && ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) { + var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError1 + var _out0 interface{} + _ = _out0 + _out0 = (wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(((encryptionMaterials).Dtor_plaintextDataKey()).Dtor_value().(_dafny.Sequence), (encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext())) + _1_valueOrError1 = _out0.(m_Wrappers.Result) + if (_1_valueOrError1).IsFailure() { + ret = (_1_valueOrError1).PropagateFailure() + return ret + } + var _2_directOutput m_MaterialWrapping.WrapOutput + _ = _2_directOutput + _2_directOutput = (_1_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_WrapEdkMaterialOutput_.Create_WrapOnlyEdkMaterialOutput_((_2_directOutput).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_None_(), (_2_directOutput).Dtor_wrapInfo())) + return ret + } else if (((encryptionMaterials).Dtor_plaintextDataKey()).Is_Some()) && ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_IntermediateKeyWrapping()) { + var _3_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError2 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_IntermediateKeyWrapping.Companion_Default___.IntermediateWrap(generateAndWrap, ((encryptionMaterials).Dtor_plaintextDataKey()).Dtor_value().(_dafny.Sequence), (encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext()) + _3_valueOrError2 = _out1 + if (_3_valueOrError2).IsFailure() { + ret = (_3_valueOrError2).PropagateFailure() + return ret + } + var _4_intermediateOutput m_IntermediateKeyWrapping.IntermediateWrapOutput + _ = _4_intermediateOutput + _4_intermediateOutput = (_3_valueOrError2).Extract().(m_IntermediateKeyWrapping.IntermediateWrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_WrapEdkMaterialOutput_.Create_WrapOnlyEdkMaterialOutput_((_4_intermediateOutput).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_Some_((_4_intermediateOutput).Dtor_symmetricSigningKey()), (_4_intermediateOutput).Dtor_wrapInfo())) + return ret + } else if (((encryptionMaterials).Dtor_plaintextDataKey()).Is_None()) && ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING()) { + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _5_valueOrError3 + var _out2 interface{} + _ = _out2 + _out2 = (generateAndWrap).Invoke(m_MaterialWrapping.Companion_GenerateAndWrapInput_.Create_GenerateAndWrapInput_((encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext())) + _5_valueOrError3 = _out2.(m_Wrappers.Result) + if (_5_valueOrError3).IsFailure() { + ret = (_5_valueOrError3).PropagateFailure() + return ret + } + var _6_directOutput m_MaterialWrapping.GenerateAndWrapOutput + _ = _6_directOutput + _6_directOutput = (_5_valueOrError3).Extract().(m_MaterialWrapping.GenerateAndWrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_WrapEdkMaterialOutput_.Create_GenerateAndWrapEdkMaterialOutput_((_6_directOutput).Dtor_plaintextMaterial(), (_6_directOutput).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_None_(), (_6_directOutput).Dtor_wrapInfo())) + return ret + } else if (((encryptionMaterials).Dtor_plaintextDataKey()).Is_None()) && ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_IntermediateKeyWrapping()) { + var _7_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError4 + _7_valueOrError4 = m_Wrappers.Companion_Default___.Need((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_commitment()).Is_HKDF(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid algorithm suite: suites with intermediate key wrapping must use key commitment."))) + if (_7_valueOrError4).IsFailure() { + ret = (_7_valueOrError4).PropagateFailure() + return ret + } + var _8_valueOrError5 m_Wrappers.Result = m_Wrappers.Result{} + _ = _8_valueOrError5 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_IntermediateKeyWrapping.Companion_Default___.IntermediateGenerateAndWrap(generateAndWrap, (encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext()) + _8_valueOrError5 = _out3 + if (_8_valueOrError5).IsFailure() { + ret = (_8_valueOrError5).PropagateFailure() + return ret + } + var _9_intermediateOutput m_IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput + _ = _9_intermediateOutput + _9_intermediateOutput = (_8_valueOrError5).Extract().(m_IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_WrapEdkMaterialOutput_.Create_GenerateAndWrapEdkMaterialOutput_((_9_intermediateOutput).Dtor_plaintextDataKey(), (_9_intermediateOutput).Dtor_wrappedMaterial(), m_Wrappers.Companion_Option_.Create_Some_((_9_intermediateOutput).Dtor_symmetricSigningKey()), (_9_intermediateOutput).Dtor_wrapInfo())) + return ret + } else { + } + return ret +} +func (_static *CompanionStruct_Default___) UnwrapEdkMaterial(wrappedMaterial _dafny.Sequence, decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, unwrap m_MaterialWrapping.UnwrapMaterial) m_Wrappers.Result { + var ret m_Wrappers.Result = m_Wrappers.Result{} + _ = ret + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidDecryptionMaterials(decryptionMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid materials for decryption."))) + if (_0_valueOrError0).IsFailure() { + ret = (_0_valueOrError0).PropagateFailure() + return ret + } + if (((decryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING() { + var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError1 + var _out0 interface{} + _ = _out0 + _out0 = (unwrap).Invoke(m_MaterialWrapping.Companion_UnwrapInput_.Create_UnwrapInput_(wrappedMaterial, (decryptionMaterials).Dtor_algorithmSuite(), (decryptionMaterials).Dtor_encryptionContext())) + _1_valueOrError1 = _out0.(m_Wrappers.Result) + if (_1_valueOrError1).IsFailure() { + ret = (_1_valueOrError1).PropagateFailure() + return ret + } + var _2_directOutput m_MaterialWrapping.UnwrapOutput + _ = _2_directOutput + _2_directOutput = (_1_valueOrError1).Extract().(m_MaterialWrapping.UnwrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_UnwrapEdkMaterialOutput_.Create_UnwrapEdkMaterialOutput_((_2_directOutput).Dtor_unwrappedMaterial(), m_Wrappers.Companion_Option_.Create_None_(), (_2_directOutput).Dtor_unwrapInfo())) + return ret + } else if (((decryptionMaterials).Dtor_algorithmSuite()).Dtor_edkWrapping()).Is_IntermediateKeyWrapping() { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError2 + _3_valueOrError2 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((wrappedMaterial).Cardinality())).Cmp(_dafny.IntOfInt32((((((decryptionMaterials).Dtor_algorithmSuite()).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_keyLength())+(((((decryptionMaterials).Dtor_algorithmSuite()).Dtor_encrypt()).Dtor_AES__GCM()).Dtor_tagLength()))) >= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid material for Intermediate Unwrapping"))) + if (_3_valueOrError2).IsFailure() { + ret = (_3_valueOrError2).PropagateFailure() + return ret + } + var _4_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_IntermediateKeyWrapping.Companion_Default___.IntermediateUnwrap(unwrap, wrappedMaterial, (decryptionMaterials).Dtor_algorithmSuite(), (decryptionMaterials).Dtor_encryptionContext()) + _4_valueOrError3 = _out1 + if (_4_valueOrError3).IsFailure() { + ret = (_4_valueOrError3).PropagateFailure() + return ret + } + var _5_intermediateOutput m_IntermediateKeyWrapping.IntermediateUnwrapOutput + _ = _5_intermediateOutput + _5_intermediateOutput = (_4_valueOrError3).Extract().(m_IntermediateKeyWrapping.IntermediateUnwrapOutput) + ret = m_Wrappers.Companion_Result_.Create_Success_(Companion_UnwrapEdkMaterialOutput_.Create_UnwrapEdkMaterialOutput_((_5_intermediateOutput).Dtor_plaintextDataKey(), m_Wrappers.Companion_Option_.Create_Some_((_5_intermediateOutput).Dtor_symmetricSigningKey()), (_5_intermediateOutput).Dtor_unwrapInfo())) + return ret + } else { + } + return ret +} +func (_static *CompanionStruct_Default___) GetProviderWrappedMaterial(material _dafny.Sequence, algSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) m_Wrappers.Result { + if ((algSuite).Dtor_edkWrapping()).Is_DIRECT__KEY__WRAPPING() { + return m_Wrappers.Companion_Result_.Create_Success_(material) + } else { + var _0_deserializedWrappedRes m_Wrappers.Result = m_IntermediateKeyWrapping.Companion_Default___.DeserializeIntermediateWrappedMaterial(material, algSuite) + _ = _0_deserializedWrappedRes + if (_0_deserializedWrappedRes).Is_Failure() { + return m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unable to deserialize Intermediate Key Wrapped material."))) + } else { + return m_Wrappers.Companion_Result_.Create_Success_(((_0_deserializedWrappedRes).Dtor_value().(m_IntermediateKeyWrapping.DeserializedIntermediateWrappedMaterial)).Dtor_providerWrappedIkm()) + } + } +} + +// End of class Default__ + +// Definition of datatype WrapEdkMaterialOutput +type WrapEdkMaterialOutput struct { + Data_WrapEdkMaterialOutput_ +} + +func (_this WrapEdkMaterialOutput) Get_() Data_WrapEdkMaterialOutput_ { + return _this.Data_WrapEdkMaterialOutput_ +} + +type Data_WrapEdkMaterialOutput_ interface { + isWrapEdkMaterialOutput() +} + +type CompanionStruct_WrapEdkMaterialOutput_ struct { +} + +var Companion_WrapEdkMaterialOutput_ = CompanionStruct_WrapEdkMaterialOutput_{} + +type WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput struct { + WrappedMaterial _dafny.Sequence + SymmetricSigningKey m_Wrappers.Option + WrapInfo interface{} +} + +func (WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput) isWrapEdkMaterialOutput() {} + +func (CompanionStruct_WrapEdkMaterialOutput_) Create_WrapOnlyEdkMaterialOutput_(WrappedMaterial _dafny.Sequence, SymmetricSigningKey m_Wrappers.Option, WrapInfo interface{}) WrapEdkMaterialOutput { + return WrapEdkMaterialOutput{WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput{WrappedMaterial, SymmetricSigningKey, WrapInfo}} +} + +func (_this WrapEdkMaterialOutput) Is_WrapOnlyEdkMaterialOutput() bool { + _, ok := _this.Get_().(WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput) + return ok +} + +type WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput struct { + PlaintextDataKey _dafny.Sequence + WrappedMaterial _dafny.Sequence + SymmetricSigningKey m_Wrappers.Option + WrapInfo interface{} +} + +func (WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput) isWrapEdkMaterialOutput() {} + +func (CompanionStruct_WrapEdkMaterialOutput_) Create_GenerateAndWrapEdkMaterialOutput_(PlaintextDataKey _dafny.Sequence, WrappedMaterial _dafny.Sequence, SymmetricSigningKey m_Wrappers.Option, WrapInfo interface{}) WrapEdkMaterialOutput { + return WrapEdkMaterialOutput{WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput{PlaintextDataKey, WrappedMaterial, SymmetricSigningKey, WrapInfo}} +} + +func (_this WrapEdkMaterialOutput) Is_GenerateAndWrapEdkMaterialOutput() bool { + _, ok := _this.Get_().(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput) + return ok +} + +func (CompanionStruct_WrapEdkMaterialOutput_) Default(_default_T interface{}) WrapEdkMaterialOutput { + return Companion_WrapEdkMaterialOutput_.Create_WrapOnlyEdkMaterialOutput_(_dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), _default_T) +} + +func (_this WrapEdkMaterialOutput) Dtor_wrappedMaterial() _dafny.Sequence { + switch data := _this.Get_().(type) { + case WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput: + return data.WrappedMaterial + default: + return data.(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput).WrappedMaterial + } +} + +func (_this WrapEdkMaterialOutput) Dtor_symmetricSigningKey() m_Wrappers.Option { + switch data := _this.Get_().(type) { + case WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput: + return data.SymmetricSigningKey + default: + return data.(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput).SymmetricSigningKey + } +} + +func (_this WrapEdkMaterialOutput) Dtor_wrapInfo() interface{} { + switch data := _this.Get_().(type) { + case WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput: + return data.WrapInfo + default: + return data.(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput).WrapInfo + } +} + +func (_this WrapEdkMaterialOutput) Dtor_plaintextDataKey() _dafny.Sequence { + return _this.Get_().(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput).PlaintextDataKey +} + +func (_this WrapEdkMaterialOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput: + { + return "EdkWrapping.WrapEdkMaterialOutput.WrapOnlyEdkMaterialOutput" + "(" + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" + } + case WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput: + { + return "EdkWrapping.WrapEdkMaterialOutput.GenerateAndWrapEdkMaterialOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this WrapEdkMaterialOutput) Equals(other WrapEdkMaterialOutput) bool { + switch data1 := _this.Get_().(type) { + case WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput: + { + data2, ok := other.Get_().(WrapEdkMaterialOutput_WrapOnlyEdkMaterialOutput) + return ok && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + case WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput: + { + data2, ok := other.Get_().(WrapEdkMaterialOutput_GenerateAndWrapEdkMaterialOutput) + return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this WrapEdkMaterialOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(WrapEdkMaterialOutput) + return ok && _this.Equals(typed) +} + +func Type_WrapEdkMaterialOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_WrapEdkMaterialOutput_{Type_T_} +} + +type type_WrapEdkMaterialOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_WrapEdkMaterialOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_WrapEdkMaterialOutput_.Default(Type_T_.Default()) +} + +func (_this type_WrapEdkMaterialOutput_) String() string { + return "EdkWrapping.WrapEdkMaterialOutput" +} +func (_this WrapEdkMaterialOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = WrapEdkMaterialOutput{} + +// End of datatype WrapEdkMaterialOutput + +// Definition of datatype UnwrapEdkMaterialOutput +type UnwrapEdkMaterialOutput struct { + Data_UnwrapEdkMaterialOutput_ +} + +func (_this UnwrapEdkMaterialOutput) Get_() Data_UnwrapEdkMaterialOutput_ { + return _this.Data_UnwrapEdkMaterialOutput_ +} + +type Data_UnwrapEdkMaterialOutput_ interface { + isUnwrapEdkMaterialOutput() +} + +type CompanionStruct_UnwrapEdkMaterialOutput_ struct { +} + +var Companion_UnwrapEdkMaterialOutput_ = CompanionStruct_UnwrapEdkMaterialOutput_{} + +type UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput struct { + PlaintextDataKey _dafny.Sequence + SymmetricSigningKey m_Wrappers.Option + UnwrapInfo interface{} +} + +func (UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput) isUnwrapEdkMaterialOutput() {} + +func (CompanionStruct_UnwrapEdkMaterialOutput_) Create_UnwrapEdkMaterialOutput_(PlaintextDataKey _dafny.Sequence, SymmetricSigningKey m_Wrappers.Option, UnwrapInfo interface{}) UnwrapEdkMaterialOutput { + return UnwrapEdkMaterialOutput{UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput{PlaintextDataKey, SymmetricSigningKey, UnwrapInfo}} +} + +func (_this UnwrapEdkMaterialOutput) Is_UnwrapEdkMaterialOutput() bool { + _, ok := _this.Get_().(UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput) + return ok +} + +func (CompanionStruct_UnwrapEdkMaterialOutput_) Default(_default_T interface{}) UnwrapEdkMaterialOutput { + return Companion_UnwrapEdkMaterialOutput_.Create_UnwrapEdkMaterialOutput_(_dafny.EmptySeq, m_Wrappers.Companion_Option_.Default(), _default_T) +} + +func (_this UnwrapEdkMaterialOutput) Dtor_plaintextDataKey() _dafny.Sequence { + return _this.Get_().(UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput).PlaintextDataKey +} + +func (_this UnwrapEdkMaterialOutput) Dtor_symmetricSigningKey() m_Wrappers.Option { + return _this.Get_().(UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput).SymmetricSigningKey +} + +func (_this UnwrapEdkMaterialOutput) Dtor_unwrapInfo() interface{} { + return _this.Get_().(UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput).UnwrapInfo +} + +func (_this UnwrapEdkMaterialOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput: + { + return "EdkWrapping.UnwrapEdkMaterialOutput.UnwrapEdkMaterialOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.UnwrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this UnwrapEdkMaterialOutput) Equals(other UnwrapEdkMaterialOutput) bool { + switch data1 := _this.Get_().(type) { + case UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput: + { + data2, ok := other.Get_().(UnwrapEdkMaterialOutput_UnwrapEdkMaterialOutput) + return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.UnwrapInfo, data2.UnwrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this UnwrapEdkMaterialOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(UnwrapEdkMaterialOutput) + return ok && _this.Equals(typed) +} + +func Type_UnwrapEdkMaterialOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_UnwrapEdkMaterialOutput_{Type_T_} +} + +type type_UnwrapEdkMaterialOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_UnwrapEdkMaterialOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_UnwrapEdkMaterialOutput_.Default(Type_T_.Default()) +} + +func (_this type_UnwrapEdkMaterialOutput_) String() string { + return "EdkWrapping.UnwrapEdkMaterialOutput" +} +func (_this UnwrapEdkMaterialOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = UnwrapEdkMaterialOutput{} + +// End of datatype UnwrapEdkMaterialOutput diff --git a/releases/go/mpl/ErrorMessages/ErrorMessages.go b/releases/go/mpl/ErrorMessages/ErrorMessages.go new file mode 100644 index 000000000..9668aed0b --- /dev/null +++ b/releases/go/mpl/ErrorMessages/ErrorMessages.go @@ -0,0 +1,337 @@ +// Package ErrorMessages +// Dafny module ErrorMessages compiled into Go + +package ErrorMessages + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UUID "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UUID" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "ErrorMessages.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) IncorrectRawDataKeys(datakey _dafny.Sequence, keyringName _dafny.Sequence, keyProviderId _dafny.Sequence) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("EncryptedDataKey "), datakey), _dafny.SeqOfString(" did not match ")), keyringName), _dafny.SeqOfString(". ")), _dafny.SeqOfString("Expected: keyProviderId: ")), keyProviderId), _dafny.SeqOfString(".\n")) +} +func (_static *CompanionStruct_Default___) IncorrectDataKeys(encryptedDataKeys _dafny.Sequence, material m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, errMsg _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = Companion_Default___.IncorrectDataKeysExpectedValues(encryptedDataKeys, material, errMsg) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_expectedValue _dafny.Sequence = (_0_valueOrError0).Extract().(_dafny.Sequence) + _ = _1_expectedValue + return m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("Unable to decrypt data key: No Encrypted Data Keys found to match. \n Expected: \n"), _1_expectedValue)) + } +} +func (_static *CompanionStruct_Default___) IncorrectDataKeysExpectedValues(encryptedDataKeys _dafny.Sequence, material m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, errMsg _dafny.Sequence) m_Wrappers.Result { + goto TAIL_CALL_START +TAIL_CALL_START: + if (_dafny.IntOfUint32((encryptedDataKeys).Cardinality())).Sign() == 0 { + return m_Wrappers.Companion_Result_.Create_Success_(errMsg) + } else { + var _0_encryptedDataKey m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = (encryptedDataKeys).Select(0).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = _0_encryptedDataKey + var _1_valueOrError0 m_Wrappers.Result = (m_UTF8.Decode((_0_encryptedDataKey).Dtor_keyProviderId())).MapFailure(func(coer49 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg50 interface{}) interface{} { + return coer49(arg50.(_dafny.Sequence)) + } + }(func(_2_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_2_e) + })) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _3_extractedKeyProviderId _dafny.Sequence = (_1_valueOrError0).Extract().(_dafny.Sequence) + _ = _3_extractedKeyProviderId + var _4_valueOrError1 m_Wrappers.Result = (m_UTF8.Decode((_0_encryptedDataKey).Dtor_keyProviderInfo())).MapFailure(func(coer50 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg51 interface{}) interface{} { + return coer50(arg51.(_dafny.Sequence)) + } + }(func(_5_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_5_e) + })) + _ = _4_valueOrError1 + if (_4_valueOrError1).IsFailure() { + return (_4_valueOrError1).PropagateFailure() + } else { + var _6_extractedKeyProviderInfo _dafny.Sequence = (_4_valueOrError1).Extract().(_dafny.Sequence) + _ = _6_extractedKeyProviderInfo + if !_dafny.Companion_Sequence_.Equal(_3_extractedKeyProviderId, _dafny.SeqOfString("aws-kms-hierarchy")) { + var _in0 _dafny.Sequence = (encryptedDataKeys).Drop(1) + _ = _in0 + var _in1 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = material + _ = _in1 + var _in2 _dafny.Sequence = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(errMsg, _dafny.SeqOfString("KeyProviderId: ")), _3_extractedKeyProviderId), _dafny.SeqOfString(", KeyProviderInfo: ")), _6_extractedKeyProviderInfo), _dafny.SeqOfString("\n")) + _ = _in2 + encryptedDataKeys = _in0 + material = _in1 + errMsg = _in2 + goto TAIL_CALL_START + } else { + var _7_valueOrError2 m_Wrappers.Result = m_EdkWrapping.Companion_Default___.GetProviderWrappedMaterial((_0_encryptedDataKey).Dtor_ciphertext(), material) + _ = _7_valueOrError2 + if (_7_valueOrError2).IsFailure() { + return (_7_valueOrError2).PropagateFailure() + } else { + var _8_providerWrappedMaterial _dafny.Sequence = (_7_valueOrError2).Extract().(_dafny.Sequence) + _ = _8_providerWrappedMaterial + var _9_EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX _dafny.Int = (Companion_Default___.SALT__LENGTH()).Plus(Companion_Default___.IV__LENGTH()) + _ = _9_EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX + var _10_EDK__CIPHERTEXT__VERSION__INDEX _dafny.Int = (_9_EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX).Plus(Companion_Default___.VERSION__LENGTH()) + _ = _10_EDK__CIPHERTEXT__VERSION__INDEX + var _11_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_9_EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX).Cmp(_10_EDK__CIPHERTEXT__VERSION__INDEX) < 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Wrong branch key version index."))) + _ = _11_valueOrError3 + if (_11_valueOrError3).IsFailure() { + return (_11_valueOrError3).PropagateFailure() + } else { + var _12_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_8_providerWrappedMaterial).Cardinality())).Cmp(_10_EDK__CIPHERTEXT__VERSION__INDEX) >= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Incorrect ciphertext structure."))) + _ = _12_valueOrError4 + if (_12_valueOrError4).IsFailure() { + return (_12_valueOrError4).PropagateFailure() + } else { + var _13_branchKeyVersionUuid _dafny.Sequence = (_8_providerWrappedMaterial).Subsequence((_9_EDK__CIPHERTEXT__BRANCH__KEY__VERSION__INDEX).Uint32(), (_10_EDK__CIPHERTEXT__VERSION__INDEX).Uint32()) + _ = _13_branchKeyVersionUuid + var _14_valueOrError5 m_Wrappers.Result = (m_UUID.FromByteArray(_13_branchKeyVersionUuid)).MapFailure(func(coer51 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg52 interface{}) interface{} { + return coer51(arg52.(_dafny.Sequence)) + } + }(func(_15_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_15_e) + })) + _ = _14_valueOrError5 + if (_14_valueOrError5).IsFailure() { + return (_14_valueOrError5).PropagateFailure() + } else { + var _16_branchVersion _dafny.Sequence = (_14_valueOrError5).Extract().(_dafny.Sequence) + _ = _16_branchVersion + var _in3 _dafny.Sequence = (encryptedDataKeys).Drop(1) + _ = _in3 + var _in4 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = material + _ = _in4 + var _in5 _dafny.Sequence = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(errMsg, _dafny.SeqOfString("KeyProviderId: ")), _3_extractedKeyProviderId), _dafny.SeqOfString(", KeyProviderInfo: ")), _6_extractedKeyProviderInfo), _dafny.SeqOfString(", BranchKeyVersion: ")), _16_branchVersion), _dafny.SeqOfString("\n")) + _ = _in5 + encryptedDataKeys = _in3 + material = _in4 + errMsg = _in5 + goto TAIL_CALL_START + } + } + } + } + } + } + } + } +} +func (_static *CompanionStruct_Default___) SALT__LENGTH() _dafny.Int { + return _dafny.IntOfInt64(16) +} +func (_static *CompanionStruct_Default___) IV__LENGTH() _dafny.Int { + return _dafny.IntOfInt64(12) +} +func (_static *CompanionStruct_Default___) VERSION__LENGTH() _dafny.Int { + return _dafny.IntOfInt64(16) +} +func (_static *CompanionStruct_Default___) KMS__ECDH__DISCOVERY__ENCRYPT__ERROR() _dafny.Sequence { + return _dafny.SeqOfString("KmsPublicKeyDiscovery Key Agreement Scheme is forbidden on encrypt.") +} +func (_static *CompanionStruct_Default___) RAW__ECDH__DISCOVERY__ENCRYPT__ERROR() _dafny.Sequence { + return _dafny.SeqOfString("PublicKeyDiscovery Key Agreement Scheme is forbidden on encrypt.") +} +func (_static *CompanionStruct_Default___) RAW__ECDH__EPHEMERAL__DECRYPT__ERROR() _dafny.Sequence { + return _dafny.SeqOfString("EphemeralPrivateKeyToStaticPublicKey Key Agreement Scheme is forbidden on decrypt.") +} + +// End of class Default__ diff --git a/releases/go/mpl/GetKeys/GetKeys.go b/releases/go/mpl/GetKeys/GetKeys.go new file mode 100644 index 000000000..6684f9da9 --- /dev/null +++ b/releases/go/mpl/GetKeys/GetKeys.go @@ -0,0 +1,352 @@ +// Package GetKeys +// Dafny module GetKeys compiled into Go + +package GetKeys + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "GetKeys.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) GetActiveKeyAndUnwrap(input m_AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput, tableName _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_DDBKeystoreOperations.Companion_Default___.GetActiveBranchKeyItem((input).Dtor_branchKeyIdentifier(), tableName, ddbClient) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_branchKeyItem _dafny.Map + _ = _1_branchKeyItem + _1_branchKeyItem = (_0_valueOrError0).Extract().(_dafny.Map) + var _2_encryptionContext _dafny.Map + _ = _2_encryptionContext + _2_encryptionContext = m_Structure.Companion_Default___.ToBranchKeyContext(_1_branchKeyItem, logicalKeyStoreName) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_KmsArn.Companion_Default___.ValidKmsArn_q((_2_encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.RETRIEVED__KEYSTORE__ITEM__INVALID__KMS__ARN())) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError2 + _4_valueOrError2 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _2_encryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.GET__KEY__ARN__DISAGREEMENT())) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _5_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_KMSKeystoreOperations.Companion_Default___.DecryptKey(_2_encryptionContext, _1_branchKeyItem, kmsConfiguration, grantTokens, kmsClient) + _5_valueOrError3 = _out1 + if (_5_valueOrError3).IsFailure() { + output = (_5_valueOrError3).PropagateFailure() + return output + } + var _6_branchKey m_ComAmazonawsKmsTypes.DecryptResponse + _ = _6_branchKey + _6_branchKey = (_5_valueOrError3).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _7_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = _7_valueOrError4 + _7_valueOrError4 = m_Structure.Companion_Default___.ToBranchKeyMaterials(_2_encryptionContext, ((_6_branchKey).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)) + if (_7_valueOrError4).IsFailure() { + output = (_7_valueOrError4).PropagateFailure() + return output + } + var _8_branchKeyMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _8_branchKeyMaterials + _8_branchKeyMaterials = (_7_valueOrError4).Extract().(m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Create_GetActiveBranchKeyOutput_(_8_branchKeyMaterials)) + return output + return output +} +func (_static *CompanionStruct_Default___) GetBranchKeyVersion(input m_AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput, tableName _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_DDBKeystoreOperations.Companion_Default___.GetVersionBranchKeyItem((input).Dtor_branchKeyIdentifier(), (input).Dtor_branchKeyVersion(), tableName, ddbClient) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_branchKeyItem _dafny.Map + _ = _1_branchKeyItem + _1_branchKeyItem = (_0_valueOrError0).Extract().(_dafny.Map) + var _2_encryptionContext _dafny.Map + _ = _2_encryptionContext + _2_encryptionContext = m_Structure.Companion_Default___.ToBranchKeyContext(_1_branchKeyItem, logicalKeyStoreName) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_KmsArn.Companion_Default___.ValidKmsArn_q((_2_encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.RETRIEVED__KEYSTORE__ITEM__INVALID__KMS__ARN())) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError2 + _4_valueOrError2 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _2_encryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("AWS KMS Key ARN does not match configured value"))) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _5_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_KMSKeystoreOperations.Companion_Default___.DecryptKey(_2_encryptionContext, _1_branchKeyItem, kmsConfiguration, grantTokens, kmsClient) + _5_valueOrError3 = _out1 + if (_5_valueOrError3).IsFailure() { + output = (_5_valueOrError3).PropagateFailure() + return output + } + var _6_branchKey m_ComAmazonawsKmsTypes.DecryptResponse + _ = _6_branchKey + _6_branchKey = (_5_valueOrError3).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _7_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Default()) + _ = _7_valueOrError4 + _7_valueOrError4 = m_Structure.Companion_Default___.ToBranchKeyMaterials(_2_encryptionContext, ((_6_branchKey).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)) + if (_7_valueOrError4).IsFailure() { + output = (_7_valueOrError4).PropagateFailure() + return output + } + var _8_branchKeyMaterials m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials + _ = _8_branchKeyMaterials + _8_branchKeyMaterials = (_7_valueOrError4).Extract().(m_AwsCryptographyKeyStoreTypes.BranchKeyMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Create_GetBranchKeyVersionOutput_(_8_branchKeyMaterials)) + return output + return output +} +func (_static *CompanionStruct_Default___) GetBeaconKeyAndUnwrap(input m_AwsCryptographyKeyStoreTypes.GetBeaconKeyInput, tableName _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient, ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyOutput_.Default()) + _ = output + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_DDBKeystoreOperations.Companion_Default___.GetBeaconKeyItem((input).Dtor_branchKeyIdentifier(), tableName, ddbClient) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_branchKeyItem _dafny.Map + _ = _1_branchKeyItem + _1_branchKeyItem = (_0_valueOrError0).Extract().(_dafny.Map) + var _2_encryptionContext _dafny.Map + _ = _2_encryptionContext + _2_encryptionContext = m_Structure.Companion_Default___.ToBranchKeyContext(_1_branchKeyItem, logicalKeyStoreName) + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _3_valueOrError1 + _3_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_KmsArn.Companion_Default___.ValidKmsArn_q((_2_encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.RETRIEVED__KEYSTORE__ITEM__INVALID__KMS__ARN())) + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError2 + _4_valueOrError2 = m_Wrappers.Companion_Default___.Need(m_KMSKeystoreOperations.Companion_Default___.AttemptKmsOperation_q(kmsConfiguration, _2_encryptionContext), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("AWS KMS Key ARN does not match configured value"))) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _5_valueOrError3 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_KMSKeystoreOperations.Companion_Default___.DecryptKey(_2_encryptionContext, _1_branchKeyItem, kmsConfiguration, grantTokens, kmsClient) + _5_valueOrError3 = _out1 + if (_5_valueOrError3).IsFailure() { + output = (_5_valueOrError3).PropagateFailure() + return output + } + var _6_branchKey m_ComAmazonawsKmsTypes.DecryptResponse + _ = _6_branchKey + _6_branchKey = (_5_valueOrError3).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _7_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_BeaconKeyMaterials_.Default()) + _ = _7_valueOrError4 + _7_valueOrError4 = m_Structure.Companion_Default___.ToBeaconKeyMaterials(_2_encryptionContext, ((_6_branchKey).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)) + if (_7_valueOrError4).IsFailure() { + output = (_7_valueOrError4).PropagateFailure() + return output + } + var _8_branchKeyMaterials m_AwsCryptographyKeyStoreTypes.BeaconKeyMaterials + _ = _8_branchKeyMaterials + _8_branchKeyMaterials = (_7_valueOrError4).Extract().(m_AwsCryptographyKeyStoreTypes.BeaconKeyMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyOutput_.Create_GetBeaconKeyOutput_(_8_branchKeyMaterials)) + return output + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/IntermediateKeyWrapping/IntermediateKeyWrapping.go b/releases/go/mpl/IntermediateKeyWrapping/IntermediateKeyWrapping.go new file mode 100644 index 000000000..ea2744590 --- /dev/null +++ b/releases/go/mpl/IntermediateKeyWrapping/IntermediateKeyWrapping.go @@ -0,0 +1,1174 @@ +// Package IntermediateKeyWrapping +// Dafny module IntermediateKeyWrapping compiled into Go + +package IntermediateKeyWrapping + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "IntermediateKeyWrapping.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) IntermediateUnwrap(unwrap m_MaterialWrapping.UnwrapMaterial, wrappedMaterial _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_maybeCrypto m_Wrappers.Result + _ = _0_maybeCrypto + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) + _0_maybeCrypto = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer38 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg39 interface{}) interface{} { + return coer38(arg39.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient + _ = _3_cryptoPrimitivesX + _3_cryptoPrimitivesX = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _4_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _ = _4_cryptoPrimitives + _4_cryptoPrimitives = _3_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_DeserializedIntermediateWrappedMaterial_.Default()) + _ = _5_valueOrError1 + _5_valueOrError1 = Companion_Default___.DeserializeIntermediateWrappedMaterial(wrappedMaterial, algorithmSuite) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_deserializedWrapped DeserializedIntermediateWrappedMaterial + _ = _6_deserializedWrapped + _6_deserializedWrapped = (_5_valueOrError1).Extract().(DeserializedIntermediateWrappedMaterial) + var _let_tmp_rhs0 DeserializedIntermediateWrappedMaterial = _6_deserializedWrapped + _ = _let_tmp_rhs0 + var _7_encryptedPdk _dafny.Sequence = _let_tmp_rhs0.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).EncryptedPdk + _ = _7_encryptedPdk + var _8_providerWrappedIkm _dafny.Sequence = _let_tmp_rhs0.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).ProviderWrappedIkm + _ = _8_providerWrappedIkm + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _9_valueOrError2 + var _out1 interface{} + _ = _out1 + _out1 = (unwrap).Invoke(m_MaterialWrapping.Companion_UnwrapInput_.Create_UnwrapInput_(_8_providerWrappedIkm, algorithmSuite, encryptionContext)) + _9_valueOrError2 = _out1.(m_Wrappers.Result) + if (_9_valueOrError2).IsFailure() { + res = (_9_valueOrError2).PropagateFailure() + return res + } + var _10_unwrapOutput m_MaterialWrapping.UnwrapOutput + _ = _10_unwrapOutput + _10_unwrapOutput = (_9_valueOrError2).Extract().(m_MaterialWrapping.UnwrapOutput) + var _let_tmp_rhs1 m_MaterialWrapping.UnwrapOutput = _10_unwrapOutput + _ = _let_tmp_rhs1 + var _11_intermediateMaterial _dafny.Sequence = _let_tmp_rhs1.Get_().(m_MaterialWrapping.UnwrapOutput_UnwrapOutput).UnwrappedMaterial + _ = _11_intermediateMaterial + var _12_unwrapInfo interface{} = _let_tmp_rhs1.Get_().(m_MaterialWrapping.UnwrapOutput_UnwrapOutput).UnwrapInfo + _ = _12_unwrapInfo + var _13_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) + _ = _13_valueOrError3 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = Companion_Default___.DeriveKeysFromIntermediateMaterial(_11_intermediateMaterial, algorithmSuite, encryptionContext, _4_cryptoPrimitives) + _13_valueOrError3 = _out2 + if (_13_valueOrError3).IsFailure() { + res = (_13_valueOrError3).PropagateFailure() + return res + } + var _14_derivedKeys PdkEncryptionAndSymmetricSigningKeys + _ = _14_derivedKeys + _14_derivedKeys = (_13_valueOrError3).Extract().(PdkEncryptionAndSymmetricSigningKeys) + var _let_tmp_rhs2 PdkEncryptionAndSymmetricSigningKeys = _14_derivedKeys + _ = _let_tmp_rhs2 + var _15_pdkEncryptionKey _dafny.Sequence = _let_tmp_rhs2.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey + _ = _15_pdkEncryptionKey + var _16_symmetricSigningKey _dafny.Sequence = _let_tmp_rhs2.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey + _ = _16_symmetricSigningKey + var _17_iv _dafny.Sequence + _ = _17_iv + _17_iv = _dafny.SeqCreate((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptIvLength(algorithmSuite))).Uint32(), func(coer39 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { + return func(arg40 _dafny.Int) interface{} { + return coer39(arg40) + } + }(func(_18___v0 _dafny.Int) uint8 { + return uint8(0) + })) + var _19_tagIndex _dafny.Int + _ = _19_tagIndex + _19_tagIndex = (_dafny.IntOfUint32((_7_encryptedPdk).Cardinality())).Minus(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algorithmSuite))) + var _20_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _20_valueOrError4 + _20_valueOrError4 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext) + if (_20_valueOrError4).IsFailure() { + res = (_20_valueOrError4).PropagateFailure() + return res + } + var _21_aad _dafny.Sequence + _ = _21_aad + _21_aad = (_20_valueOrError4).Extract().(_dafny.Sequence) + var _22_decInput m_AwsCryptographyPrimitivesTypes.AESDecryptInput + _ = _22_decInput + _22_decInput = m_AwsCryptographyPrimitivesTypes.Companion_AESDecryptInput_.Create_AESDecryptInput_(((algorithmSuite).Dtor_encrypt()).Dtor_AES__GCM(), _15_pdkEncryptionKey, (_7_encryptedPdk).Take((_19_tagIndex).Uint32()), (_7_encryptedPdk).Drop((_19_tagIndex).Uint32()), _17_iv, _21_aad) + var _23_decOutR m_Wrappers.Result + _ = _23_decOutR + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = (_4_cryptoPrimitives).AESDecrypt(_22_decInput) + _23_decOutR = _out3 + var _24_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _24_valueOrError5 + _24_valueOrError5 = (_23_decOutR).MapFailure(func(coer40 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg41 interface{}) interface{} { + return coer40(arg41.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_25_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_25_e) + })) + if (_24_valueOrError5).IsFailure() { + res = (_24_valueOrError5).PropagateFailure() + return res + } + var _26_plaintextDataKey _dafny.Sequence + _ = _26_plaintextDataKey + _26_plaintextDataKey = (_24_valueOrError5).Extract().(_dafny.Sequence) + var _27_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _27_valueOrError6 + _27_valueOrError6 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_26_plaintextDataKey).Cardinality())).Cmp(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unexpected AES_GCM Decrypt length"))) + if (_27_valueOrError6).IsFailure() { + res = (_27_valueOrError6).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateUnwrapOutput_.Create_IntermediateUnwrapOutput_(_26_plaintextDataKey, _16_symmetricSigningKey, _12_unwrapInfo)) + return res + return res +} +func (_static *CompanionStruct_Default___) IntermediateWrap(generateAndWrap m_MaterialWrapping.GenerateAndWrapMaterial, plaintextDataKey _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_maybeCrypto m_Wrappers.Result + _ = _0_maybeCrypto + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) + _0_maybeCrypto = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer41 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg42 interface{}) interface{} { + return coer41(arg42.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient + _ = _3_cryptoPrimitivesX + _3_cryptoPrimitivesX = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _4_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _ = _4_cryptoPrimitives + _4_cryptoPrimitives = _3_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _5_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = (generateAndWrap).Invoke(m_MaterialWrapping.Companion_GenerateAndWrapInput_.Create_GenerateAndWrapInput_(algorithmSuite, encryptionContext)) + _5_valueOrError1 = _out1.(m_Wrappers.Result) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_generateAndWrapOutput m_MaterialWrapping.GenerateAndWrapOutput + _ = _6_generateAndWrapOutput + _6_generateAndWrapOutput = (_5_valueOrError1).Extract().(m_MaterialWrapping.GenerateAndWrapOutput) + var _let_tmp_rhs0 m_MaterialWrapping.GenerateAndWrapOutput = _6_generateAndWrapOutput + _ = _let_tmp_rhs0 + var _7_intermediateMaterial _dafny.Sequence = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).PlaintextMaterial + _ = _7_intermediateMaterial + var _8_providerWrappedIkm _dafny.Sequence = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).WrappedMaterial + _ = _8_providerWrappedIkm + var _9_wrapInfo interface{} = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).WrapInfo + _ = _9_wrapInfo + var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) + _ = _10_valueOrError2 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = Companion_Default___.DeriveKeysFromIntermediateMaterial(_7_intermediateMaterial, algorithmSuite, encryptionContext, _4_cryptoPrimitives) + _10_valueOrError2 = _out2 + if (_10_valueOrError2).IsFailure() { + res = (_10_valueOrError2).PropagateFailure() + return res + } + var _11_derivedKeys PdkEncryptionAndSymmetricSigningKeys + _ = _11_derivedKeys + _11_derivedKeys = (_10_valueOrError2).Extract().(PdkEncryptionAndSymmetricSigningKeys) + var _let_tmp_rhs1 PdkEncryptionAndSymmetricSigningKeys = _11_derivedKeys + _ = _let_tmp_rhs1 + var _12_pdkEncryptionKey _dafny.Sequence = _let_tmp_rhs1.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey + _ = _12_pdkEncryptionKey + var _13_symmetricSigningKey _dafny.Sequence = _let_tmp_rhs1.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey + _ = _13_symmetricSigningKey + var _14_iv _dafny.Sequence + _ = _14_iv + _14_iv = _dafny.SeqCreate((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptIvLength(algorithmSuite))).Uint32(), func(coer42 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { + return func(arg43 _dafny.Int) interface{} { + return coer42(arg43) + } + }(func(_15___v1 _dafny.Int) uint8 { + return uint8(0) + })) + var _16_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _16_valueOrError3 + _16_valueOrError3 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext) + if (_16_valueOrError3).IsFailure() { + res = (_16_valueOrError3).PropagateFailure() + return res + } + var _17_aad _dafny.Sequence + _ = _17_aad + _17_aad = (_16_valueOrError3).Extract().(_dafny.Sequence) + var _18_encInput m_AwsCryptographyPrimitivesTypes.AESEncryptInput + _ = _18_encInput + _18_encInput = m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_(((algorithmSuite).Dtor_encrypt()).Dtor_AES__GCM(), _14_iv, _12_pdkEncryptionKey, plaintextDataKey, _17_aad) + var _19_encOutR m_Wrappers.Result + _ = _19_encOutR + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = (_4_cryptoPrimitives).AESEncrypt(_18_encInput) + _19_encOutR = _out3 + var _20_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default()) + _ = _20_valueOrError4 + _20_valueOrError4 = (_19_encOutR).MapFailure(func(coer43 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg44 interface{}) interface{} { + return coer43(arg44.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_21_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_21_e) + })) + if (_20_valueOrError4).IsFailure() { + res = (_20_valueOrError4).PropagateFailure() + return res + } + var _22_encryptedPdk m_AwsCryptographyPrimitivesTypes.AESEncryptOutput + _ = _22_encryptedPdk + _22_encryptedPdk = (_20_valueOrError4).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) + var _23_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _23_valueOrError5 + _23_valueOrError5 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_dafny.Companion_Sequence_.Concatenate((_22_encryptedPdk).Dtor_cipherText(), (_22_encryptedPdk).Dtor_authTag())).Cardinality())).Cmp(_dafny.IntOfInt32((m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))+(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algorithmSuite)))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unexpected AES_GCM Encrypt length"))) + if (_23_valueOrError5).IsFailure() { + res = (_23_valueOrError5).PropagateFailure() + return res + } + var _24_serializedMaterial _dafny.Sequence + _ = _24_serializedMaterial + _24_serializedMaterial = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_22_encryptedPdk).Dtor_cipherText(), (_22_encryptedPdk).Dtor_authTag()), _8_providerWrappedIkm) + res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateWrapOutput_.Create_IntermediateWrapOutput_(_24_serializedMaterial, _13_symmetricSigningKey, _9_wrapInfo)) + return res + return res +} +func (_static *CompanionStruct_Default___) IntermediateGenerateAndWrap(generateAndWrap m_MaterialWrapping.GenerateAndWrapMaterial, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_maybeCrypto m_Wrappers.Result + _ = _0_maybeCrypto + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) + _0_maybeCrypto = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer44 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg45 interface{}) interface{} { + return coer44(arg45.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _ = _3_cryptoPrimitives + _3_cryptoPrimitives = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _4_generateBytesResult m_Wrappers.Result + _ = _4_generateBytesResult + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_3_cryptoPrimitives).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))) + _4_generateBytesResult = _out1 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + _5_valueOrError1 = (_4_generateBytesResult).MapFailure(func(coer45 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg46 interface{}) interface{} { + return coer45(arg46.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_6_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_6_e) + })) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _7_plaintextDataKey _dafny.Sequence + _ = _7_plaintextDataKey + _7_plaintextDataKey = (_5_valueOrError1).Extract().(_dafny.Sequence) + var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _8_valueOrError2 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = Companion_Default___.IntermediateWrap(generateAndWrap, _7_plaintextDataKey, algorithmSuite, encryptionContext) + _8_valueOrError2 = _out2 + if (_8_valueOrError2).IsFailure() { + res = (_8_valueOrError2).PropagateFailure() + return res + } + var _9_wrapOutput IntermediateWrapOutput + _ = _9_wrapOutput + _9_wrapOutput = (_8_valueOrError2).Extract().(IntermediateWrapOutput) + res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateGenerateAndWrapOutput_.Create_IntermediateGenerateAndWrapOutput_(_7_plaintextDataKey, (_9_wrapOutput).Dtor_wrappedMaterial(), (_9_wrapOutput).Dtor_symmetricSigningKey(), (_9_wrapOutput).Dtor_wrapInfo())) + return res + return res +} +func (_static *CompanionStruct_Default___) DeserializeIntermediateWrappedMaterial(material _dafny.Sequence, algSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((material).Cardinality())).Cmp(_dafny.IntOfInt32((m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algSuite))+(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algSuite)))) >= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unable to deserialize Intermediate Key Wrapped material: too short."))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_encryptedPdkLen int32 = (m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algSuite)) + (m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algSuite)) + _ = _1_encryptedPdkLen + return m_Wrappers.Companion_Result_.Create_Success_(Companion_DeserializedIntermediateWrappedMaterial_.Create_DeserializedIntermediateWrappedMaterial_((material).Take(uint32(_1_encryptedPdkLen)), (material).Drop(uint32(_1_encryptedPdkLen)))) + } +} +func (_static *CompanionStruct_Default___) DeriveKeysFromIntermediateMaterial(intermediateMaterial _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) + _ = res + var _0_hkdfExtractInput m_AwsCryptographyPrimitivesTypes.HkdfExtractInput + _ = _0_hkdfExtractInput + _0_hkdfExtractInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExtractInput_.Create_HkdfExtractInput_((((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_hmac(), m_Wrappers.Companion_Option_.Create_None_(), intermediateMaterial) + var _1_maybePseudoRandomKey m_Wrappers.Result + _ = _1_maybePseudoRandomKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (cryptoPrimitives).HkdfExtract(_0_hkdfExtractInput) + _1_maybePseudoRandomKey = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_maybePseudoRandomKey).MapFailure(func(coer46 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg47 interface{}) interface{} { + return coer46(arg47.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_3_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _4_pseudoRandomKey _dafny.Sequence + _ = _4_pseudoRandomKey + _4_pseudoRandomKey = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _5_symmetricSigningKeyInput m_AwsCryptographyPrimitivesTypes.HkdfExpandInput + _ = _5_symmetricSigningKeyInput + _5_symmetricSigningKeyInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExpandInput_.Create_HkdfExpandInput_((((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_hmac(), _4_pseudoRandomKey, Companion_Default___.KEYWRAP__MAC__INFO(), (((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_outputKeyLength()) + var _6_pdkEncryptionKeyInput m_AwsCryptographyPrimitivesTypes.HkdfExpandInput + _ = _6_pdkEncryptionKeyInput + var _7_dt__update__tmp_h0 m_AwsCryptographyPrimitivesTypes.HkdfExpandInput = _5_symmetricSigningKeyInput + _ = _7_dt__update__tmp_h0 + var _8_dt__update_hinfo_h0 _dafny.Sequence = Companion_Default___.KEYWRAP__ENC__INFO() + _ = _8_dt__update_hinfo_h0 + _6_pdkEncryptionKeyInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExpandInput_.Create_HkdfExpandInput_((_7_dt__update__tmp_h0).Dtor_digestAlgorithm(), (_7_dt__update__tmp_h0).Dtor_prk(), _8_dt__update_hinfo_h0, (_7_dt__update__tmp_h0).Dtor_expectedLength()) + var _9_maybeSymmetricSigningKey m_Wrappers.Result + _ = _9_maybeSymmetricSigningKey + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (cryptoPrimitives).HkdfExpand(_5_symmetricSigningKeyInput) + _9_maybeSymmetricSigningKey = _out1 + var _10_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _10_valueOrError1 + _10_valueOrError1 = (_9_maybeSymmetricSigningKey).MapFailure(func(coer47 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg48 interface{}) interface{} { + return coer47(arg48.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_11_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_11_e) + })) + if (_10_valueOrError1).IsFailure() { + res = (_10_valueOrError1).PropagateFailure() + return res + } + var _12_symmetricSigningKey _dafny.Sequence + _ = _12_symmetricSigningKey + _12_symmetricSigningKey = (_10_valueOrError1).Extract().(_dafny.Sequence) + var _13_maybePdkEncryptionKey m_Wrappers.Result + _ = _13_maybePdkEncryptionKey + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = (cryptoPrimitives).HkdfExpand(_6_pdkEncryptionKeyInput) + _13_maybePdkEncryptionKey = _out2 + var _14_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _14_valueOrError2 + _14_valueOrError2 = (_13_maybePdkEncryptionKey).MapFailure(func(coer48 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg49 interface{}) interface{} { + return coer48(arg49.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_15_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_15_e) + })) + if (_14_valueOrError2).IsFailure() { + res = (_14_valueOrError2).PropagateFailure() + return res + } + var _16_pdkEncryptionKey _dafny.Sequence + _ = _16_pdkEncryptionKey + _16_pdkEncryptionKey = (_14_valueOrError2).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Success_(Companion_PdkEncryptionAndSymmetricSigningKeys_.Create_PdkEncryptionAndSymmetricSigningKeys_(_16_pdkEncryptionKey, _12_symmetricSigningKey)) + return res + return res +} +func (_static *CompanionStruct_Default___) KEYWRAP__MAC__INFO() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("AWS_MPL_INTERMEDIATE_KEYWRAP_MAC")) +} +func (_static *CompanionStruct_Default___) KEYWRAP__ENC__INFO() _dafny.Sequence { + return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("AWS_MPL_INTERMEDIATE_KEYWRAP_ENC")) +} + +// End of class Default__ + +// Definition of datatype IntermediateUnwrapOutput +type IntermediateUnwrapOutput struct { + Data_IntermediateUnwrapOutput_ +} + +func (_this IntermediateUnwrapOutput) Get_() Data_IntermediateUnwrapOutput_ { + return _this.Data_IntermediateUnwrapOutput_ +} + +type Data_IntermediateUnwrapOutput_ interface { + isIntermediateUnwrapOutput() +} + +type CompanionStruct_IntermediateUnwrapOutput_ struct { +} + +var Companion_IntermediateUnwrapOutput_ = CompanionStruct_IntermediateUnwrapOutput_{} + +type IntermediateUnwrapOutput_IntermediateUnwrapOutput struct { + PlaintextDataKey _dafny.Sequence + SymmetricSigningKey _dafny.Sequence + UnwrapInfo interface{} +} + +func (IntermediateUnwrapOutput_IntermediateUnwrapOutput) isIntermediateUnwrapOutput() {} + +func (CompanionStruct_IntermediateUnwrapOutput_) Create_IntermediateUnwrapOutput_(PlaintextDataKey _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, UnwrapInfo interface{}) IntermediateUnwrapOutput { + return IntermediateUnwrapOutput{IntermediateUnwrapOutput_IntermediateUnwrapOutput{PlaintextDataKey, SymmetricSigningKey, UnwrapInfo}} +} + +func (_this IntermediateUnwrapOutput) Is_IntermediateUnwrapOutput() bool { + _, ok := _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput) + return ok +} + +func (CompanionStruct_IntermediateUnwrapOutput_) Default(_default_T interface{}) IntermediateUnwrapOutput { + return Companion_IntermediateUnwrapOutput_.Create_IntermediateUnwrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _default_T) +} + +func (_this IntermediateUnwrapOutput) Dtor_plaintextDataKey() _dafny.Sequence { + return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).PlaintextDataKey +} + +func (_this IntermediateUnwrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { + return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).SymmetricSigningKey +} + +func (_this IntermediateUnwrapOutput) Dtor_unwrapInfo() interface{} { + return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).UnwrapInfo +} + +func (_this IntermediateUnwrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case IntermediateUnwrapOutput_IntermediateUnwrapOutput: + { + return "IntermediateKeyWrapping.IntermediateUnwrapOutput.IntermediateUnwrapOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.UnwrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this IntermediateUnwrapOutput) Equals(other IntermediateUnwrapOutput) bool { + switch data1 := _this.Get_().(type) { + case IntermediateUnwrapOutput_IntermediateUnwrapOutput: + { + data2, ok := other.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput) + return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.UnwrapInfo, data2.UnwrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this IntermediateUnwrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(IntermediateUnwrapOutput) + return ok && _this.Equals(typed) +} + +func Type_IntermediateUnwrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_IntermediateUnwrapOutput_{Type_T_} +} + +type type_IntermediateUnwrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_IntermediateUnwrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_IntermediateUnwrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_IntermediateUnwrapOutput_) String() string { + return "IntermediateKeyWrapping.IntermediateUnwrapOutput" +} +func (_this IntermediateUnwrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = IntermediateUnwrapOutput{} + +// End of datatype IntermediateUnwrapOutput + +// Definition of datatype IntermediateGenerateAndWrapOutput +type IntermediateGenerateAndWrapOutput struct { + Data_IntermediateGenerateAndWrapOutput_ +} + +func (_this IntermediateGenerateAndWrapOutput) Get_() Data_IntermediateGenerateAndWrapOutput_ { + return _this.Data_IntermediateGenerateAndWrapOutput_ +} + +type Data_IntermediateGenerateAndWrapOutput_ interface { + isIntermediateGenerateAndWrapOutput() +} + +type CompanionStruct_IntermediateGenerateAndWrapOutput_ struct { +} + +var Companion_IntermediateGenerateAndWrapOutput_ = CompanionStruct_IntermediateGenerateAndWrapOutput_{} + +type IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput struct { + PlaintextDataKey _dafny.Sequence + WrappedMaterial _dafny.Sequence + SymmetricSigningKey _dafny.Sequence + WrapInfo interface{} +} + +func (IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) isIntermediateGenerateAndWrapOutput() { +} + +func (CompanionStruct_IntermediateGenerateAndWrapOutput_) Create_IntermediateGenerateAndWrapOutput_(PlaintextDataKey _dafny.Sequence, WrappedMaterial _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, WrapInfo interface{}) IntermediateGenerateAndWrapOutput { + return IntermediateGenerateAndWrapOutput{IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput{PlaintextDataKey, WrappedMaterial, SymmetricSigningKey, WrapInfo}} +} + +func (_this IntermediateGenerateAndWrapOutput) Is_IntermediateGenerateAndWrapOutput() bool { + _, ok := _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) + return ok +} + +func (CompanionStruct_IntermediateGenerateAndWrapOutput_) Default(_default_T interface{}) IntermediateGenerateAndWrapOutput { + return Companion_IntermediateGenerateAndWrapOutput_.Create_IntermediateGenerateAndWrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _dafny.EmptySeq, _default_T) +} + +func (_this IntermediateGenerateAndWrapOutput) Dtor_plaintextDataKey() _dafny.Sequence { + return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).PlaintextDataKey +} + +func (_this IntermediateGenerateAndWrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { + return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).WrappedMaterial +} + +func (_this IntermediateGenerateAndWrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { + return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).SymmetricSigningKey +} + +func (_this IntermediateGenerateAndWrapOutput) Dtor_wrapInfo() interface{} { + return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).WrapInfo +} + +func (_this IntermediateGenerateAndWrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput: + { + return "IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput.IntermediateGenerateAndWrapOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this IntermediateGenerateAndWrapOutput) Equals(other IntermediateGenerateAndWrapOutput) bool { + switch data1 := _this.Get_().(type) { + case IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput: + { + data2, ok := other.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) + return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this IntermediateGenerateAndWrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(IntermediateGenerateAndWrapOutput) + return ok && _this.Equals(typed) +} + +func Type_IntermediateGenerateAndWrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_IntermediateGenerateAndWrapOutput_{Type_T_} +} + +type type_IntermediateGenerateAndWrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_IntermediateGenerateAndWrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_IntermediateGenerateAndWrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_IntermediateGenerateAndWrapOutput_) String() string { + return "IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput" +} +func (_this IntermediateGenerateAndWrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = IntermediateGenerateAndWrapOutput{} + +// End of datatype IntermediateGenerateAndWrapOutput + +// Definition of datatype IntermediateWrapOutput +type IntermediateWrapOutput struct { + Data_IntermediateWrapOutput_ +} + +func (_this IntermediateWrapOutput) Get_() Data_IntermediateWrapOutput_ { + return _this.Data_IntermediateWrapOutput_ +} + +type Data_IntermediateWrapOutput_ interface { + isIntermediateWrapOutput() +} + +type CompanionStruct_IntermediateWrapOutput_ struct { +} + +var Companion_IntermediateWrapOutput_ = CompanionStruct_IntermediateWrapOutput_{} + +type IntermediateWrapOutput_IntermediateWrapOutput struct { + WrappedMaterial _dafny.Sequence + SymmetricSigningKey _dafny.Sequence + WrapInfo interface{} +} + +func (IntermediateWrapOutput_IntermediateWrapOutput) isIntermediateWrapOutput() {} + +func (CompanionStruct_IntermediateWrapOutput_) Create_IntermediateWrapOutput_(WrappedMaterial _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, WrapInfo interface{}) IntermediateWrapOutput { + return IntermediateWrapOutput{IntermediateWrapOutput_IntermediateWrapOutput{WrappedMaterial, SymmetricSigningKey, WrapInfo}} +} + +func (_this IntermediateWrapOutput) Is_IntermediateWrapOutput() bool { + _, ok := _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput) + return ok +} + +func (CompanionStruct_IntermediateWrapOutput_) Default(_default_T interface{}) IntermediateWrapOutput { + return Companion_IntermediateWrapOutput_.Create_IntermediateWrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _default_T) +} + +func (_this IntermediateWrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { + return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).WrappedMaterial +} + +func (_this IntermediateWrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { + return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).SymmetricSigningKey +} + +func (_this IntermediateWrapOutput) Dtor_wrapInfo() interface{} { + return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).WrapInfo +} + +func (_this IntermediateWrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case IntermediateWrapOutput_IntermediateWrapOutput: + { + return "IntermediateKeyWrapping.IntermediateWrapOutput.IntermediateWrapOutput" + "(" + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this IntermediateWrapOutput) Equals(other IntermediateWrapOutput) bool { + switch data1 := _this.Get_().(type) { + case IntermediateWrapOutput_IntermediateWrapOutput: + { + data2, ok := other.Get_().(IntermediateWrapOutput_IntermediateWrapOutput) + return ok && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this IntermediateWrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(IntermediateWrapOutput) + return ok && _this.Equals(typed) +} + +func Type_IntermediateWrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_IntermediateWrapOutput_{Type_T_} +} + +type type_IntermediateWrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_IntermediateWrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_IntermediateWrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_IntermediateWrapOutput_) String() string { + return "IntermediateKeyWrapping.IntermediateWrapOutput" +} +func (_this IntermediateWrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = IntermediateWrapOutput{} + +// End of datatype IntermediateWrapOutput + +// Definition of datatype DeserializedIntermediateWrappedMaterial +type DeserializedIntermediateWrappedMaterial struct { + Data_DeserializedIntermediateWrappedMaterial_ +} + +func (_this DeserializedIntermediateWrappedMaterial) Get_() Data_DeserializedIntermediateWrappedMaterial_ { + return _this.Data_DeserializedIntermediateWrappedMaterial_ +} + +type Data_DeserializedIntermediateWrappedMaterial_ interface { + isDeserializedIntermediateWrappedMaterial() +} + +type CompanionStruct_DeserializedIntermediateWrappedMaterial_ struct { +} + +var Companion_DeserializedIntermediateWrappedMaterial_ = CompanionStruct_DeserializedIntermediateWrappedMaterial_{} + +type DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial struct { + EncryptedPdk _dafny.Sequence + ProviderWrappedIkm _dafny.Sequence +} + +func (DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) isDeserializedIntermediateWrappedMaterial() { +} + +func (CompanionStruct_DeserializedIntermediateWrappedMaterial_) Create_DeserializedIntermediateWrappedMaterial_(EncryptedPdk _dafny.Sequence, ProviderWrappedIkm _dafny.Sequence) DeserializedIntermediateWrappedMaterial { + return DeserializedIntermediateWrappedMaterial{DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial{EncryptedPdk, ProviderWrappedIkm}} +} + +func (_this DeserializedIntermediateWrappedMaterial) Is_DeserializedIntermediateWrappedMaterial() bool { + _, ok := _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) + return ok +} + +func (CompanionStruct_DeserializedIntermediateWrappedMaterial_) Default() DeserializedIntermediateWrappedMaterial { + return Companion_DeserializedIntermediateWrappedMaterial_.Create_DeserializedIntermediateWrappedMaterial_(_dafny.EmptySeq, _dafny.EmptySeq) +} + +func (_this DeserializedIntermediateWrappedMaterial) Dtor_encryptedPdk() _dafny.Sequence { + return _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).EncryptedPdk +} + +func (_this DeserializedIntermediateWrappedMaterial) Dtor_providerWrappedIkm() _dafny.Sequence { + return _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).ProviderWrappedIkm +} + +func (_this DeserializedIntermediateWrappedMaterial) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial: + { + return "IntermediateKeyWrapping.DeserializedIntermediateWrappedMaterial.DeserializedIntermediateWrappedMaterial" + "(" + _dafny.String(data.EncryptedPdk) + ", " + _dafny.String(data.ProviderWrappedIkm) + ")" + } + default: + { + return "" + } + } +} + +func (_this DeserializedIntermediateWrappedMaterial) Equals(other DeserializedIntermediateWrappedMaterial) bool { + switch data1 := _this.Get_().(type) { + case DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial: + { + data2, ok := other.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) + return ok && data1.EncryptedPdk.Equals(data2.EncryptedPdk) && data1.ProviderWrappedIkm.Equals(data2.ProviderWrappedIkm) + } + default: + { + return false // unexpected + } + } +} + +func (_this DeserializedIntermediateWrappedMaterial) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DeserializedIntermediateWrappedMaterial) + return ok && _this.Equals(typed) +} + +func Type_DeserializedIntermediateWrappedMaterial_() _dafny.TypeDescriptor { + return type_DeserializedIntermediateWrappedMaterial_{} +} + +type type_DeserializedIntermediateWrappedMaterial_ struct { +} + +func (_this type_DeserializedIntermediateWrappedMaterial_) Default() interface{} { + return Companion_DeserializedIntermediateWrappedMaterial_.Default() +} + +func (_this type_DeserializedIntermediateWrappedMaterial_) String() string { + return "IntermediateKeyWrapping.DeserializedIntermediateWrappedMaterial" +} +func (_this DeserializedIntermediateWrappedMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DeserializedIntermediateWrappedMaterial{} + +// End of datatype DeserializedIntermediateWrappedMaterial + +// Definition of datatype PdkEncryptionAndSymmetricSigningKeys +type PdkEncryptionAndSymmetricSigningKeys struct { + Data_PdkEncryptionAndSymmetricSigningKeys_ +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) Get_() Data_PdkEncryptionAndSymmetricSigningKeys_ { + return _this.Data_PdkEncryptionAndSymmetricSigningKeys_ +} + +type Data_PdkEncryptionAndSymmetricSigningKeys_ interface { + isPdkEncryptionAndSymmetricSigningKeys() +} + +type CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_ struct { +} + +var Companion_PdkEncryptionAndSymmetricSigningKeys_ = CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_{} + +type PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys struct { + PdkEncryptionKey _dafny.Sequence + SymmetricSigningKey _dafny.Sequence +} + +func (PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) isPdkEncryptionAndSymmetricSigningKeys() { +} + +func (CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_) Create_PdkEncryptionAndSymmetricSigningKeys_(PdkEncryptionKey _dafny.Sequence, SymmetricSigningKey _dafny.Sequence) PdkEncryptionAndSymmetricSigningKeys { + return PdkEncryptionAndSymmetricSigningKeys{PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys{PdkEncryptionKey, SymmetricSigningKey}} +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) Is_PdkEncryptionAndSymmetricSigningKeys() bool { + _, ok := _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) + return ok +} + +func (CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_) Default() PdkEncryptionAndSymmetricSigningKeys { + return Companion_PdkEncryptionAndSymmetricSigningKeys_.Create_PdkEncryptionAndSymmetricSigningKeys_(_dafny.EmptySeq, _dafny.EmptySeq) +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) Dtor_pdkEncryptionKey() _dafny.Sequence { + return _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) Dtor_symmetricSigningKey() _dafny.Sequence { + return _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys: + { + return "IntermediateKeyWrapping.PdkEncryptionAndSymmetricSigningKeys.PdkEncryptionAndSymmetricSigningKeys" + "(" + _dafny.String(data.PdkEncryptionKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ")" + } + default: + { + return "" + } + } +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) Equals(other PdkEncryptionAndSymmetricSigningKeys) bool { + switch data1 := _this.Get_().(type) { + case PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys: + { + data2, ok := other.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) + return ok && data1.PdkEncryptionKey.Equals(data2.PdkEncryptionKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) + } + default: + { + return false // unexpected + } + } +} + +func (_this PdkEncryptionAndSymmetricSigningKeys) EqualsGeneric(other interface{}) bool { + typed, ok := other.(PdkEncryptionAndSymmetricSigningKeys) + return ok && _this.Equals(typed) +} + +func Type_PdkEncryptionAndSymmetricSigningKeys_() _dafny.TypeDescriptor { + return type_PdkEncryptionAndSymmetricSigningKeys_{} +} + +type type_PdkEncryptionAndSymmetricSigningKeys_ struct { +} + +func (_this type_PdkEncryptionAndSymmetricSigningKeys_) Default() interface{} { + return Companion_PdkEncryptionAndSymmetricSigningKeys_.Default() +} + +func (_this type_PdkEncryptionAndSymmetricSigningKeys_) String() string { + return "IntermediateKeyWrapping.PdkEncryptionAndSymmetricSigningKeys" +} +func (_this PdkEncryptionAndSymmetricSigningKeys) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = PdkEncryptionAndSymmetricSigningKeys{} + +// End of datatype PdkEncryptionAndSymmetricSigningKeys diff --git a/releases/go/mpl/KMSKeystoreOperations/KMSKeystoreOperations.go b/releases/go/mpl/KMSKeystoreOperations/KMSKeystoreOperations.go new file mode 100644 index 000000000..ff294e5ea --- /dev/null +++ b/releases/go/mpl/KMSKeystoreOperations/KMSKeystoreOperations.go @@ -0,0 +1,426 @@ +// Package KMSKeystoreOperations +// Dafny module KMSKeystoreOperations compiled into Go + +package KMSKeystoreOperations + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "KMSKeystoreOperations.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ReplaceRegion(arn _dafny.Sequence, region _dafny.Sequence) _dafny.Sequence { + var _0_parsed m_Wrappers.Result = m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(arn) + _ = _0_parsed + if (_0_parsed).Is_Failure() { + return arn + } else if !(m_AwsArnParsing.Companion_Default___.IsMultiRegionAwsKmsArn((_0_parsed).Dtor_value().(m_AwsArnParsing.AwsArn))) { + return arn + } else { + var _1_newArn _dafny.Sequence = ((_0_parsed).Dtor_value().(m_AwsArnParsing.AwsArn)).ToArnString(m_Wrappers.Companion_Option_.Create_Some_(region)) + _ = _1_newArn + if m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType(_1_newArn) { + return _1_newArn + } else { + return arn + } + } +} +func (_static *CompanionStruct_Default___) GetArn(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, discoverdArn _dafny.Sequence) _dafny.Sequence { + var _source0 m_AwsCryptographyKeyStoreTypes.KMSConfiguration = kmsConfiguration + _ = _source0 + { + if _source0.Is_kmsKeyArn() { + var _0_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsKeyArn).KmsKeyArn + _ = _0_arn + return _0_arn + } + } + { + if _source0.Is_kmsMRKeyArn() { + var _1_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsMRKeyArn).KmsMRKeyArn + _ = _1_arn + return _1_arn + } + } + { + if _source0.Is_discovery() { + var _2_obj m_AwsCryptographyKeyStoreTypes.Discovery = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_discovery).Discovery + _ = _2_obj + return discoverdArn + } + } + { + var _3_region m_AwsCryptographyKeyStoreTypes.MRDiscovery = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_mrDiscovery).MrDiscovery + _ = _3_region + return Companion_Default___.ReplaceRegion(discoverdArn, (_3_region).Dtor_region()) + } +} +func (_static *CompanionStruct_Default___) AttemptKmsOperation_q(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, encryptionContext _dafny.Map) bool { + var _source0 m_AwsCryptographyKeyStoreTypes.KMSConfiguration = kmsConfiguration + _ = _source0 + { + if _source0.Is_kmsKeyArn() { + var _0_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsKeyArn).KmsKeyArn + _ = _0_arn + return (_dafny.Companion_Sequence_.Equal(_0_arn, (encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence))) && (m_KmsArn.Companion_Default___.ValidKmsArn_q(_0_arn)) + } + } + { + if _source0.Is_kmsMRKeyArn() { + var _1_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsMRKeyArn).KmsMRKeyArn + _ = _1_arn + return (Companion_Default___.MrkMatch(_1_arn, (encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence))) && (m_KmsArn.Companion_Default___.ValidKmsArn_q(_1_arn)) + } + } + { + if _source0.Is_discovery() { + var _2_obj m_AwsCryptographyKeyStoreTypes.Discovery = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_discovery).Discovery + _ = _2_obj + return m_KmsArn.Companion_Default___.ValidKmsArn_q((encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)) + } + } + { + var _3_obj m_AwsCryptographyKeyStoreTypes.MRDiscovery = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_mrDiscovery).MrDiscovery + _ = _3_obj + return m_KmsArn.Companion_Default___.ValidKmsArn_q((encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)) + } +} +func (_static *CompanionStruct_Default___) Compatible_q(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, keyId _dafny.Sequence) bool { + var _source0 m_AwsCryptographyKeyStoreTypes.KMSConfiguration = kmsConfiguration + _ = _source0 + { + if _source0.Is_kmsKeyArn() { + var _0_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsKeyArn).KmsKeyArn + _ = _0_arn + return _dafny.Companion_Sequence_.Equal(_0_arn, keyId) + } + } + { + var _1_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsMRKeyArn).KmsMRKeyArn + _ = _1_arn + return Companion_Default___.MrkMatch(_1_arn, keyId) + } +} +func (_static *CompanionStruct_Default___) OptCompatible_q(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, keyId m_Wrappers.Option) bool { + return ((keyId).Is_Some()) && (Companion_Default___.Compatible_q(kmsConfiguration, (keyId).Dtor_value().(_dafny.Sequence))) +} +func (_static *CompanionStruct_Default___) MrkMatch(x _dafny.Sequence, y _dafny.Sequence) bool { + var _0_xArn m_Wrappers.Result = m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(x) + _ = _0_xArn + var _1_yArn m_Wrappers.Result = m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(y) + _ = _1_yArn + if ((_0_xArn).Is_Failure()) || ((_1_yArn).Is_Failure()) { + return false + } else { + return m_AwsKmsMrkMatchForDecrypt.Companion_Default___.AwsKmsMrkMatchForDecrypt(m_AwsArnParsing.Companion_AwsKmsIdentifier_.Create_AwsKmsArnIdentifier_((_0_xArn).Dtor_value().(m_AwsArnParsing.AwsArn)), m_AwsArnParsing.Companion_AwsKmsIdentifier_.Create_AwsKmsArnIdentifier_((_1_yArn).Dtor_value().(m_AwsArnParsing.AwsArn))) + } +} +func (_static *CompanionStruct_Default___) HasKeyId(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration) bool { + return ((kmsConfiguration).Is_kmsKeyArn()) || ((kmsConfiguration).Is_kmsMRKeyArn()) +} +func (_static *CompanionStruct_Default___) GetKeyId(kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration) _dafny.Sequence { + var _source0 m_AwsCryptographyKeyStoreTypes.KMSConfiguration = kmsConfiguration + _ = _source0 + { + if _source0.Is_kmsKeyArn() { + var _0_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsKeyArn).KmsKeyArn + _ = _0_arn + return _0_arn + } + } + { + var _1_arn _dafny.Sequence = _source0.Get_().(m_AwsCryptographyKeyStoreTypes.KMSConfiguration_kmsMRKeyArn).KmsMRKeyArn + _ = _1_arn + return _1_arn + } +} +func (_static *CompanionStruct_Default___) GenerateKey(encryptionContext _dafny.Map, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextResponse_.Default()) + _ = res + var _0_kmsKeyArn _dafny.Sequence + _ = _0_kmsKeyArn + _0_kmsKeyArn = Companion_Default___.GetKeyId(kmsConfiguration) + var _1_generatorRequest m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextRequest + _ = _1_generatorRequest + _1_generatorRequest = m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextRequest_.Create_GenerateDataKeyWithoutPlaintextRequest_(_0_kmsKeyArn, m_Wrappers.Companion_Option_.Create_Some_(encryptionContext), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_(int32(32)), m_Wrappers.Companion_Option_.Create_Some_(grantTokens), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeGenerateResponse m_Wrappers.Result + _ = _2_maybeGenerateResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (kmsClient).GenerateDataKeyWithoutPlaintext(_1_generatorRequest) + _2_maybeGenerateResponse = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_GenerateDataKeyWithoutPlaintextResponse_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeGenerateResponse).MapFailure(func(coer11 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg11 interface{}) interface{} { + return coer11(arg11.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_4_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _5_generateResponse m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse + _ = _5_generateResponse + _5_generateResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsKmsTypes.GenerateDataKeyWithoutPlaintextResponse) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((true) && (((_5_generateResponse).Dtor_KeyId()).Is_Some()), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid response from KMS GenerateDataKey:: Invalid Key Id"))) + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need((((_5_generateResponse).Dtor_CiphertextBlob()).Is_Some()) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType(((_5_generateResponse).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence))), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid response from AWS KMS GenerateDataKey: Invalid ciphertext"))) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(_5_generateResponse) + return res + return res +} +func (_static *CompanionStruct_Default___) ReEncryptKey(ciphertext _dafny.Sequence, sourceEncryptionContext _dafny.Map, destinationEncryptionContext _dafny.Map, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_ReEncryptResponse_.Default()) + _ = res + var _0_kmsKeyArn _dafny.Sequence + _ = _0_kmsKeyArn + _0_kmsKeyArn = Companion_Default___.GetKeyId(kmsConfiguration) + var _1_reEncryptRequest m_ComAmazonawsKmsTypes.ReEncryptRequest + _ = _1_reEncryptRequest + _1_reEncryptRequest = m_ComAmazonawsKmsTypes.Companion_ReEncryptRequest_.Create_ReEncryptRequest_(ciphertext, m_Wrappers.Companion_Option_.Create_Some_(sourceEncryptionContext), m_Wrappers.Companion_Option_.Create_Some_(_0_kmsKeyArn), _0_kmsKeyArn, m_Wrappers.Companion_Option_.Create_Some_(destinationEncryptionContext), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_Some_(grantTokens), m_Wrappers.Companion_Option_.Create_None_()) + var _2_maybeReEncryptResponse m_Wrappers.Result + _ = _2_maybeReEncryptResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (kmsClient).ReEncrypt(_1_reEncryptRequest) + _2_maybeReEncryptResponse = _out0 + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_ReEncryptResponse_.Default()) + _ = _3_valueOrError0 + _3_valueOrError0 = (_2_maybeReEncryptResponse).MapFailure(func(coer12 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg12 interface{}) interface{} { + return coer12(arg12.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_4_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(_4_e) + })) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _5_reEncryptResponse m_ComAmazonawsKmsTypes.ReEncryptResponse + _ = _5_reEncryptResponse + _5_reEncryptResponse = (_3_valueOrError0).Extract().(m_ComAmazonawsKmsTypes.ReEncryptResponse) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((((((_5_reEncryptResponse).Dtor_SourceKeyId()).Is_Some()) && (((_5_reEncryptResponse).Dtor_KeyId()).Is_Some())) && (_dafny.Companion_Sequence_.Equal(((_5_reEncryptResponse).Dtor_SourceKeyId()).Dtor_value().(_dafny.Sequence), _0_kmsKeyArn))) && (_dafny.Companion_Sequence_.Equal(((_5_reEncryptResponse).Dtor_KeyId()).Dtor_value().(_dafny.Sequence), _0_kmsKeyArn)), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid response from KMS ReEncrypt:: Invalid Key Id"))) + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need((((_5_reEncryptResponse).Dtor_CiphertextBlob()).Is_Some()) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType(((_5_reEncryptResponse).Dtor_CiphertextBlob()).Dtor_value().(_dafny.Sequence))), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid response from AWS KMS ReEncrypt: Invalid ciphertext."))) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(_5_reEncryptResponse) + return res + return res +} +func (_static *CompanionStruct_Default___) DecryptKey(encryptionContext _dafny.Map, item _dafny.Map, kmsConfiguration m_AwsCryptographyKeyStoreTypes.KMSConfiguration, grantTokens _dafny.Sequence, kmsClient m_ComAmazonawsKmsTypes.IKMSClient) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = output + var _0_kmsKeyArn _dafny.Sequence + _ = _0_kmsKeyArn + _0_kmsKeyArn = Companion_Default___.GetArn(kmsConfiguration, (encryptionContext).Get(m_Structure.Companion_Default___.KMS__FIELD()).(_dafny.Sequence)) + var _1_maybeDecryptResponse m_Wrappers.Result + _ = _1_maybeDecryptResponse + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (kmsClient).Decrypt(m_ComAmazonawsKmsTypes.Companion_DecryptRequest_.Create_DecryptRequest_(((item).Get(m_Structure.Companion_Default___.BRANCH__KEY__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_B(), m_Wrappers.Companion_Option_.Create_Some_(encryptionContext), m_Wrappers.Companion_Option_.Create_Some_(grantTokens), m_Wrappers.Companion_Option_.Create_Some_(_0_kmsKeyArn), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_())) + _1_maybeDecryptResponse = _out0 + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default()) + _ = _2_valueOrError0 + _2_valueOrError0 = (_1_maybeDecryptResponse).MapFailure(func(coer13 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg13 interface{}) interface{} { + return coer13(arg13.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_3_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(_3_e) + })) + if (_2_valueOrError0).IsFailure() { + output = (_2_valueOrError0).PropagateFailure() + return output + } + var _4_decryptResponse m_ComAmazonawsKmsTypes.DecryptResponse + _ = _4_decryptResponse + _4_decryptResponse = (_2_valueOrError0).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse) + var _5_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError1 + _5_valueOrError1 = m_Wrappers.Companion_Default___.Need((((_4_decryptResponse).Dtor_Plaintext()).Is_Some()) && ((_dafny.IntOfInt64(32)).Cmp(_dafny.IntOfUint32((((_4_decryptResponse).Dtor_Plaintext()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid response from AWS KMS Decrypt: Key is not 32 bytes."))) + if (_5_valueOrError1).IsFailure() { + output = (_5_valueOrError1).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(_4_decryptResponse) + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/KeyStore/KeyStore.go b/releases/go/mpl/KeyStore/KeyStore.go new file mode 100644 index 000000000..0ccd2e53e --- /dev/null +++ b/releases/go/mpl/KeyStore/KeyStore.go @@ -0,0 +1,502 @@ +// Package KeyStore +// Dafny module KeyStore compiled into Go + +package KeyStore + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UUID "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UUID" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "KeyStore.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DefaultKeyStoreConfig() m_AwsCryptographyKeyStoreTypes.KeyStoreConfig { + return m_AwsCryptographyKeyStoreTypes.Companion_KeyStoreConfig_.Create_KeyStoreConfig_(_dafny.SeqOfString("None"), m_AwsCryptographyKeyStoreTypes.Companion_KMSConfiguration_.Create_kmsKeyArn_(_dafny.SeqOfString("arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab")), _dafny.SeqOfString("None"), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) +} +func (_static *CompanionStruct_Default___) KeyStore(config m_AwsCryptographyKeyStoreTypes.KeyStoreConfig) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_kmsClient m_ComAmazonawsKmsTypes.IKMSClient = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) + _ = _0_kmsClient + var _1_ddbClient m_ComAmazonawsDynamodbTypes.IDynamoDBClient = (m_ComAmazonawsDynamodbTypes.IDynamoDBClient)(nil) + _ = _1_ddbClient + var _2_inferredRegion m_Wrappers.Option + _ = _2_inferredRegion + _2_inferredRegion = m_Wrappers.Companion_Option_.Create_None_() + if m_KMSKeystoreOperations.Companion_Default___.HasKeyId((config).Dtor_kmsConfiguration()) { + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _3_valueOrError0 + _3_valueOrError0 = m_KmsArn.Companion_Default___.IsValidKeyArn(m_KMSKeystoreOperations.Companion_Default___.GetKeyId((config).Dtor_kmsConfiguration())) + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _4_parsedArn m_AwsArnParsing.AwsArn + _ = _4_parsedArn + _4_parsedArn = (_3_valueOrError0).Extract().(m_AwsArnParsing.AwsArn) + _2_inferredRegion = m_Wrappers.Companion_Option_.Create_Some_((_4_parsedArn).Dtor_region()) + } else if ((config).Dtor_kmsConfiguration()).Is_mrDiscovery() { + _2_inferredRegion = m_Wrappers.Companion_Option_.Create_Some_((((config).Dtor_kmsConfiguration()).Dtor_mrDiscovery()).Dtor_region()) + } + var _5_grantTokens m_Wrappers.Result + _ = _5_grantTokens + _5_grantTokens = m_AwsKmsUtils.Companion_Default___.GetValidGrantTokens((config).Dtor_grantTokens()) + var _6_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError1 + _6_valueOrError1 = m_Wrappers.Companion_Default___.Need((true) && ((_5_grantTokens).Is_Success()), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Grant Tokens passed to Key Store configuration are invalid."))) + if (_6_valueOrError1).IsFailure() { + res = (_6_valueOrError1).PropagateFailure() + return res + } + var _7_keyStoreId _dafny.Sequence = _dafny.EmptySeq.SetString() + _ = _7_keyStoreId + if ((config).Dtor_id()).Is_Some() { + _7_keyStoreId = ((config).Dtor_id()).Dtor_value().(_dafny.Sequence) + } else { + var _8_maybeUuid m_Wrappers.Result + _ = _8_maybeUuid + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_UUID.GenerateUUID() + _8_maybeUuid = _out0 + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _9_valueOrError2 + _9_valueOrError2 = (_8_maybeUuid).MapFailure(func(coer24 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg24 interface{}) interface{} { + return coer24(arg24.(_dafny.Sequence)) + } + }(func(_10_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_10_e) + })) + if (_9_valueOrError2).IsFailure() { + res = (_9_valueOrError2).PropagateFailure() + return res + } + var _11_uuid _dafny.Sequence + _ = _11_uuid + _11_uuid = (_9_valueOrError2).Extract().(_dafny.Sequence) + _7_keyStoreId = _11_uuid + } + if ((config).Dtor_kmsClient()).Is_Some() { + _0_kmsClient = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_(((config).Dtor_kmsClient()).Dtor_value()) + } else if (((config).Dtor_kmsClient()).Is_None()) && ((_2_inferredRegion).Is_Some()) { + var _12_maybeKmsClient m_Wrappers.Result + _ = _12_maybeKmsClient + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Com_Amazonaws_Kms.Companion_Default___.KMSClientForRegion((_2_inferredRegion).Dtor_value().(_dafny.Sequence)) + _12_maybeKmsClient = _out1 + var _13_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _13_valueOrError3 + _13_valueOrError3 = (_12_maybeKmsClient).MapFailure(func(coer25 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg25 interface{}) interface{} { + return coer25(arg25.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_14_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(_14_e) + })) + if (_13_valueOrError3).IsFailure() { + res = (_13_valueOrError3).PropagateFailure() + return res + } + _0_kmsClient = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_13_valueOrError3).Extract()) + } else { + var _15_maybeKmsClient m_Wrappers.Result + _ = _15_maybeKmsClient + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_Com_Amazonaws_Kms.Companion_Default___.KMSClient() + _15_maybeKmsClient = _out2 + var _16_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _16_valueOrError4 + _16_valueOrError4 = (_15_maybeKmsClient).MapFailure(func(coer26 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg26 interface{}) interface{} { + return coer26(arg26.(m_ComAmazonawsKmsTypes.Error)) + } + }(func(_17_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(_17_e) + })) + if (_16_valueOrError4).IsFailure() { + res = (_16_valueOrError4).PropagateFailure() + return res + } + _0_kmsClient = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_16_valueOrError4).Extract()) + } + if ((config).Dtor_ddbClient()).Is_Some() { + _1_ddbClient = m_ComAmazonawsDynamodbTypes.Companion_IDynamoDBClient_.CastTo_(((config).Dtor_ddbClient()).Dtor_value()) + } else if (((config).Dtor_ddbClient()).Is_None()) && ((_2_inferredRegion).Is_Some()) { + var _18_maybeDdbClient m_Wrappers.Result + _ = _18_maybeDdbClient + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_Com_Amazonaws_Dynamodb.Companion_Default___.DDBClientForRegion((_2_inferredRegion).Dtor_value().(_dafny.Sequence)) + _18_maybeDdbClient = _out3 + var _19_valueOrError5 m_Wrappers.Result = m_Wrappers.Result{} + _ = _19_valueOrError5 + _19_valueOrError5 = (_18_maybeDdbClient).MapFailure(func(coer27 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg27 interface{}) interface{} { + return coer27(arg27.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_20_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_20_e) + })) + if (_19_valueOrError5).IsFailure() { + res = (_19_valueOrError5).PropagateFailure() + return res + } + _1_ddbClient = m_ComAmazonawsDynamodbTypes.Companion_IDynamoDBClient_.CastTo_((_19_valueOrError5).Extract()) + } else { + var _21_maybeDdbClient m_Wrappers.Result + _ = _21_maybeDdbClient + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = m_Com_Amazonaws_Dynamodb.Companion_Default___.DynamoDBClient() + _21_maybeDdbClient = _out4 + var _22_valueOrError6 m_Wrappers.Result = m_Wrappers.Result{} + _ = _22_valueOrError6 + _22_valueOrError6 = (_21_maybeDdbClient).MapFailure(func(coer28 func(m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg28 interface{}) interface{} { + return coer28(arg28.(m_ComAmazonawsDynamodbTypes.Error)) + } + }(func(_23_e m_ComAmazonawsDynamodbTypes.Error) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(_23_e) + })) + if (_22_valueOrError6).IsFailure() { + res = (_22_valueOrError6).PropagateFailure() + return res + } + _1_ddbClient = m_ComAmazonawsDynamodbTypes.Companion_IDynamoDBClient_.CastTo_((_22_valueOrError6).Extract()) + } + var _24_valueOrError7 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _24_valueOrError7 + _24_valueOrError7 = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__TableName((config).Dtor_ddbTableName()), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Invalid Amazon DynamoDB Table Name"))) + if (_24_valueOrError7).IsFailure() { + res = (_24_valueOrError7).PropagateFailure() + return res + } + var _25_client *KeyStoreClient + _ = _25_client + var _nw0 *KeyStoreClient = New_KeyStoreClient_() + _ = _nw0 + _nw0.Ctor__(m_AwsCryptographyKeyStoreOperations.Companion_Config_.Create_Config_(_7_keyStoreId, (config).Dtor_ddbTableName(), (config).Dtor_logicalKeyStoreName(), (config).Dtor_kmsConfiguration(), (_5_grantTokens).Dtor_value().(_dafny.Sequence), _0_kmsClient, _1_ddbClient)) + _25_client = _nw0 + res = m_Wrappers.Companion_Result_.Create_Success_(_25_client) + return res + return res +} +func (_static *CompanionStruct_Default___) CreateSuccessOfClient(client m_AwsCryptographyKeyStoreTypes.IKeyStoreClient) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Success_(client) +} +func (_static *CompanionStruct_Default___) CreateFailureOfError(error_ m_AwsCryptographyKeyStoreTypes.Error) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Failure_(error_) +} + +// End of class Default__ + +// Definition of class KeyStoreClient +type KeyStoreClient struct { + _config m_AwsCryptographyKeyStoreOperations.Config +} + +func New_KeyStoreClient_() *KeyStoreClient { + _this := KeyStoreClient{} + + _this._config = m_AwsCryptographyKeyStoreOperations.Config{} + return &_this +} + +type CompanionStruct_KeyStoreClient_ struct { +} + +var Companion_KeyStoreClient_ = CompanionStruct_KeyStoreClient_{} + +func (_this *KeyStoreClient) Equals(other *KeyStoreClient) bool { + return _this == other +} + +func (_this *KeyStoreClient) EqualsGeneric(x interface{}) bool { + other, ok := x.(*KeyStoreClient) + return ok && _this.Equals(other) +} + +func (*KeyStoreClient) String() string { + return "KeyStore.KeyStoreClient" +} + +func Type_KeyStoreClient_() _dafny.TypeDescriptor { + return type_KeyStoreClient_{} +} + +type type_KeyStoreClient_ struct { +} + +func (_this type_KeyStoreClient_) Default() interface{} { + return (*KeyStoreClient)(nil) +} + +func (_this type_KeyStoreClient_) String() string { + return "KeyStore.KeyStoreClient" +} +func (_this *KeyStoreClient) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_AwsCryptographyKeyStoreTypes.Companion_IKeyStoreClient_.TraitID_} +} + +var _ m_AwsCryptographyKeyStoreTypes.IKeyStoreClient = &KeyStoreClient{} +var _ _dafny.TraitOffspring = &KeyStoreClient{} + +func (_this *KeyStoreClient) Ctor__(config m_AwsCryptographyKeyStoreOperations.Config) { + { + (_this)._config = config + } +} +func (_this *KeyStoreClient) GetKeyStoreInfo() m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.GetKeyStoreInfo((_this).Config()) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) CreateKeyStore(input m_AwsCryptographyKeyStoreTypes.CreateKeyStoreInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.CreateKeyStore((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) CreateKey(input m_AwsCryptographyKeyStoreTypes.CreateKeyInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_CreateKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.CreateKey((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) VersionKey(input m_AwsCryptographyKeyStoreTypes.VersionKeyInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_VersionKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.VersionKey((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) GetActiveBranchKey(input m_AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.GetActiveBranchKey((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) GetBranchKeyVersion(input m_AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.GetBranchKeyVersion((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) GetBeaconKey(input m_AwsCryptographyKeyStoreTypes.GetBeaconKeyInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyKeyStoreOperations.Companion_Default___.GetBeaconKey((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *KeyStoreClient) Config() m_AwsCryptographyKeyStoreOperations.Config { + { + return _this._config + } +} + +// End of class KeyStoreClient diff --git a/releases/go/mpl/KeyStoreErrorMessages/KeyStoreErrorMessages.go b/releases/go/mpl/KeyStoreErrorMessages/KeyStoreErrorMessages.go new file mode 100644 index 000000000..0eac7f125 --- /dev/null +++ b/releases/go/mpl/KeyStoreErrorMessages/KeyStoreErrorMessages.go @@ -0,0 +1,191 @@ +// Package KeyStoreErrorMessages +// Dafny module KeyStoreErrorMessages compiled into Go + +package KeyStoreErrorMessages + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "KeyStoreErrorMessages.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) GET__KEY__ARN__DISAGREEMENT() _dafny.Sequence { + return _dafny.SeqOfString("Branch key's KMS Key ARN read from Dynamodb does not match Key Store's configured KMS Key ARN.") +} +func (_static *CompanionStruct_Default___) VERSION__KEY__KMS__KEY__ARN__DISAGREEMENT() _dafny.Sequence { + return Companion_Default___.GET__KEY__ARN__DISAGREEMENT() +} +func (_static *CompanionStruct_Default___) KMS__CONFIG__KMS__ARN__INVALID() _dafny.Sequence { + return _dafny.SeqOfString("KMSConfiguration's KMS Key ARN is invalid.") +} +func (_static *CompanionStruct_Default___) CUSTOM__BRANCH__KEY__ID__NEED__EC() _dafny.Sequence { + return _dafny.SeqOfString("Custom branch key identifier requires custom encryption context.") +} +func (_static *CompanionStruct_Default___) DISCOVERY__CREATE__KEY__NOT__SUPPORTED() _dafny.Sequence { + return _dafny.SeqOfString("Key Store's kmsConfiguration MUST BE kmsKeyArn or kmsMRKeyArn to Create Branch Keys.") +} +func (_static *CompanionStruct_Default___) DISCOVERY__VERSION__KEY__NOT__SUPPORTED() _dafny.Sequence { + return _dafny.SeqOfString("Key Store's kmsConfiguration MUST BE kmsKeyArn or kmsMRKeyArn to Version Branch Keys.") +} +func (_static *CompanionStruct_Default___) UTF8__ENCODING__ENCRYPTION__CONTEXT__ERROR() _dafny.Sequence { + return _dafny.SeqOfString("Unable to UTF8 Encode element of Encryption Context.") +} +func (_static *CompanionStruct_Default___) ALIAS__NOT__ALLOWED() _dafny.Sequence { + return _dafny.SeqOfString("Key Store encountered a KMS Alias ARN instead of a KMS Key ARN, which is not allowed.") +} +func (_static *CompanionStruct_Default___) NO__CORRESPONDING__BRANCH__KEY() _dafny.Sequence { + return _dafny.SeqOfString("No item found for corresponding branch key identifier.") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__ID__NEEDED() _dafny.Sequence { + return _dafny.SeqOfString("Empty string not supported for branch key identifier.") +} +func (_static *CompanionStruct_Default___) RETRIEVED__KEYSTORE__ITEM__INVALID__KMS__ARN() _dafny.Sequence { + return _dafny.SeqOfString("The `kms-arn` field for the requested branch key identifier is corrupted.") +} + +// End of class Default__ diff --git a/releases/go/mpl/Keyring/Keyring.go b/releases/go/mpl/Keyring/Keyring.go new file mode 100644 index 000000000..2a258a91b --- /dev/null +++ b/releases/go/mpl/Keyring/Keyring.go @@ -0,0 +1,173 @@ +// Package Keyring +// Dafny module Keyring compiled into Go + +package Keyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ + +type Dummy__ struct{} + +// Definition of trait VerifiableInterface +type VerifiableInterface interface { + String() string + OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result + OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result + OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result + OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result +} +type CompanionStruct_VerifiableInterface_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_VerifiableInterface_ = CompanionStruct_VerifiableInterface_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_VerifiableInterface_) CastTo_(x interface{}) VerifiableInterface { + var t VerifiableInterface + t, _ = x.(VerifiableInterface) + return t +} + +// End of trait VerifiableInterface diff --git a/releases/go/mpl/KmsArn/KmsArn.go b/releases/go/mpl/KmsArn/KmsArn.go new file mode 100644 index 000000000..53caaac01 --- /dev/null +++ b/releases/go/mpl/KmsArn/KmsArn.go @@ -0,0 +1,194 @@ +// Package KmsArn +// Dafny module KmsArn compiled into Go + +package KmsArn + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "KmsArn.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ValidKmsArn_q(input _dafny.Sequence) bool { + return (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType(input)) && (func(_pat_let0_0 m_Wrappers.Result) bool { + return func(_0_maybeParsed m_Wrappers.Result) bool { + return ((_0_maybeParsed).Is_Success()) && (_dafny.Companion_Sequence_.Equal((((_0_maybeParsed).Dtor_value().(m_AwsArnParsing.AwsArn)).Dtor_resource()).Dtor_resourceType(), _dafny.SeqOfString("key"))) + }(_pat_let0_0) + }(m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(input))) +} +func (_static *CompanionStruct_Default___) IsValidKeyArn(input _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType(input), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.KMS__CONFIG__KMS__ARN__INVALID())) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_valueOrError1 m_Wrappers.Result = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(input)).MapFailure(func(coer9 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg9 interface{}) interface{} { + return coer9(arg9.(_dafny.Sequence)) + } + }(func(_2_error _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(m_KeyStoreErrorMessages.Companion_Default___.KMS__CONFIG__KMS__ARN__INVALID(), _dafny.SeqOfString(". ")), _2_error)) + })) + _ = _1_valueOrError1 + if (_1_valueOrError1).IsFailure() { + return (_1_valueOrError1).PropagateFailure() + } else { + var _3_arn m_AwsArnParsing.AwsArn = (_1_valueOrError1).Extract().(m_AwsArnParsing.AwsArn) + _ = _3_arn + if !_dafny.Companion_Sequence_.Equal(((_3_arn).Dtor_resource()).Dtor_resourceType(), _dafny.SeqOfString("key")) { + return m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(m_KeyStoreErrorMessages.Companion_Default___.ALIAS__NOT__ALLOWED())) + } else { + return m_Wrappers.Companion_Result_.Create_Success_(_3_arn) + } + } + } +} + +// End of class Default__ diff --git a/releases/go/mpl/LICENSE b/releases/go/mpl/LICENSE new file mode 100644 index 000000000..67db85882 --- /dev/null +++ b/releases/go/mpl/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/releases/go/mpl/LocalCMC/LocalCMC.go b/releases/go/mpl/LocalCMC/LocalCMC.go new file mode 100644 index 000000000..9c978ce6e --- /dev/null +++ b/releases/go/mpl/LocalCMC/LocalCMC.go @@ -0,0 +1,894 @@ +// Package LocalCMC +// Dafny module LocalCMC compiled into Go + +package LocalCMC + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DafnyLibraries "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DafnyLibraries" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m__Time "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Time_" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "LocalCMC.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) RemoveValue(k0 interface{}, m _dafny.Map) { + var _0_m_k _dafny.Map + _ = _0_m_k + _0_m_k = (m).Subtract(_dafny.SetOf(k0)) +} +func (_static *CompanionStruct_Default___) NULL() Ref { + return Companion_Ref_.Create_Null_() +} +func (_static *CompanionStruct_Default___) INT32__MAX__VALUE() int32 { + return int32(2040109465) +} +func (_static *CompanionStruct_Default___) INT64__MAX__VALUE() int64 { + return int64(8762203435012037017) +} + +// End of class Default__ + +// Definition of datatype Ref +type Ref struct { + Data_Ref_ +} + +func (_this Ref) Get_() Data_Ref_ { + return _this.Data_Ref_ +} + +type Data_Ref_ interface { + isRef() +} + +type CompanionStruct_Ref_ struct { +} + +var Companion_Ref_ = CompanionStruct_Ref_{} + +type Ref_Ptr struct { + Deref interface{} +} + +func (Ref_Ptr) isRef() {} + +func (CompanionStruct_Ref_) Create_Ptr_(Deref interface{}) Ref { + return Ref{Ref_Ptr{Deref}} +} + +func (_this Ref) Is_Ptr() bool { + _, ok := _this.Get_().(Ref_Ptr) + return ok +} + +type Ref_Null struct { +} + +func (Ref_Null) isRef() {} + +func (CompanionStruct_Ref_) Create_Null_() Ref { + return Ref{Ref_Null{}} +} + +func (_this Ref) Is_Null() bool { + _, ok := _this.Get_().(Ref_Null) + return ok +} + +func (CompanionStruct_Ref_) Default() Ref { + return Companion_Ref_.Create_Null_() +} + +func (_this Ref) Dtor_deref() interface{} { + return _this.Get_().(Ref_Ptr).Deref +} + +func (_this Ref) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Ref_Ptr: + { + return "LocalCMC.Ref.Ptr" + "(" + _dafny.String(data.Deref) + ")" + } + case Ref_Null: + { + return "LocalCMC.Ref.Null" + } + default: + { + return "" + } + } +} + +func (_this Ref) Equals(other Ref) bool { + switch data1 := _this.Get_().(type) { + case Ref_Ptr: + { + data2, ok := other.Get_().(Ref_Ptr) + return ok && _dafny.AreEqual(data1.Deref, data2.Deref) + } + case Ref_Null: + { + _, ok := other.Get_().(Ref_Null) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this Ref) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Ref) + return ok && _this.Equals(typed) +} + +func Type_Ref_() _dafny.TypeDescriptor { + return type_Ref_{} +} + +type type_Ref_ struct { +} + +func (_this type_Ref_) Default() interface{} { + return Companion_Ref_.Default() +} + +func (_this type_Ref_) String() string { + return "LocalCMC.Ref" +} +func (_this Ref) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Ref{} + +// End of datatype Ref + +// Definition of class CacheEntry +type CacheEntry struct { + Prev Ref + Next Ref + MessagesUsed int32 + BytesUsed int32 + _identifier _dafny.Sequence + _materials m_AwsCryptographyMaterialProvidersTypes.Materials + _creationTime int64 + _expiryTime int64 +} + +func New_CacheEntry_() *CacheEntry { + _this := CacheEntry{} + + _this.Prev = Companion_Ref_.Default() + _this.Next = Companion_Ref_.Default() + _this.MessagesUsed = int32(0) + _this.BytesUsed = int32(0) + _this._identifier = _dafny.EmptySeq + _this._materials = m_AwsCryptographyMaterialProvidersTypes.Materials{} + _this._creationTime = int64(0) + _this._expiryTime = int64(0) + return &_this +} + +type CompanionStruct_CacheEntry_ struct { +} + +var Companion_CacheEntry_ = CompanionStruct_CacheEntry_{} + +func (_this *CacheEntry) Equals(other *CacheEntry) bool { + return _this == other +} + +func (_this *CacheEntry) EqualsGeneric(x interface{}) bool { + other, ok := x.(*CacheEntry) + return ok && _this.Equals(other) +} + +func (*CacheEntry) String() string { + return "LocalCMC.CacheEntry" +} + +func Type_CacheEntry_() _dafny.TypeDescriptor { + return type_CacheEntry_{} +} + +type type_CacheEntry_ struct { +} + +func (_this type_CacheEntry_) Default() interface{} { + return (*CacheEntry)(nil) +} + +func (_this type_CacheEntry_) String() string { + return "LocalCMC.CacheEntry" +} +func (_this *CacheEntry) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &CacheEntry{} + +func (_this *CacheEntry) Ctor__(materials_k m_AwsCryptographyMaterialProvidersTypes.Materials, identifier_k _dafny.Sequence, creationTime_k int64, expiryTime_k int64, messagesUsed_k int32, bytesUsed_k int32) { + { + (_this)._materials = materials_k + (_this)._identifier = identifier_k + (_this)._creationTime = creationTime_k + (_this)._expiryTime = expiryTime_k + (_this).MessagesUsed = messagesUsed_k + (_this).BytesUsed = bytesUsed_k + (_this).Prev = Companion_Default___.NULL() + (_this).Next = Companion_Default___.NULL() + } +} +func (_this *CacheEntry) Identifier() _dafny.Sequence { + { + return _this._identifier + } +} +func (_this *CacheEntry) Materials() m_AwsCryptographyMaterialProvidersTypes.Materials { + { + return _this._materials + } +} +func (_this *CacheEntry) CreationTime() int64 { + { + return _this._creationTime + } +} +func (_this *CacheEntry) ExpiryTime() int64 { + { + return _this._expiryTime + } +} + +// End of class CacheEntry + +// Definition of class DoublyLinkedCacheEntryList +type DoublyLinkedCacheEntryList struct { + Head Ref + Tail Ref +} + +func New_DoublyLinkedCacheEntryList_() *DoublyLinkedCacheEntryList { + _this := DoublyLinkedCacheEntryList{} + + _this.Head = Companion_Ref_.Default() + _this.Tail = Companion_Ref_.Default() + return &_this +} + +type CompanionStruct_DoublyLinkedCacheEntryList_ struct { +} + +var Companion_DoublyLinkedCacheEntryList_ = CompanionStruct_DoublyLinkedCacheEntryList_{} + +func (_this *DoublyLinkedCacheEntryList) Equals(other *DoublyLinkedCacheEntryList) bool { + return _this == other +} + +func (_this *DoublyLinkedCacheEntryList) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DoublyLinkedCacheEntryList) + return ok && _this.Equals(other) +} + +func (*DoublyLinkedCacheEntryList) String() string { + return "LocalCMC.DoublyLinkedCacheEntryList" +} + +func Type_DoublyLinkedCacheEntryList_() _dafny.TypeDescriptor { + return type_DoublyLinkedCacheEntryList_{} +} + +type type_DoublyLinkedCacheEntryList_ struct { +} + +func (_this type_DoublyLinkedCacheEntryList_) Default() interface{} { + return (*DoublyLinkedCacheEntryList)(nil) +} + +func (_this type_DoublyLinkedCacheEntryList_) String() string { + return "LocalCMC.DoublyLinkedCacheEntryList" +} +func (_this *DoublyLinkedCacheEntryList) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &DoublyLinkedCacheEntryList{} + +func (_this *DoublyLinkedCacheEntryList) Ctor__() { + { + (_this).Head = Companion_Ref_.Create_Null_() + (_this).Tail = Companion_Ref_.Create_Null_() + } +} +func (_this *DoublyLinkedCacheEntryList) PushCell(toPush *CacheEntry) { + { + var _0_cRef Ref + _ = _0_cRef + _0_cRef = Companion_Ref_.Create_Ptr_(toPush) + if (_this.Head).Is_Ptr() { + var _obj0 *CacheEntry = (_this.Head).Dtor_deref().(*CacheEntry) + _ = _obj0 + _obj0.Prev = _0_cRef + (toPush).Next = _this.Head + (_this).Head = _0_cRef + } else { + (_this).Head = _0_cRef + (_this).Tail = _this.Head + } + } +} +func (_this *DoublyLinkedCacheEntryList) MoveToFront(c *CacheEntry) { + { + if ((_this.Head).Dtor_deref().(*CacheEntry)) != (c) /* dircomp */ { + var _0_toPush Ref + _ = _0_toPush + _0_toPush = Companion_Ref_.Create_Ptr_(c) + (_this).Remove(c) + if (_this.Head).Is_Ptr() { + var _obj0 *CacheEntry = (_this.Head).Dtor_deref().(*CacheEntry) + _ = _obj0 + _obj0.Prev = _0_toPush + var _obj1 *CacheEntry = (_0_toPush).Dtor_deref().(*CacheEntry) + _ = _obj1 + _obj1.Next = _this.Head + (_this).Head = _0_toPush + } else { + (_this).Head = _0_toPush + (_this).Tail = _this.Head + } + } + } +} +func (_this *DoublyLinkedCacheEntryList) Remove(toRemove *CacheEntry) { + { + if (toRemove.Prev).Is_Null() { + (_this).Head = toRemove.Next + } else { + var _obj0 *CacheEntry = (toRemove.Prev).Dtor_deref().(*CacheEntry) + _ = _obj0 + _obj0.Next = toRemove.Next + } + if (toRemove.Next).Is_Null() { + (_this).Tail = toRemove.Prev + } else { + var _obj1 *CacheEntry = (toRemove.Next).Dtor_deref().(*CacheEntry) + _ = _obj1 + _obj1.Prev = toRemove.Prev + } + { + goto L0 + } + L0: + (toRemove).Next = Companion_Default___.NULL() + (toRemove).Prev = Companion_Default___.NULL() + } +} + +// End of class DoublyLinkedCacheEntryList + +// Definition of class LocalCMC +type LocalCMC struct { + Queue *DoublyLinkedCacheEntryList + Cache *m_DafnyLibraries.MutableMap + _entryCapacity _dafny.Int + _entryPruningTailSize _dafny.Int +} + +func New_LocalCMC_() *LocalCMC { + _this := LocalCMC{} + + _this.Queue = (*DoublyLinkedCacheEntryList)(nil) + _this.Cache = (*m_DafnyLibraries.MutableMap)(nil) + _this._entryCapacity = _dafny.Zero + _this._entryPruningTailSize = _dafny.Zero + return &_this +} + +type CompanionStruct_LocalCMC_ struct { +} + +var Companion_LocalCMC_ = CompanionStruct_LocalCMC_{} + +func (_this *LocalCMC) Equals(other *LocalCMC) bool { + return _this == other +} + +func (_this *LocalCMC) EqualsGeneric(x interface{}) bool { + other, ok := x.(*LocalCMC) + return ok && _this.Equals(other) +} + +func (*LocalCMC) String() string { + return "LocalCMC.LocalCMC" +} + +func Type_LocalCMC_() _dafny.TypeDescriptor { + return type_LocalCMC_{} +} + +type type_LocalCMC_ struct { +} + +func (_this type_LocalCMC_) Default() interface{} { + return (*LocalCMC)(nil) +} + +func (_this type_LocalCMC_) String() string { + return "LocalCMC.LocalCMC" +} +func (_this *LocalCMC) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.TraitID_} +} + +var _ m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache = &LocalCMC{} +var _ _dafny.TraitOffspring = &LocalCMC{} + +func (_this *LocalCMC) DeleteCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.DeleteCacheEntry(_this, input) + return _out1 +} +func (_this *LocalCMC) GetCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.GetCacheEntry(_this, input) + return _out1 +} +func (_this *LocalCMC) PutCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.PutCacheEntry(_this, input) + return _out1 +} +func (_this *LocalCMC) UpdateUsageMetadata(input m_AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsCache_.UpdateUsageMetadata(_this, input) + return _out1 +} +func (_this *LocalCMC) Ctor__(entryCapacity_k _dafny.Int, entryPruningTailSize_k _dafny.Int) { + { + (_this)._entryCapacity = entryCapacity_k + (_this)._entryPruningTailSize = entryPruningTailSize_k + var _nw0 *m_DafnyLibraries.MutableMap = m_DafnyLibraries.New_MutableMap_() + _ = _nw0 + (_this).Cache = _nw0 + var _nw1 *DoublyLinkedCacheEntryList = New_DoublyLinkedCacheEntryList_() + _ = _nw1 + _nw1.Ctor__() + (_this).Queue = _nw1 + } +} +func (_this *LocalCMC) GetCacheEntry_k(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_now int64 + _ = _0_now + var _out0 int64 + _ = _out0 + _out0 = m__Time.CurrentRelativeTime() + _0_now = _out0 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).GetCacheEntryWithTime(input, _0_now) + output = _out1 + return output + } +} +func (_this *LocalCMC) GetCacheEntryWithTime(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput, now int64) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + if (_this.Cache).HasKey((input).Dtor_identifier()) { + var _0_entry *CacheEntry + _ = _0_entry + _0_entry = (_this.Cache).Select((input).Dtor_identifier()).(*CacheEntry) + if (now) <= ((_0_entry).ExpiryTime()) { + (_this.Queue).MoveToFront(_0_entry) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_GetCacheEntryOutput_.Create_GetCacheEntryOutput_((_0_entry).Materials(), (_0_entry).CreationTime(), (_0_entry).ExpiryTime(), _0_entry.MessagesUsed, _0_entry.BytesUsed)) + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _1_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).Pruning(now) + _1_valueOrError0 = _out0 + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _2___v0 _dafny.Tuple + _ = _2___v0 + _2___v0 = (_1_valueOrError0).Extract().(_dafny.Tuple) + } else { + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _3_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).DeleteCacheEntry_k(m_AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_((input).Dtor_identifier())) + _3_valueOrError1 = _out1 + if (_3_valueOrError1).IsFailure() { + output = (_3_valueOrError1).PropagateFailure() + return output + } + var _4___v1 _dafny.Tuple + _ = _4___v1 + _4___v1 = (_3_valueOrError1).Extract().(_dafny.Tuple) + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryDoesNotExist_(_dafny.SeqOfString("Entry past TTL"))) + } + } else { + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryDoesNotExist_(_dafny.SeqOfString("Entry does not exist"))) + } + return output + } +} +func (_this *LocalCMC) PutCacheEntry_k(input m_AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + if ((_this).EntryCapacity()).Sign() == 0 { + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + } + if (_this.Cache).HasKey((input).Dtor_identifier()) { + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).DeleteCacheEntry_k(m_AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_((input).Dtor_identifier())) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1___v2 _dafny.Tuple + _ = _1___v2 + _1___v2 = (_0_valueOrError0).Extract().(_dafny.Tuple) + } + if ((_this).EntryCapacity()).Cmp((_this.Cache).Size()) == 0 { + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _2_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).DeleteCacheEntry_k(m_AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_(((_this.Queue.Tail).Dtor_deref().(*CacheEntry)).Identifier())) + _2_valueOrError1 = _out1 + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3___v3 _dafny.Tuple + _ = _3___v3 + _3___v3 = (_2_valueOrError1).Extract().(_dafny.Tuple) + } + var _4_cell *CacheEntry + _ = _4_cell + var _nw0 *CacheEntry = New_CacheEntry_() + _ = _nw0 + _nw0.Ctor__((input).Dtor_materials(), (input).Dtor_identifier(), (input).Dtor_creationTime(), (input).Dtor_expiryTime(), ((input).Dtor_messagesUsed()).UnwrapOr(int32(0)).(int32), ((input).Dtor_bytesUsed()).UnwrapOr(int32(0)).(int32)) + _4_cell = _nw0 + (_this.Queue).PushCell(_4_cell) + (_this.Cache).Put((input).Dtor_identifier(), _4_cell) + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + } +} +func (_this *LocalCMC) DeleteCacheEntry_k(input m_AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + if (_this.Cache).HasKey((input).Dtor_identifier()) { + var _0_cell *CacheEntry + _ = _0_cell + _0_cell = (_this.Cache).Select((input).Dtor_identifier()).(*CacheEntry) + { + (_this.Cache).Remove((input).Dtor_identifier()) + goto L1 + } + L1: + (_this.Queue).Remove(_0_cell) + } + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + } +} +func (_this *LocalCMC) UpdateUsageMetadata_k(input m_AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + if (_this.Cache).HasKey((input).Dtor_identifier()) { + var _0_cell *CacheEntry + _ = _0_cell + _0_cell = (_this.Cache).Select((input).Dtor_identifier()).(*CacheEntry) + if ((_0_cell.MessagesUsed) <= ((Companion_Default___.INT32__MAX__VALUE()) - (int32(1)))) && ((_0_cell.BytesUsed) <= ((Companion_Default___.INT32__MAX__VALUE()) - ((input).Dtor_bytesUsed()))) { + var _rhs0 int32 = (_0_cell.MessagesUsed) + (int32(1)) + _ = _rhs0 + var _rhs1 int32 = (_0_cell.BytesUsed) + ((input).Dtor_bytesUsed()) + _ = _rhs1 + var _lhs0 *CacheEntry = _0_cell + _ = _lhs0 + var _lhs1 *CacheEntry = _0_cell + _ = _lhs1 + _lhs0.MessagesUsed = _rhs0 + _lhs1.BytesUsed = _rhs1 + } else { + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _1_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).DeleteCacheEntry_k(m_AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_((input).Dtor_identifier())) + _1_valueOrError0 = _out0 + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _2___v4 _dafny.Tuple + _ = _2___v4 + _2___v4 = (_1_valueOrError0).Extract().(_dafny.Tuple) + } + } + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + return output + } +} +func (_this *LocalCMC) Pruning(now int64) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + var _hi0 _dafny.Int = (_this).EntryPruningTailSize() + _ = _hi0 + for _0_i := _dafny.Zero; _0_i.Cmp(_hi0) < 0; _0_i = _0_i.Plus(_dafny.One) { + if (_this.Queue.Tail).Is_Ptr() { + if (((_this.Queue.Tail).Dtor_deref().(*CacheEntry)).ExpiryTime()) < (now) { + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = _1_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).DeleteCacheEntry_k(m_AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_(((_this.Queue.Tail).Dtor_deref().(*CacheEntry)).Identifier())) + _1_valueOrError0 = _out0 + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _2___v5 _dafny.Tuple + _ = _2___v5 + _2___v5 = (_1_valueOrError0).Extract().(_dafny.Tuple) + } else { + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + } + } else { + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + } + } + output = m_Wrappers.Companion_Result_.Create_Success_(_dafny.TupleOf()) + return output + return output + } +} +func (_this *LocalCMC) EntryCapacity() _dafny.Int { + { + return _this._entryCapacity + } +} +func (_this *LocalCMC) EntryPruningTailSize() _dafny.Int { + { + return _this._entryPruningTailSize + } +} + +// End of class LocalCMC diff --git a/releases/go/mpl/MaterialProviders/MaterialProviders.go b/releases/go/mpl/MaterialProviders/MaterialProviders.go new file mode 100644 index 000000000..f51cad6dc --- /dev/null +++ b/releases/go/mpl/MaterialProviders/MaterialProviders.go @@ -0,0 +1,630 @@ +// Package MaterialProviders +// Dafny module MaterialProviders compiled into Go + +package MaterialProviders + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersOperations" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DefaultCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultCMM" + m_DefaultClientSupplier "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultClientSupplier" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_RequiredEncryptionContextCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RequiredEncryptionContextCMM" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_Utils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Utils" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ +var _ m_DefaultCMM.Dummy__ +var _ m_DefaultClientSupplier.Dummy__ +var _ m_Utils.Dummy__ +var _ m_RequiredEncryptionContextCMM.Dummy__ +var _ m_AwsCryptographyMaterialProvidersOperations.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "MaterialProviders.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DefaultMaterialProvidersConfig() m_AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig { + return m_AwsCryptographyMaterialProvidersTypes.Companion_MaterialProvidersConfig_.Create_MaterialProvidersConfig_() +} +func (_static *CompanionStruct_Default___) MaterialProviders(config m_AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_maybeCrypto m_Wrappers.Result + _ = _0_maybeCrypto + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) + _0_maybeCrypto = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer138 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg139 interface{}) interface{} { + return coer138(arg139.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient + _ = _3_cryptoPrimitivesX + _3_cryptoPrimitivesX = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _4_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _ = _4_cryptoPrimitives + _4_cryptoPrimitives = _3_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) + var _5_client *MaterialProvidersClient + _ = _5_client + var _nw0 *MaterialProvidersClient = New_MaterialProvidersClient_() + _ = _nw0 + _nw0.Ctor__(m_AwsCryptographyMaterialProvidersOperations.Companion_Config_.Create_Config_(_4_cryptoPrimitives)) + _5_client = _nw0 + res = m_Wrappers.Companion_Result_.Create_Success_(_5_client) + return res + return res +} +func (_static *CompanionStruct_Default___) CreateSuccessOfClient(client m_AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Success_(client) +} +func (_static *CompanionStruct_Default___) CreateFailureOfError(error_ m_AwsCryptographyMaterialProvidersTypes.Error) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Failure_(error_) +} + +// End of class Default__ + +// Definition of class MaterialProvidersClient +type MaterialProvidersClient struct { + _config m_AwsCryptographyMaterialProvidersOperations.Config +} + +func New_MaterialProvidersClient_() *MaterialProvidersClient { + _this := MaterialProvidersClient{} + + _this._config = m_AwsCryptographyMaterialProvidersOperations.Config{} + return &_this +} + +type CompanionStruct_MaterialProvidersClient_ struct { +} + +var Companion_MaterialProvidersClient_ = CompanionStruct_MaterialProvidersClient_{} + +func (_this *MaterialProvidersClient) Equals(other *MaterialProvidersClient) bool { + return _this == other +} + +func (_this *MaterialProvidersClient) EqualsGeneric(x interface{}) bool { + other, ok := x.(*MaterialProvidersClient) + return ok && _this.Equals(other) +} + +func (*MaterialProvidersClient) String() string { + return "MaterialProviders.MaterialProvidersClient" +} + +func Type_MaterialProvidersClient_() _dafny.TypeDescriptor { + return type_MaterialProvidersClient_{} +} + +type type_MaterialProvidersClient_ struct { +} + +func (_this type_MaterialProvidersClient_) Default() interface{} { + return (*MaterialProvidersClient)(nil) +} + +func (_this type_MaterialProvidersClient_) String() string { + return "MaterialProviders.MaterialProvidersClient" +} +func (_this *MaterialProvidersClient) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_AwsCryptographyMaterialProvidersTypes.Companion_IAwsCryptographicMaterialProvidersClient_.TraitID_} +} + +var _ m_AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient = &MaterialProvidersClient{} +var _ _dafny.TraitOffspring = &MaterialProvidersClient{} + +func (_this *MaterialProvidersClient) Ctor__(config m_AwsCryptographyMaterialProvidersOperations.Config) { + { + (_this)._config = config + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsDiscoveryKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsDiscoveryKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsMultiKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsMultiKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsDiscoveryMultiKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsDiscoveryMultiKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsMrkKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsMrkKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsMrkMultiKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsMrkMultiKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsMrkDiscoveryKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsMrkDiscoveryKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsMrkDiscoveryMultiKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsMrkDiscoveryMultiKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsHierarchicalKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsHierarchicalKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsRsaKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsRsaKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateAwsKmsEcdhKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateAwsKmsEcdhKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateMultiKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateMultiKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateRawAesKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateRawAesKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateRawRsaKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateRawRsaKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateRawEcdhKeyring(input m_AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateRawEcdhKeyring((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateDefaultCryptographicMaterialsManager(input m_AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateDefaultCryptographicMaterialsManager((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateRequiredEncryptionContextCMM(input m_AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateRequiredEncryptionContextCMM((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateCryptographicMaterialsCache(input m_AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateCryptographicMaterialsCache((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) CreateDefaultClientSupplier(input m_AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.CreateDefaultClientSupplier((_this).Config(), input) + output = _out0 + return output + } +} +func (_this *MaterialProvidersClient) InitializeEncryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.InitializeEncryptionMaterials((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) InitializeDecryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.InitializeDecryptionMaterials((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) ValidEncryptionMaterialsTransition(input m_AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.ValidEncryptionMaterialsTransition((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) ValidDecryptionMaterialsTransition(input m_AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.ValidDecryptionMaterialsTransition((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) EncryptionMaterialsHasPlaintextDataKey(input m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.EncryptionMaterialsHasPlaintextDataKey((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) DecryptionMaterialsWithPlaintextDataKey(input m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.DecryptionMaterialsWithPlaintextDataKey((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) GetAlgorithmSuiteInfo(input _dafny.Sequence) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.GetAlgorithmSuiteInfo((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) ValidAlgorithmSuiteInfo(input m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.ValidAlgorithmSuiteInfo((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) ValidateCommitmentPolicyOnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.ValidateCommitmentPolicyOnEncrypt((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) ValidateCommitmentPolicyOnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput) m_Wrappers.Result { + { + return m_AwsCryptographyMaterialProvidersOperations.Companion_Default___.ValidateCommitmentPolicyOnDecrypt((_this).Config(), input) + } +} +func (_this *MaterialProvidersClient) Config() m_AwsCryptographyMaterialProvidersOperations.Config { + { + return _this._config + } +} + +// End of class MaterialProvidersClient diff --git a/releases/go/mpl/MaterialWrapping/MaterialWrapping.go b/releases/go/mpl/MaterialWrapping/MaterialWrapping.go new file mode 100644 index 000000000..6f5ebbc03 --- /dev/null +++ b/releases/go/mpl/MaterialWrapping/MaterialWrapping.go @@ -0,0 +1,856 @@ +// Package MaterialWrapping +// Dafny module MaterialWrapping compiled into Go + +package MaterialWrapping + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ + +type Dummy__ struct{} + +// Definition of datatype GenerateAndWrapInput +type GenerateAndWrapInput struct { + Data_GenerateAndWrapInput_ +} + +func (_this GenerateAndWrapInput) Get_() Data_GenerateAndWrapInput_ { + return _this.Data_GenerateAndWrapInput_ +} + +type Data_GenerateAndWrapInput_ interface { + isGenerateAndWrapInput() +} + +type CompanionStruct_GenerateAndWrapInput_ struct { +} + +var Companion_GenerateAndWrapInput_ = CompanionStruct_GenerateAndWrapInput_{} + +type GenerateAndWrapInput_GenerateAndWrapInput struct { + AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + EncryptionContext _dafny.Map +} + +func (GenerateAndWrapInput_GenerateAndWrapInput) isGenerateAndWrapInput() {} + +func (CompanionStruct_GenerateAndWrapInput_) Create_GenerateAndWrapInput_(AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, EncryptionContext _dafny.Map) GenerateAndWrapInput { + return GenerateAndWrapInput{GenerateAndWrapInput_GenerateAndWrapInput{AlgorithmSuite, EncryptionContext}} +} + +func (_this GenerateAndWrapInput) Is_GenerateAndWrapInput() bool { + _, ok := _this.Get_().(GenerateAndWrapInput_GenerateAndWrapInput) + return ok +} + +func (CompanionStruct_GenerateAndWrapInput_) Default() GenerateAndWrapInput { + return Companion_GenerateAndWrapInput_.Create_GenerateAndWrapInput_(m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Default(), _dafny.EmptyMap) +} + +func (_this GenerateAndWrapInput) Dtor_algorithmSuite() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return _this.Get_().(GenerateAndWrapInput_GenerateAndWrapInput).AlgorithmSuite +} + +func (_this GenerateAndWrapInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(GenerateAndWrapInput_GenerateAndWrapInput).EncryptionContext +} + +func (_this GenerateAndWrapInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GenerateAndWrapInput_GenerateAndWrapInput: + { + return "MaterialWrapping.GenerateAndWrapInput.GenerateAndWrapInput" + "(" + _dafny.String(data.AlgorithmSuite) + ", " + _dafny.String(data.EncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this GenerateAndWrapInput) Equals(other GenerateAndWrapInput) bool { + switch data1 := _this.Get_().(type) { + case GenerateAndWrapInput_GenerateAndWrapInput: + { + data2, ok := other.Get_().(GenerateAndWrapInput_GenerateAndWrapInput) + return ok && data1.AlgorithmSuite.Equals(data2.AlgorithmSuite) && data1.EncryptionContext.Equals(data2.EncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this GenerateAndWrapInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GenerateAndWrapInput) + return ok && _this.Equals(typed) +} + +func Type_GenerateAndWrapInput_() _dafny.TypeDescriptor { + return type_GenerateAndWrapInput_{} +} + +type type_GenerateAndWrapInput_ struct { +} + +func (_this type_GenerateAndWrapInput_) Default() interface{} { + return Companion_GenerateAndWrapInput_.Default() +} + +func (_this type_GenerateAndWrapInput_) String() string { + return "MaterialWrapping.GenerateAndWrapInput" +} +func (_this GenerateAndWrapInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GenerateAndWrapInput{} + +// End of datatype GenerateAndWrapInput + +// Definition of datatype GenerateAndWrapOutput +type GenerateAndWrapOutput struct { + Data_GenerateAndWrapOutput_ +} + +func (_this GenerateAndWrapOutput) Get_() Data_GenerateAndWrapOutput_ { + return _this.Data_GenerateAndWrapOutput_ +} + +type Data_GenerateAndWrapOutput_ interface { + isGenerateAndWrapOutput() +} + +type CompanionStruct_GenerateAndWrapOutput_ struct { +} + +var Companion_GenerateAndWrapOutput_ = CompanionStruct_GenerateAndWrapOutput_{} + +type GenerateAndWrapOutput_GenerateAndWrapOutput struct { + PlaintextMaterial _dafny.Sequence + WrappedMaterial _dafny.Sequence + WrapInfo interface{} +} + +func (GenerateAndWrapOutput_GenerateAndWrapOutput) isGenerateAndWrapOutput() {} + +func (CompanionStruct_GenerateAndWrapOutput_) Create_GenerateAndWrapOutput_(PlaintextMaterial _dafny.Sequence, WrappedMaterial _dafny.Sequence, WrapInfo interface{}) GenerateAndWrapOutput { + return GenerateAndWrapOutput{GenerateAndWrapOutput_GenerateAndWrapOutput{PlaintextMaterial, WrappedMaterial, WrapInfo}} +} + +func (_this GenerateAndWrapOutput) Is_GenerateAndWrapOutput() bool { + _, ok := _this.Get_().(GenerateAndWrapOutput_GenerateAndWrapOutput) + return ok +} + +func (CompanionStruct_GenerateAndWrapOutput_) Default(_default_T interface{}) GenerateAndWrapOutput { + return Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _default_T) +} + +func (_this GenerateAndWrapOutput) Dtor_plaintextMaterial() _dafny.Sequence { + return _this.Get_().(GenerateAndWrapOutput_GenerateAndWrapOutput).PlaintextMaterial +} + +func (_this GenerateAndWrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { + return _this.Get_().(GenerateAndWrapOutput_GenerateAndWrapOutput).WrappedMaterial +} + +func (_this GenerateAndWrapOutput) Dtor_wrapInfo() interface{} { + return _this.Get_().(GenerateAndWrapOutput_GenerateAndWrapOutput).WrapInfo +} + +func (_this GenerateAndWrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case GenerateAndWrapOutput_GenerateAndWrapOutput: + { + return "MaterialWrapping.GenerateAndWrapOutput.GenerateAndWrapOutput" + "(" + _dafny.String(data.PlaintextMaterial) + ", " + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.WrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this GenerateAndWrapOutput) Equals(other GenerateAndWrapOutput) bool { + switch data1 := _this.Get_().(type) { + case GenerateAndWrapOutput_GenerateAndWrapOutput: + { + data2, ok := other.Get_().(GenerateAndWrapOutput_GenerateAndWrapOutput) + return ok && data1.PlaintextMaterial.Equals(data2.PlaintextMaterial) && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this GenerateAndWrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(GenerateAndWrapOutput) + return ok && _this.Equals(typed) +} + +func Type_GenerateAndWrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_GenerateAndWrapOutput_{Type_T_} +} + +type type_GenerateAndWrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_GenerateAndWrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_GenerateAndWrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_GenerateAndWrapOutput_) String() string { + return "MaterialWrapping.GenerateAndWrapOutput" +} +func (_this GenerateAndWrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = GenerateAndWrapOutput{} + +// End of datatype GenerateAndWrapOutput + +// Definition of datatype WrapInput +type WrapInput struct { + Data_WrapInput_ +} + +func (_this WrapInput) Get_() Data_WrapInput_ { + return _this.Data_WrapInput_ +} + +type Data_WrapInput_ interface { + isWrapInput() +} + +type CompanionStruct_WrapInput_ struct { +} + +var Companion_WrapInput_ = CompanionStruct_WrapInput_{} + +type WrapInput_WrapInput struct { + PlaintextMaterial _dafny.Sequence + AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + EncryptionContext _dafny.Map +} + +func (WrapInput_WrapInput) isWrapInput() {} + +func (CompanionStruct_WrapInput_) Create_WrapInput_(PlaintextMaterial _dafny.Sequence, AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, EncryptionContext _dafny.Map) WrapInput { + return WrapInput{WrapInput_WrapInput{PlaintextMaterial, AlgorithmSuite, EncryptionContext}} +} + +func (_this WrapInput) Is_WrapInput() bool { + _, ok := _this.Get_().(WrapInput_WrapInput) + return ok +} + +func (CompanionStruct_WrapInput_) Default() WrapInput { + return Companion_WrapInput_.Create_WrapInput_(_dafny.EmptySeq, m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Default(), _dafny.EmptyMap) +} + +func (_this WrapInput) Dtor_plaintextMaterial() _dafny.Sequence { + return _this.Get_().(WrapInput_WrapInput).PlaintextMaterial +} + +func (_this WrapInput) Dtor_algorithmSuite() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return _this.Get_().(WrapInput_WrapInput).AlgorithmSuite +} + +func (_this WrapInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(WrapInput_WrapInput).EncryptionContext +} + +func (_this WrapInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case WrapInput_WrapInput: + { + return "MaterialWrapping.WrapInput.WrapInput" + "(" + _dafny.String(data.PlaintextMaterial) + ", " + _dafny.String(data.AlgorithmSuite) + ", " + _dafny.String(data.EncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this WrapInput) Equals(other WrapInput) bool { + switch data1 := _this.Get_().(type) { + case WrapInput_WrapInput: + { + data2, ok := other.Get_().(WrapInput_WrapInput) + return ok && data1.PlaintextMaterial.Equals(data2.PlaintextMaterial) && data1.AlgorithmSuite.Equals(data2.AlgorithmSuite) && data1.EncryptionContext.Equals(data2.EncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this WrapInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(WrapInput) + return ok && _this.Equals(typed) +} + +func Type_WrapInput_() _dafny.TypeDescriptor { + return type_WrapInput_{} +} + +type type_WrapInput_ struct { +} + +func (_this type_WrapInput_) Default() interface{} { + return Companion_WrapInput_.Default() +} + +func (_this type_WrapInput_) String() string { + return "MaterialWrapping.WrapInput" +} +func (_this WrapInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = WrapInput{} + +// End of datatype WrapInput + +// Definition of datatype WrapOutput +type WrapOutput struct { + Data_WrapOutput_ +} + +func (_this WrapOutput) Get_() Data_WrapOutput_ { + return _this.Data_WrapOutput_ +} + +type Data_WrapOutput_ interface { + isWrapOutput() +} + +type CompanionStruct_WrapOutput_ struct { +} + +var Companion_WrapOutput_ = CompanionStruct_WrapOutput_{} + +type WrapOutput_WrapOutput struct { + WrappedMaterial _dafny.Sequence + WrapInfo interface{} +} + +func (WrapOutput_WrapOutput) isWrapOutput() {} + +func (CompanionStruct_WrapOutput_) Create_WrapOutput_(WrappedMaterial _dafny.Sequence, WrapInfo interface{}) WrapOutput { + return WrapOutput{WrapOutput_WrapOutput{WrappedMaterial, WrapInfo}} +} + +func (_this WrapOutput) Is_WrapOutput() bool { + _, ok := _this.Get_().(WrapOutput_WrapOutput) + return ok +} + +func (CompanionStruct_WrapOutput_) Default(_default_T interface{}) WrapOutput { + return Companion_WrapOutput_.Create_WrapOutput_(_dafny.EmptySeq, _default_T) +} + +func (_this WrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { + return _this.Get_().(WrapOutput_WrapOutput).WrappedMaterial +} + +func (_this WrapOutput) Dtor_wrapInfo() interface{} { + return _this.Get_().(WrapOutput_WrapOutput).WrapInfo +} + +func (_this WrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case WrapOutput_WrapOutput: + { + return "MaterialWrapping.WrapOutput.WrapOutput" + "(" + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.WrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this WrapOutput) Equals(other WrapOutput) bool { + switch data1 := _this.Get_().(type) { + case WrapOutput_WrapOutput: + { + data2, ok := other.Get_().(WrapOutput_WrapOutput) + return ok && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this WrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(WrapOutput) + return ok && _this.Equals(typed) +} + +func Type_WrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_WrapOutput_{Type_T_} +} + +type type_WrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_WrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_WrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_WrapOutput_) String() string { + return "MaterialWrapping.WrapOutput" +} +func (_this WrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = WrapOutput{} + +// End of datatype WrapOutput + +// Definition of datatype UnwrapInput +type UnwrapInput struct { + Data_UnwrapInput_ +} + +func (_this UnwrapInput) Get_() Data_UnwrapInput_ { + return _this.Data_UnwrapInput_ +} + +type Data_UnwrapInput_ interface { + isUnwrapInput() +} + +type CompanionStruct_UnwrapInput_ struct { +} + +var Companion_UnwrapInput_ = CompanionStruct_UnwrapInput_{} + +type UnwrapInput_UnwrapInput struct { + WrappedMaterial _dafny.Sequence + AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + EncryptionContext _dafny.Map +} + +func (UnwrapInput_UnwrapInput) isUnwrapInput() {} + +func (CompanionStruct_UnwrapInput_) Create_UnwrapInput_(WrappedMaterial _dafny.Sequence, AlgorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, EncryptionContext _dafny.Map) UnwrapInput { + return UnwrapInput{UnwrapInput_UnwrapInput{WrappedMaterial, AlgorithmSuite, EncryptionContext}} +} + +func (_this UnwrapInput) Is_UnwrapInput() bool { + _, ok := _this.Get_().(UnwrapInput_UnwrapInput) + return ok +} + +func (CompanionStruct_UnwrapInput_) Default() UnwrapInput { + return Companion_UnwrapInput_.Create_UnwrapInput_(_dafny.EmptySeq, m_AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Default(), _dafny.EmptyMap) +} + +func (_this UnwrapInput) Dtor_wrappedMaterial() _dafny.Sequence { + return _this.Get_().(UnwrapInput_UnwrapInput).WrappedMaterial +} + +func (_this UnwrapInput) Dtor_algorithmSuite() m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return _this.Get_().(UnwrapInput_UnwrapInput).AlgorithmSuite +} + +func (_this UnwrapInput) Dtor_encryptionContext() _dafny.Map { + return _this.Get_().(UnwrapInput_UnwrapInput).EncryptionContext +} + +func (_this UnwrapInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case UnwrapInput_UnwrapInput: + { + return "MaterialWrapping.UnwrapInput.UnwrapInput" + "(" + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.AlgorithmSuite) + ", " + _dafny.String(data.EncryptionContext) + ")" + } + default: + { + return "" + } + } +} + +func (_this UnwrapInput) Equals(other UnwrapInput) bool { + switch data1 := _this.Get_().(type) { + case UnwrapInput_UnwrapInput: + { + data2, ok := other.Get_().(UnwrapInput_UnwrapInput) + return ok && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.AlgorithmSuite.Equals(data2.AlgorithmSuite) && data1.EncryptionContext.Equals(data2.EncryptionContext) + } + default: + { + return false // unexpected + } + } +} + +func (_this UnwrapInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(UnwrapInput) + return ok && _this.Equals(typed) +} + +func Type_UnwrapInput_() _dafny.TypeDescriptor { + return type_UnwrapInput_{} +} + +type type_UnwrapInput_ struct { +} + +func (_this type_UnwrapInput_) Default() interface{} { + return Companion_UnwrapInput_.Default() +} + +func (_this type_UnwrapInput_) String() string { + return "MaterialWrapping.UnwrapInput" +} +func (_this UnwrapInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = UnwrapInput{} + +// End of datatype UnwrapInput + +// Definition of datatype UnwrapOutput +type UnwrapOutput struct { + Data_UnwrapOutput_ +} + +func (_this UnwrapOutput) Get_() Data_UnwrapOutput_ { + return _this.Data_UnwrapOutput_ +} + +type Data_UnwrapOutput_ interface { + isUnwrapOutput() +} + +type CompanionStruct_UnwrapOutput_ struct { +} + +var Companion_UnwrapOutput_ = CompanionStruct_UnwrapOutput_{} + +type UnwrapOutput_UnwrapOutput struct { + UnwrappedMaterial _dafny.Sequence + UnwrapInfo interface{} +} + +func (UnwrapOutput_UnwrapOutput) isUnwrapOutput() {} + +func (CompanionStruct_UnwrapOutput_) Create_UnwrapOutput_(UnwrappedMaterial _dafny.Sequence, UnwrapInfo interface{}) UnwrapOutput { + return UnwrapOutput{UnwrapOutput_UnwrapOutput{UnwrappedMaterial, UnwrapInfo}} +} + +func (_this UnwrapOutput) Is_UnwrapOutput() bool { + _, ok := _this.Get_().(UnwrapOutput_UnwrapOutput) + return ok +} + +func (CompanionStruct_UnwrapOutput_) Default(_default_T interface{}) UnwrapOutput { + return Companion_UnwrapOutput_.Create_UnwrapOutput_(_dafny.EmptySeq, _default_T) +} + +func (_this UnwrapOutput) Dtor_unwrappedMaterial() _dafny.Sequence { + return _this.Get_().(UnwrapOutput_UnwrapOutput).UnwrappedMaterial +} + +func (_this UnwrapOutput) Dtor_unwrapInfo() interface{} { + return _this.Get_().(UnwrapOutput_UnwrapOutput).UnwrapInfo +} + +func (_this UnwrapOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case UnwrapOutput_UnwrapOutput: + { + return "MaterialWrapping.UnwrapOutput.UnwrapOutput" + "(" + _dafny.String(data.UnwrappedMaterial) + ", " + _dafny.String(data.UnwrapInfo) + ")" + } + default: + { + return "" + } + } +} + +func (_this UnwrapOutput) Equals(other UnwrapOutput) bool { + switch data1 := _this.Get_().(type) { + case UnwrapOutput_UnwrapOutput: + { + data2, ok := other.Get_().(UnwrapOutput_UnwrapOutput) + return ok && data1.UnwrappedMaterial.Equals(data2.UnwrappedMaterial) && _dafny.AreEqual(data1.UnwrapInfo, data2.UnwrapInfo) + } + default: + { + return false // unexpected + } + } +} + +func (_this UnwrapOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(UnwrapOutput) + return ok && _this.Equals(typed) +} + +func Type_UnwrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_UnwrapOutput_{Type_T_} +} + +type type_UnwrapOutput_ struct { + Type_T_ _dafny.TypeDescriptor +} + +func (_this type_UnwrapOutput_) Default() interface{} { + Type_T_ := _this.Type_T_ + _ = Type_T_ + return Companion_UnwrapOutput_.Default(Type_T_.Default()) +} + +func (_this type_UnwrapOutput_) String() string { + return "MaterialWrapping.UnwrapOutput" +} +func (_this UnwrapOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = UnwrapOutput{} + +// End of datatype UnwrapOutput + +// Definition of trait GenerateAndWrapMaterial +type GenerateAndWrapMaterial interface { + String() string + Invoke(a interface{}) interface{} +} +type CompanionStruct_GenerateAndWrapMaterial_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_GenerateAndWrapMaterial_ = CompanionStruct_GenerateAndWrapMaterial_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_GenerateAndWrapMaterial_) CastTo_(x interface{}) GenerateAndWrapMaterial { + var t GenerateAndWrapMaterial + t, _ = x.(GenerateAndWrapMaterial) + return t +} + +// End of trait GenerateAndWrapMaterial + +// Definition of trait WrapMaterial +type WrapMaterial interface { + String() string + Invoke(a interface{}) interface{} +} +type CompanionStruct_WrapMaterial_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_WrapMaterial_ = CompanionStruct_WrapMaterial_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_WrapMaterial_) CastTo_(x interface{}) WrapMaterial { + var t WrapMaterial + t, _ = x.(WrapMaterial) + return t +} + +// End of trait WrapMaterial + +// Definition of trait UnwrapMaterial +type UnwrapMaterial interface { + String() string + Invoke(a interface{}) interface{} +} +type CompanionStruct_UnwrapMaterial_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_UnwrapMaterial_ = CompanionStruct_UnwrapMaterial_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_UnwrapMaterial_) CastTo_(x interface{}) UnwrapMaterial { + var t UnwrapMaterial + t, _ = x.(UnwrapMaterial) + return t +} + +// End of trait UnwrapMaterial diff --git a/releases/go/mpl/Materials/Materials.go b/releases/go/mpl/Materials/Materials.go new file mode 100644 index 000000000..d59a4855f --- /dev/null +++ b/releases/go/mpl/Materials/Materials.go @@ -0,0 +1,640 @@ +// Package Materials +// Dafny module Materials compiled into Go + +package Materials + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Materials.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) InitializeEncryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(!((input).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption Context "))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((input).Dtor_requiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _2_key _dafny.Sequence + _2_key = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_2_key) { + return !(_dafny.Companion_Sequence_.Contains((input).Dtor_requiredEncryptionContextKeys(), _2_key)) || (((input).Dtor_encryptionContext()).Contains(_2_key)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Required encryption context keys do not exist in provided encryption context."))) + _ = _1_valueOrError1 + if (_1_valueOrError1).IsFailure() { + return (_1_valueOrError1).PropagateFailure() + } else { + var _3_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = m_AlgorithmSuites.Companion_Default___.GetSuite((input).Dtor_algorithmSuiteId()) + _ = _3_suite + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((((_3_suite).Dtor_signature()).Is_ECDSA()) == ((((input).Dtor_signingKey()).Is_Some()) && (((input).Dtor_verificationKey()).Is_Some())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Missing signature key for signed suite."))) + _ = _4_valueOrError2 + if (_4_valueOrError2).IsFailure() { + return (_4_valueOrError2).PropagateFailure() + } else { + var _5_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((((_3_suite).Dtor_signature()).Is_None()) == ((((input).Dtor_signingKey()).Is_None()) && (((input).Dtor_verificationKey()).Is_None())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Signature key not allowed for non-signed suites."))) + _ = _5_valueOrError3 + if (_5_valueOrError3).IsFailure() { + return (_5_valueOrError3).PropagateFailure() + } else { + var _6_valueOrError4 m_Wrappers.Result = func() m_Wrappers.Result { + var _source0 m_AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm = (_3_suite).Dtor_signature() + _ = _source0 + { + if _source0.Is_ECDSA() { + var _7_curve m_AwsCryptographyMaterialProvidersTypes.ECDSA = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm_ECDSA).ECDSA + _ = _7_curve + var _8_valueOrError5 m_Wrappers.Result = (m_UTF8.Encode(m_Base64.Companion_Default___.Encode(((input).Dtor_verificationKey()).Dtor_value().(_dafny.Sequence)))).MapFailure(func(coer29 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg29 interface{}) interface{} { + return coer29(arg29.(_dafny.Sequence)) + } + }(func(_9_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_9_e) + })) + _ = _8_valueOrError5 + if (_8_valueOrError5).IsFailure() { + return (_8_valueOrError5).PropagateFailure() + } else { + var _10_enc__vk _dafny.Sequence = (_8_valueOrError5).Extract().(_dafny.Sequence) + _ = _10_enc__vk + return m_Wrappers.Companion_Result_.Create_Success_(((input).Dtor_encryptionContext()).Update(Companion_Default___.EC__PUBLIC__KEY__FIELD(), _10_enc__vk)) + } + } + } + { + var _11_None m_AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm = _source0 + _ = _11_None + return m_Wrappers.Companion_Result_.Create_Success_((input).Dtor_encryptionContext()) + } + }() + _ = _6_valueOrError4 + if (_6_valueOrError4).IsFailure() { + return (_6_valueOrError4).PropagateFailure() + } else { + var _12_encryptionContext _dafny.Map = (_6_valueOrError4).Extract().(_dafny.Map) + _ = _12_encryptionContext + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(_3_suite, _12_encryptionContext, _dafny.SeqOf(), (input).Dtor_requiredEncryptionContextKeys(), m_Wrappers.Companion_Option_.Create_None_(), (input).Dtor_signingKey(), (func() m_Wrappers.Option { + if ((_3_suite).Dtor_symmetricSignature()).Is_None() { + return m_Wrappers.Companion_Option_.Create_None_() + } + return m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf()) + })())) + } + } + } + } + } +} +func (_static *CompanionStruct_Default___) InitializeDecryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((input).Dtor_requiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_key _dafny.Sequence + _1_key = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_1_key) { + return !(_dafny.Companion_Sequence_.Contains((input).Dtor_requiredEncryptionContextKeys(), _1_key)) || (((input).Dtor_encryptionContext()).Contains(_1_key)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Reporoduced encryption context key did not exist in provided encryption context."))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _2_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = m_AlgorithmSuites.Companion_Default___.GetSuite((input).Dtor_algorithmSuiteId()) + _ = _2_suite + var _3_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((((_2_suite).Dtor_signature()).Is_ECDSA()) == (((input).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption Context missing verification key."))) + _ = _3_valueOrError1 + if (_3_valueOrError1).IsFailure() { + return (_3_valueOrError1).PropagateFailure() + } else { + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((((_2_suite).Dtor_signature()).Is_None()) == (!((input).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Verification key can not exist in non-signed Algorithm Suites."))) + _ = _4_valueOrError2 + if (_4_valueOrError2).IsFailure() { + return (_4_valueOrError2).PropagateFailure() + } else { + var _5_valueOrError3 m_Wrappers.Result = Companion_Default___.DecodeVerificationKey((input).Dtor_encryptionContext()) + _ = _5_valueOrError3 + if (_5_valueOrError3).IsFailure() { + return (_5_valueOrError3).PropagateFailure() + } else { + var _6_verificationKey m_Wrappers.Option = (_5_valueOrError3).Extract().(m_Wrappers.Option) + _ = _6_verificationKey + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(_2_suite, (input).Dtor_encryptionContext(), (input).Dtor_requiredEncryptionContextKeys(), m_Wrappers.Companion_Option_.Create_None_(), _6_verificationKey, m_Wrappers.Companion_Option_.Create_None_())) + } + } + } + } +} +func (_static *CompanionStruct_Default___) DecodeVerificationKey(encryptionContext _dafny.Map) m_Wrappers.Result { + if (encryptionContext).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD()) { + var _0_utf8Key _dafny.Sequence = (encryptionContext).Get(Companion_Default___.EC__PUBLIC__KEY__FIELD()).(_dafny.Sequence) + _ = _0_utf8Key + var _1_valueOrError0 m_Wrappers.Result = (m_UTF8.Decode(_0_utf8Key)).MapFailure(func(coer30 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg30 interface{}) interface{} { + return coer30(arg30.(_dafny.Sequence)) + } + }(func(_2_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_2_e) + })) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _3_base64Key _dafny.Sequence = (_1_valueOrError0).Extract().(_dafny.Sequence) + _ = _3_base64Key + var _4_valueOrError1 m_Wrappers.Result = (m_Base64.Companion_Default___.Decode(_3_base64Key)).MapFailure(func(coer31 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg31 interface{}) interface{} { + return coer31(arg31.(_dafny.Sequence)) + } + }(func(_5_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_5_e) + })) + _ = _4_valueOrError1 + if (_4_valueOrError1).IsFailure() { + return (_4_valueOrError1).PropagateFailure() + } else { + var _6_key _dafny.Sequence = (_4_valueOrError1).Extract().(_dafny.Sequence) + _ = _6_key + return m_Wrappers.Companion_Result_.Create_Success_(m_Wrappers.Companion_Option_.Create_Some_(_6_key)) + } + } + } else { + return m_Wrappers.Companion_Result_.Create_Success_(m_Wrappers.Companion_Option_.Create_None_()) + } +} +func (_static *CompanionStruct_Default___) ValidEncryptionMaterialsTransition(oldMat m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials, newMat m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) bool { + return ((((((((((((newMat).Dtor_algorithmSuite()).Equals((oldMat).Dtor_algorithmSuite())) && (((newMat).Dtor_encryptionContext()).Equals((oldMat).Dtor_encryptionContext()))) && (_dafny.Companion_Sequence_.Equal((newMat).Dtor_requiredEncryptionContextKeys(), (oldMat).Dtor_requiredEncryptionContextKeys()))) && (((newMat).Dtor_signingKey()).Equals((oldMat).Dtor_signingKey()))) && (((((oldMat).Dtor_plaintextDataKey()).Is_None()) && (((newMat).Dtor_plaintextDataKey()).Is_Some())) || (((oldMat).Dtor_plaintextDataKey()).Equals((newMat).Dtor_plaintextDataKey())))) && (((newMat).Dtor_plaintextDataKey()).Is_Some())) && ((_dafny.IntOfUint32(((oldMat).Dtor_encryptedDataKeys()).Cardinality())).Cmp(_dafny.IntOfUint32(((newMat).Dtor_encryptedDataKeys()).Cardinality())) <= 0)) && ((_dafny.MultiSetFromSeq((oldMat).Dtor_encryptedDataKeys())).IsSubsetOf(_dafny.MultiSetFromSeq((newMat).Dtor_encryptedDataKeys())))) && (!(!((((oldMat).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None())) || (((((newMat).Dtor_symmetricSigningKeys()).Is_Some()) && (((oldMat).Dtor_symmetricSigningKeys()).Is_Some())) && ((_dafny.MultiSetFromSeq(((oldMat).Dtor_symmetricSigningKeys()).Dtor_value().(_dafny.Sequence))).IsSubsetOf(_dafny.MultiSetFromSeq(((newMat).Dtor_symmetricSigningKeys()).Dtor_value().(_dafny.Sequence))))))) && (Companion_Default___.ValidEncryptionMaterials(oldMat))) && (Companion_Default___.ValidEncryptionMaterials(newMat)) +} +func (_static *CompanionStruct_Default___) ValidEncryptionMaterials(encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) bool { + var _pat_let_tv0 = encryptionMaterials + _ = _pat_let_tv0 + var _pat_let_tv1 = encryptionMaterials + _ = _pat_let_tv1 + var _pat_let_tv2 = encryptionMaterials + _ = _pat_let_tv2 + var _pat_let_tv3 = encryptionMaterials + _ = _pat_let_tv3 + var _pat_let_tv4 = encryptionMaterials + _ = _pat_let_tv4 + var _pat_let_tv5 = encryptionMaterials + _ = _pat_let_tv5 + var _pat_let_tv6 = encryptionMaterials + _ = _pat_let_tv6 + var _pat_let_tv7 = encryptionMaterials + _ = _pat_let_tv7 + var _pat_let_tv8 = encryptionMaterials + _ = _pat_let_tv8 + var _pat_let_tv9 = encryptionMaterials + _ = _pat_let_tv9 + var _pat_let_tv10 = encryptionMaterials + _ = _pat_let_tv10 + var _pat_let_tv11 = encryptionMaterials + _ = _pat_let_tv11 + var _pat_let_tv12 = encryptionMaterials + _ = _pat_let_tv12 + var _pat_let_tv13 = encryptionMaterials + _ = _pat_let_tv13 + var _pat_let_tv14 = encryptionMaterials + _ = _pat_let_tv14 + var _pat_let_tv15 = encryptionMaterials + _ = _pat_let_tv15 + return (m_AlgorithmSuites.Companion_Default___.AlgorithmSuite_q((encryptionMaterials).Dtor_algorithmSuite())) && (func(_pat_let2_0 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return func(_0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return ((((((((((((_0_suite).Dtor_signature()).Is_None()) == (((_pat_let_tv0).Dtor_signingKey()).Is_None())) && (!(((_pat_let_tv1).Dtor_plaintextDataKey()).Is_Some()) || ((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))).Cmp(_dafny.IntOfUint32((((_pat_let_tv2).Dtor_plaintextDataKey()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0))) && (!(((_pat_let_tv3).Dtor_plaintextDataKey()).Is_None()) || ((_dafny.IntOfUint32(((_pat_let_tv4).Dtor_encryptedDataKeys()).Cardinality())).Sign() == 0))) && ((!(((_0_suite).Dtor_signature()).Is_None())) == (((_pat_let_tv5).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())))) && ((((_0_suite).Dtor_signature()).Is_ECDSA()) == (((_pat_let_tv6).Dtor_signingKey()).Is_Some()))) && ((!(((_0_suite).Dtor_signature()).Is_None())) == (((_pat_let_tv7).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())))) && (!((((_0_suite).Dtor_symmetricSignature()).Is_HMAC()) && (((_pat_let_tv8).Dtor_symmetricSigningKeys()).Is_Some())) || ((_dafny.IntOfUint32((((_pat_let_tv9).Dtor_symmetricSigningKeys()).Dtor_value().(_dafny.Sequence)).Cardinality())).Cmp(_dafny.IntOfUint32(((_pat_let_tv10).Dtor_encryptedDataKeys()).Cardinality())) == 0))) && (!(((_0_suite).Dtor_symmetricSignature()).Is_HMAC()) || (((_pat_let_tv11).Dtor_symmetricSigningKeys()).Is_Some()))) && (!(((_0_suite).Dtor_symmetricSignature()).Is_None()) || (((_pat_let_tv12).Dtor_symmetricSigningKeys()).Is_None()))) && (_dafny.Quantifier(((_pat_let_tv13).Dtor_requiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_key _dafny.Sequence + _1_key = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_1_key) { + return !(_dafny.Companion_Sequence_.Contains((_pat_let_tv14).Dtor_requiredEncryptionContextKeys(), _1_key)) || (((_pat_let_tv15).Dtor_encryptionContext()).Contains(_1_key)) + } else { + return true + } + })) + }(_pat_let2_0) + }((encryptionMaterials).Dtor_algorithmSuite())) +} +func (_static *CompanionStruct_Default___) EncryptionMaterialsHasPlaintextDataKey(encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) bool { + return ((((encryptionMaterials).Dtor_plaintextDataKey()).Is_Some()) && ((_dafny.IntOfUint32(((encryptionMaterials).Dtor_encryptedDataKeys()).Cardinality())).Sign() == 1)) && (Companion_Default___.ValidEncryptionMaterials(encryptionMaterials)) +} +func (_static *CompanionStruct_Default___) EncryptionMaterialAddEncryptedDataKeys(encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials, encryptedDataKeysToAdd _dafny.Sequence, symmetricSigningKeysToAdd m_Wrappers.Option) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidEncryptionMaterials(encryptionMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Attempt to modify invalid encryption material."))) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((encryptionMaterials).Dtor_plaintextDataKey()).Is_Some(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Adding encrypted data keys without a plaintext data key is not allowed."))) + _ = _1_valueOrError1 + if (_1_valueOrError1).IsFailure() { + return (_1_valueOrError1).PropagateFailure() + } else { + var _2_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(!((symmetricSigningKeysToAdd).Is_None()) || ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Adding encrypted data keys without a symmetric signing key when using symmetric signing is not allowed."))) + _ = _2_valueOrError2 + if (_2_valueOrError2).IsFailure() { + return (_2_valueOrError2).PropagateFailure() + } else { + var _3_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(!((symmetricSigningKeysToAdd).Is_Some()) || (!((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Adding encrypted data keys with a symmetric signing key when not using symmetric signing is not allowed."))) + _ = _3_valueOrError3 + if (_3_valueOrError3).IsFailure() { + return (_3_valueOrError3).PropagateFailure() + } else { + var _4_symmetricSigningKeys m_Wrappers.Option = (func() m_Wrappers.Option { + if (symmetricSigningKeysToAdd).Is_None() { + return (encryptionMaterials).Dtor_symmetricSigningKeys() + } + return m_Wrappers.Companion_Option_.Create_Some_(_dafny.Companion_Sequence_.Concatenate(((encryptionMaterials).Dtor_symmetricSigningKeys()).Dtor_value().(_dafny.Sequence), (symmetricSigningKeysToAdd).Dtor_value().(_dafny.Sequence))) + })() + _ = _4_symmetricSigningKeys + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_((encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext(), _dafny.Companion_Sequence_.Concatenate((encryptionMaterials).Dtor_encryptedDataKeys(), encryptedDataKeysToAdd), (encryptionMaterials).Dtor_requiredEncryptionContextKeys(), (encryptionMaterials).Dtor_plaintextDataKey(), (encryptionMaterials).Dtor_signingKey(), _4_symmetricSigningKeys)) + } + } + } + } +} +func (_static *CompanionStruct_Default___) EncryptionMaterialAddDataKey(encryptionMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials, plaintextDataKey _dafny.Sequence, encryptedDataKeysToAdd _dafny.Sequence, symmetricSigningKeysToAdd m_Wrappers.Option) m_Wrappers.Result { + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = (encryptionMaterials).Dtor_algorithmSuite() + _ = _0_suite + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidEncryptionMaterials(encryptionMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Attempt to modify invalid encryption material."))) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((encryptionMaterials).Dtor_plaintextDataKey()).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Attempt to modify plaintextDataKey."))) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))).Cmp(_dafny.IntOfUint32((plaintextDataKey).Cardinality())) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("plaintextDataKey does not match Algorithm Suite specification."))) + _ = _3_valueOrError2 + if (_3_valueOrError2).IsFailure() { + return (_3_valueOrError2).PropagateFailure() + } else { + var _4_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((symmetricSigningKeysToAdd).Is_None()) == ((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Adding encrypted data keys without a symmetric signing key when using symmetric signing is not allowed."))) + _ = _4_valueOrError3 + if (_4_valueOrError3).IsFailure() { + return (_4_valueOrError3).PropagateFailure() + } else { + var _5_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((symmetricSigningKeysToAdd).Is_Some()) == (!((((encryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(_dafny.SeqOfString("Adding encrypted data keys with a symmetric signing key when not using symmetric signing is not allowed."))) + _ = _5_valueOrError4 + if (_5_valueOrError4).IsFailure() { + return (_5_valueOrError4).PropagateFailure() + } else { + var _6_symmetricSigningKeys m_Wrappers.Option = (func() m_Wrappers.Option { + if (symmetricSigningKeysToAdd).Is_None() { + return (encryptionMaterials).Dtor_symmetricSigningKeys() + } + return m_Wrappers.Companion_Option_.Create_Some_(_dafny.Companion_Sequence_.Concatenate(((encryptionMaterials).Dtor_symmetricSigningKeys()).Dtor_value().(_dafny.Sequence), (symmetricSigningKeysToAdd).Dtor_value().(_dafny.Sequence))) + })() + _ = _6_symmetricSigningKeys + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_((encryptionMaterials).Dtor_algorithmSuite(), (encryptionMaterials).Dtor_encryptionContext(), _dafny.Companion_Sequence_.Concatenate((encryptionMaterials).Dtor_encryptedDataKeys(), encryptedDataKeysToAdd), (encryptionMaterials).Dtor_requiredEncryptionContextKeys(), m_Wrappers.Companion_Option_.Create_Some_(plaintextDataKey), (encryptionMaterials).Dtor_signingKey(), _6_symmetricSigningKeys)) + } + } + } + } + } +} +func (_static *CompanionStruct_Default___) DecryptionMaterialsTransitionIsValid(oldMat m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, newMat m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + return ((((((((((newMat).Dtor_algorithmSuite()).Equals((oldMat).Dtor_algorithmSuite())) && (((newMat).Dtor_encryptionContext()).Equals((oldMat).Dtor_encryptionContext()))) && (_dafny.Companion_Sequence_.Equal((newMat).Dtor_requiredEncryptionContextKeys(), (oldMat).Dtor_requiredEncryptionContextKeys()))) && (((newMat).Dtor_verificationKey()).Equals((oldMat).Dtor_verificationKey()))) && (((oldMat).Dtor_plaintextDataKey()).Is_None())) && (((newMat).Dtor_plaintextDataKey()).Is_Some())) && (((oldMat).Dtor_symmetricSigningKey()).Is_None())) && (Companion_Default___.ValidDecryptionMaterials(oldMat))) && (Companion_Default___.ValidDecryptionMaterials(newMat)) +} +func (_static *CompanionStruct_Default___) ValidDecryptionMaterials(decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + var _pat_let_tv0 = decryptionMaterials + _ = _pat_let_tv0 + var _pat_let_tv1 = decryptionMaterials + _ = _pat_let_tv1 + var _pat_let_tv2 = decryptionMaterials + _ = _pat_let_tv2 + var _pat_let_tv3 = decryptionMaterials + _ = _pat_let_tv3 + var _pat_let_tv4 = decryptionMaterials + _ = _pat_let_tv4 + var _pat_let_tv5 = decryptionMaterials + _ = _pat_let_tv5 + var _pat_let_tv6 = decryptionMaterials + _ = _pat_let_tv6 + var _pat_let_tv7 = decryptionMaterials + _ = _pat_let_tv7 + var _pat_let_tv8 = decryptionMaterials + _ = _pat_let_tv8 + var _pat_let_tv9 = decryptionMaterials + _ = _pat_let_tv9 + var _pat_let_tv10 = decryptionMaterials + _ = _pat_let_tv10 + return (m_AlgorithmSuites.Companion_Default___.AlgorithmSuite_q((decryptionMaterials).Dtor_algorithmSuite())) && (func(_pat_let3_0 m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return func(_0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) bool { + return ((((((!(((_pat_let_tv0).Dtor_plaintextDataKey()).Is_Some()) || ((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))).Cmp(_dafny.IntOfUint32((((_pat_let_tv1).Dtor_plaintextDataKey()).Dtor_value().(_dafny.Sequence)).Cardinality())) == 0)) && ((!(((_0_suite).Dtor_signature()).Is_None())) == (((_pat_let_tv2).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())))) && ((((_0_suite).Dtor_signature()).Is_ECDSA()) == (((_pat_let_tv3).Dtor_verificationKey()).Is_Some()))) && ((!(((_0_suite).Dtor_signature()).Is_None())) == (((_pat_let_tv4).Dtor_encryptionContext()).Contains(Companion_Default___.EC__PUBLIC__KEY__FIELD())))) && (!(!(((_0_suite).Dtor_symmetricSignature()).Is_None())) || ((((_pat_let_tv5).Dtor_plaintextDataKey()).Is_Some()) == (((_pat_let_tv6).Dtor_symmetricSigningKey()).Is_Some())))) && (!(((_0_suite).Dtor_symmetricSignature()).Is_None()) || (((_pat_let_tv7).Dtor_symmetricSigningKey()).Is_None()))) && (_dafny.Quantifier(((_pat_let_tv8).Dtor_requiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_k _dafny.Sequence + _1_k = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_1_k) { + return !(_dafny.Companion_Sequence_.Contains((_pat_let_tv9).Dtor_requiredEncryptionContextKeys(), _1_k)) || (((_pat_let_tv10).Dtor_encryptionContext()).Contains(_1_k)) + } else { + return true + } + })) + }(_pat_let3_0) + }((decryptionMaterials).Dtor_algorithmSuite())) +} +func (_static *CompanionStruct_Default___) DecryptionMaterialsAddDataKey(decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, plaintextDataKey _dafny.Sequence, symmetricSigningKey m_Wrappers.Option) m_Wrappers.Result { + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = (decryptionMaterials).Dtor_algorithmSuite() + _ = _0_suite + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(Companion_Default___.ValidDecryptionMaterials(decryptionMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("Attempt to modify invalid decryption material."))) + _ = _1_valueOrError0 + if (_1_valueOrError0).IsFailure() { + return (_1_valueOrError0).PropagateFailure() + } else { + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((decryptionMaterials).Dtor_plaintextDataKey()).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("Attempt to modify plaintextDataKey."))) + _ = _2_valueOrError1 + if (_2_valueOrError1).IsFailure() { + return (_2_valueOrError1).PropagateFailure() + } else { + var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))).Cmp(_dafny.IntOfUint32((plaintextDataKey).Cardinality())) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("plaintextDataKey does not match Algorithm Suite specification."))) + _ = _3_valueOrError2 + if (_3_valueOrError2).IsFailure() { + return (_3_valueOrError2).PropagateFailure() + } else { + var _4_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((symmetricSigningKey).Is_Some()) == (!((((decryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None())), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("symmetric signature key must be added with plaintextDataKey if using an algorithm suite with symmetric signing."))) + _ = _4_valueOrError3 + if (_4_valueOrError3).IsFailure() { + return (_4_valueOrError3).PropagateFailure() + } else { + var _5_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(((symmetricSigningKey).Is_None()) == ((((decryptionMaterials).Dtor_algorithmSuite()).Dtor_symmetricSignature()).Is_None()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(_dafny.SeqOfString("symmetric signature key cannot be added with plaintextDataKey if using an algorithm suite without symmetric signing."))) + _ = _5_valueOrError4 + if (_5_valueOrError4).IsFailure() { + return (_5_valueOrError4).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_((decryptionMaterials).Dtor_algorithmSuite(), (decryptionMaterials).Dtor_encryptionContext(), (decryptionMaterials).Dtor_requiredEncryptionContextKeys(), m_Wrappers.Companion_Option_.Create_Some_(plaintextDataKey), (decryptionMaterials).Dtor_verificationKey(), symmetricSigningKey)) + } + } + } + } + } +} +func (_static *CompanionStruct_Default___) DecryptionMaterialsWithoutPlaintextDataKey(decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + return (((decryptionMaterials).Dtor_plaintextDataKey()).Is_None()) && (Companion_Default___.ValidDecryptionMaterials(decryptionMaterials)) +} +func (_static *CompanionStruct_Default___) DecryptionMaterialsWithPlaintextDataKey(decryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + return (((decryptionMaterials).Dtor_plaintextDataKey()).Is_Some()) && (Companion_Default___.ValidDecryptionMaterials(decryptionMaterials)) +} +func (_static *CompanionStruct_Default___) EC__PUBLIC__KEY__FIELD() _dafny.Sequence { + var _0_s _dafny.Sequence = _dafny.SeqOf(uint8(97), uint8(119), uint8(115), uint8(45), uint8(99), uint8(114), uint8(121), uint8(112), uint8(116), uint8(111), uint8(45), uint8(112), uint8(117), uint8(98), uint8(108), uint8(105), uint8(99), uint8(45), uint8(107), uint8(101), uint8(121)) + _ = _0_s + return _0_s +} +func (_static *CompanionStruct_Default___) RESERVED__KEY__VALUES() _dafny.Set { + return _dafny.SetOf(Companion_Default___.EC__PUBLIC__KEY__FIELD()) +} + +// End of class Default__ + +// Definition of class DecryptionMaterialsPendingPlaintextDataKey +type DecryptionMaterialsPendingPlaintextDataKey struct { +} + +func New_DecryptionMaterialsPendingPlaintextDataKey_() *DecryptionMaterialsPendingPlaintextDataKey { + _this := DecryptionMaterialsPendingPlaintextDataKey{} + + return &_this +} + +type CompanionStruct_DecryptionMaterialsPendingPlaintextDataKey_ struct { +} + +var Companion_DecryptionMaterialsPendingPlaintextDataKey_ = CompanionStruct_DecryptionMaterialsPendingPlaintextDataKey_{} + +func (*DecryptionMaterialsPendingPlaintextDataKey) String() string { + return "Materials.DecryptionMaterialsPendingPlaintextDataKey" +} + +// End of class DecryptionMaterialsPendingPlaintextDataKey + +func Type_DecryptionMaterialsPendingPlaintextDataKey_() _dafny.TypeDescriptor { + return type_DecryptionMaterialsPendingPlaintextDataKey_{} +} + +type type_DecryptionMaterialsPendingPlaintextDataKey_ struct { +} + +func (_this type_DecryptionMaterialsPendingPlaintextDataKey_) Default() interface{} { + return m_AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Default() +} + +func (_this type_DecryptionMaterialsPendingPlaintextDataKey_) String() string { + return "Materials.DecryptionMaterialsPendingPlaintextDataKey" +} +func (_this *CompanionStruct_DecryptionMaterialsPendingPlaintextDataKey_) Is_(__source m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + var _0_d m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = (__source) + _ = _0_d + return Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_d) +} + +// Definition of class SealedDecryptionMaterials +type SealedDecryptionMaterials struct { +} + +func New_SealedDecryptionMaterials_() *SealedDecryptionMaterials { + _this := SealedDecryptionMaterials{} + + return &_this +} + +type CompanionStruct_SealedDecryptionMaterials_ struct { +} + +var Companion_SealedDecryptionMaterials_ = CompanionStruct_SealedDecryptionMaterials_{} + +func (*SealedDecryptionMaterials) String() string { + return "Materials.SealedDecryptionMaterials" +} + +// End of class SealedDecryptionMaterials + +func Type_SealedDecryptionMaterials_() _dafny.TypeDescriptor { + return type_SealedDecryptionMaterials_{} +} + +type type_SealedDecryptionMaterials_ struct { +} + +func (_this type_SealedDecryptionMaterials_) Default() interface{} { + return m_AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Default() +} + +func (_this type_SealedDecryptionMaterials_) String() string { + return "Materials.SealedDecryptionMaterials" +} +func (_this *CompanionStruct_SealedDecryptionMaterials_) Is_(__source m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) bool { + var _1_d m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = (__source) + _ = _1_d + return Companion_Default___.DecryptionMaterialsWithPlaintextDataKey(_1_d) +} diff --git a/releases/go/mpl/MrkAwareDiscoveryMultiKeyring/MrkAwareDiscoveryMultiKeyring.go b/releases/go/mpl/MrkAwareDiscoveryMultiKeyring/MrkAwareDiscoveryMultiKeyring.go new file mode 100644 index 000000000..56f086c8a --- /dev/null +++ b/releases/go/mpl/MrkAwareDiscoveryMultiKeyring/MrkAwareDiscoveryMultiKeyring.go @@ -0,0 +1,271 @@ +// Package MrkAwareDiscoveryMultiKeyring +// Dafny module MrkAwareDiscoveryMultiKeyring compiled into Go + +package MrkAwareDiscoveryMultiKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "MrkAwareDiscoveryMultiKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) MrkAwareDiscoveryMultiKeyring(regions _dafny.Sequence, discoveryFilter m_Wrappers.Option, clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier, grantTokens m_Wrappers.Option) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((regions).Cardinality())).Sign() == 1, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("No regions passed."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need((m_Seq.Companion_Default___.IndexOfOption(regions, _dafny.SeqOfString(""))).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Empty string is not a valid region."))) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_children _dafny.Sequence + _ = _2_children + _2_children = _dafny.SeqOf() + var _hi0 _dafny.Int = _dafny.IntOfUint32((regions).Cardinality()) + _ = _hi0 + for _3_i := _dafny.Zero; _3_i.Cmp(_hi0) < 0; _3_i = _3_i.Plus(_dafny.One) { + var _4_region _dafny.Sequence + _ = _4_region + _4_region = (regions).Select((_3_i).Uint32()).(_dafny.Sequence) + var _5_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _5_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_(_4_region)) + _5_valueOrError2 = _out0 + if (_5_valueOrError2).IsFailure() { + output = (_5_valueOrError2).PropagateFailure() + return output + } + var _6_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _6_client + _6_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_5_valueOrError2).Extract()) + var _7_keyring *m_AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring + _ = _7_keyring + var _nw0 *m_AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring = m_AwsKmsMrkDiscoveryKeyring.New_AwsKmsMrkDiscoveryKeyring_() + _ = _nw0 + _nw0.Ctor__(_6_client, _4_region, discoveryFilter, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _7_keyring = _nw0 + _2_children = _dafny.Companion_Sequence_.Concatenate(_2_children, _dafny.SeqOf(_7_keyring)) + } + var _8_keyring *m_MultiKeyring.MultiKeyring + _ = _8_keyring + var _nw1 *m_MultiKeyring.MultiKeyring = m_MultiKeyring.New_MultiKeyring_() + _ = _nw1 + _nw1.Ctor__(m_Wrappers.Companion_Option_.Create_None_(), _2_children) + _8_keyring = _nw1 + output = m_Wrappers.Companion_Result_.Create_Success_(_8_keyring) + return output + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/MrkAwareStrictMultiKeyring/MrkAwareStrictMultiKeyring.go b/releases/go/mpl/MrkAwareStrictMultiKeyring/MrkAwareStrictMultiKeyring.go new file mode 100644 index 000000000..30708f087 --- /dev/null +++ b/releases/go/mpl/MrkAwareStrictMultiKeyring/MrkAwareStrictMultiKeyring.go @@ -0,0 +1,400 @@ +// Package MrkAwareStrictMultiKeyring +// Dafny module MrkAwareStrictMultiKeyring compiled into Go + +package MrkAwareStrictMultiKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "MrkAwareStrictMultiKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) MrkAwareStrictMultiKeyring(generator m_Wrappers.Option, awsKmsKeys m_Wrappers.Option, clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier, grantTokens m_Wrappers.Option) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_allStrings _dafny.Sequence + _ = _0_allStrings + var _source0 m_Wrappers.Option = generator + _ = _source0 + { + { + if _source0.Is_Some() { + var _1_g _dafny.Sequence = _source0.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _1_g + _0_allStrings = _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOf(_1_g), (awsKmsKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + goto Lmatch0 + } + } + { + _0_allStrings = (awsKmsKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence) + } + goto Lmatch0 + } +Lmatch0: + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (m_Seq.Companion_Default___.MapWithResult(func(coer71 func(_dafny.Sequence) m_Wrappers.Result) func(interface{}) m_Wrappers.Result { + return func(arg72 interface{}) m_Wrappers.Result { + return coer71(arg72.(_dafny.Sequence)) + } + }(m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString), _0_allStrings)).MapFailure(func(coer72 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg73 interface{}) interface{} { + return coer72(arg73.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_2_valueOrError0).IsFailure() { + output = (_2_valueOrError0).PropagateFailure() + return output + } + var _3_allIdentifiers _dafny.Sequence + _ = _3_allIdentifiers + _3_allIdentifiers = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError1 + _4_valueOrError1 = m_AwsKmsMrkAreUnique.Companion_Default___.AwsKmsMrkAreUnique(_3_allIdentifiers) + if (_4_valueOrError1).IsFailure() { + output = (_4_valueOrError1).PropagateFailure() + return output + } + var _5_generatorKeyring m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _5_generatorKeyring + var _source1 m_Wrappers.Option = generator + _ = _source1 + { + { + if _source1.Is_Some() { + var _6_generatorIdentifier _dafny.Sequence = _source1.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _6_generatorIdentifier + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _7_valueOrError2 + _7_valueOrError2 = (m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString(_6_generatorIdentifier)).MapFailure(func(coer73 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg74 interface{}) interface{} { + return coer73(arg74.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_7_valueOrError2).IsFailure() { + output = (_7_valueOrError2).PropagateFailure() + return output + } + var _8_arn m_AwsArnParsing.AwsKmsIdentifier + _ = _8_arn + _8_arn = (_7_valueOrError2).Extract().(m_AwsArnParsing.AwsKmsIdentifier) + var _9_region m_Wrappers.Option + _ = _9_region + _9_region = m_AwsArnParsing.Companion_Default___.GetRegion(_8_arn) + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError3 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_((_9_region).UnwrapOr(_dafny.SeqOfString("")).(_dafny.Sequence))) + _10_valueOrError3 = _out0 + if (_10_valueOrError3).IsFailure() { + output = (_10_valueOrError3).PropagateFailure() + return output + } + var _11_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _11_client + _11_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_10_valueOrError3).Extract()) + var _12_g *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring + _ = _12_g + var _nw0 *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring = m_AwsKmsMrkKeyring.New_AwsKmsMrkKeyring_() + _ = _nw0 + _nw0.Ctor__(_11_client, _6_generatorIdentifier, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _12_g = _nw0 + _5_generatorKeyring = m_Wrappers.Companion_Option_.Create_Some_(_12_g) + goto Lmatch1 + } + } + { + _5_generatorKeyring = m_Wrappers.Companion_Option_.Create_None_() + } + goto Lmatch1 + } +Lmatch1: + var _13_children _dafny.Sequence + _ = _13_children + _13_children = _dafny.SeqOf() + var _source2 m_Wrappers.Option = awsKmsKeys + _ = _source2 + { + { + if _source2.Is_Some() { + var _14_childIdentifiers _dafny.Sequence = _source2.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _14_childIdentifiers + var _hi0 _dafny.Int = _dafny.IntOfUint32((_14_childIdentifiers).Cardinality()) + _ = _hi0 + for _15_index := _dafny.Zero; _15_index.Cmp(_hi0) < 0; _15_index = _15_index.Plus(_dafny.One) { + var _16_childIdentifier _dafny.Sequence + _ = _16_childIdentifier + _16_childIdentifier = (_14_childIdentifiers).Select((_15_index).Uint32()).(_dafny.Sequence) + var _17_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _17_valueOrError4 + _17_valueOrError4 = (m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString(_16_childIdentifier)).MapFailure(func(coer74 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg75 interface{}) interface{} { + return coer74(arg75.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_17_valueOrError4).IsFailure() { + output = (_17_valueOrError4).PropagateFailure() + return output + } + var _18_info m_AwsArnParsing.AwsKmsIdentifier + _ = _18_info + _18_info = (_17_valueOrError4).Extract().(m_AwsArnParsing.AwsKmsIdentifier) + var _19_region m_Wrappers.Option + _ = _19_region + _19_region = m_AwsArnParsing.Companion_Default___.GetRegion(_18_info) + var _20_valueOrError5 m_Wrappers.Result = m_Wrappers.Result{} + _ = _20_valueOrError5 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_((_19_region).UnwrapOr(_dafny.SeqOfString("")).(_dafny.Sequence))) + _20_valueOrError5 = _out1 + if (_20_valueOrError5).IsFailure() { + output = (_20_valueOrError5).PropagateFailure() + return output + } + var _21_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _21_client + _21_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_20_valueOrError5).Extract()) + var _22_keyring *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring + _ = _22_keyring + var _nw1 *m_AwsKmsMrkKeyring.AwsKmsMrkKeyring = m_AwsKmsMrkKeyring.New_AwsKmsMrkKeyring_() + _ = _nw1 + _nw1.Ctor__(_21_client, _16_childIdentifier, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _22_keyring = _nw1 + _13_children = _dafny.Companion_Sequence_.Concatenate(_13_children, _dafny.SeqOf(_22_keyring)) + } + goto Lmatch2 + } + } + { + _13_children = _dafny.SeqOf() + } + goto Lmatch2 + } +Lmatch2: + var _23_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _23_valueOrError6 + _23_valueOrError6 = m_Wrappers.Companion_Default___.Need(((_5_generatorKeyring).Is_Some()) || ((_dafny.IntOfUint32((_13_children).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("generatorKeyring or child Keyrings needed to create a multi keyring"))) + if (_23_valueOrError6).IsFailure() { + output = (_23_valueOrError6).PropagateFailure() + return output + } + var _24_keyring *m_MultiKeyring.MultiKeyring + _ = _24_keyring + var _nw2 *m_MultiKeyring.MultiKeyring = m_MultiKeyring.New_MultiKeyring_() + _ = _nw2 + _nw2.Ctor__(_5_generatorKeyring, _13_children) + _24_keyring = _nw2 + output = m_Wrappers.Companion_Result_.Create_Success_(_24_keyring) + return output + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/MultiKeyring/MultiKeyring.go b/releases/go/mpl/MultiKeyring/MultiKeyring.go new file mode 100644 index 000000000..5268dc676 --- /dev/null +++ b/releases/go/mpl/MultiKeyring/MultiKeyring.go @@ -0,0 +1,446 @@ +// Package MultiKeyring +// Dafny module MultiKeyring compiled into Go + +package MultiKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "MultiKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) AttemptDecryptDataKey(keyring m_AwsCryptographyMaterialProvidersTypes.IKeyring, input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} + _ = _0_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (keyring).OnDecrypt(input) + _0_valueOrError0 = _out0 + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_output m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput + _ = _1_output + _1_output = (_0_valueOrError0).Extract().(m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput) + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError1 + _2_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsTransitionIsValid((input).Dtor_materials(), (_1_output).Dtor_materials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring performed invalid material transition"))) + if (_2_valueOrError1).IsFailure() { + res = (_2_valueOrError1).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(_1_output) + return res + return res +} + +// End of class Default__ + +// Definition of class MultiKeyring +type MultiKeyring struct { + _generatorKeyring m_Wrappers.Option + _childKeyrings _dafny.Sequence +} + +func New_MultiKeyring_() *MultiKeyring { + _this := MultiKeyring{} + + _this._generatorKeyring = m_Wrappers.Companion_Option_.Default() + _this._childKeyrings = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_MultiKeyring_ struct { +} + +var Companion_MultiKeyring_ = CompanionStruct_MultiKeyring_{} + +func (_this *MultiKeyring) Equals(other *MultiKeyring) bool { + return _this == other +} + +func (_this *MultiKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*MultiKeyring) + return ok && _this.Equals(other) +} + +func (*MultiKeyring) String() string { + return "MultiKeyring.MultiKeyring" +} + +func Type_MultiKeyring_() _dafny.TypeDescriptor { + return type_MultiKeyring_{} +} + +type type_MultiKeyring_ struct { +} + +func (_this type_MultiKeyring_) Default() interface{} { + return (*MultiKeyring)(nil) +} + +func (_this type_MultiKeyring_) String() string { + return "MultiKeyring.MultiKeyring" +} +func (_this *MultiKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &MultiKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &MultiKeyring{} +var _ _dafny.TraitOffspring = &MultiKeyring{} + +func (_this *MultiKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out1 +} +func (_this *MultiKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out1 +} +func (_this *MultiKeyring) Ctor__(generatorKeyring m_Wrappers.Option, childKeyrings _dafny.Sequence) { + { + (_this)._generatorKeyring = generatorKeyring + (_this)._childKeyrings = childKeyrings + } +} +func (_this *MultiKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + if (((_this).GeneratorKeyring()).Is_None()) && ((((input).Dtor_materials()).Dtor_plaintextDataKey()).Is_None()) { + var _0_exception _dafny.Sequence + _ = _0_exception + _0_exception = _dafny.SeqOfString("Need either a generator keyring or input encryption materials which contain a plaintext data key") + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_0_exception)) + return res + } + var _1_returnMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _1_returnMaterials + _1_returnMaterials = (input).Dtor_materials() + if ((_this).GeneratorKeyring()).Is_Some() { + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need((((input).Dtor_materials()).Dtor_plaintextDataKey()).Is_None(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("This multi keyring has a generator but provided Encryption Materials already contain plaintext data key"))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_onEncryptOutput m_Wrappers.Result + _ = _3_onEncryptOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.CastTo_(((_this).GeneratorKeyring()).Dtor_value())).OnEncrypt(input) + _3_onEncryptOutput = _out0 + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError1 + _4_valueOrError1 = m_Wrappers.Companion_Default___.Need((_3_onEncryptOutput).Is_Success(), (func() m_AwsCryptographyMaterialProvidersTypes.Error { + if (_3_onEncryptOutput).Is_Failure() { + return (_3_onEncryptOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error) + } + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unexpected failure. Input to Need is !Success.")) + })()) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _5_valueOrError2 + _5_valueOrError2 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterialsTransition((input).Dtor_materials(), ((_3_onEncryptOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput)).Dtor_materials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Generator keyring returned invalid encryption materials"))) + if (_5_valueOrError2).IsFailure() { + res = (_5_valueOrError2).PropagateFailure() + return res + } + _1_returnMaterials = ((_3_onEncryptOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput)).Dtor_materials() + } + var _hi0 _dafny.Int = _dafny.IntOfUint32(((_this).ChildKeyrings()).Cardinality()) + _ = _hi0 + for _6_i := _dafny.Zero; _6_i.Cmp(_hi0) < 0; _6_i = _6_i.Plus(_dafny.One) { + var _7_onEncryptInput m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput + _ = _7_onEncryptInput + _7_onEncryptInput = m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptInput_.Create_OnEncryptInput_(_1_returnMaterials) + var _8_onEncryptOutput m_Wrappers.Result + _ = _8_onEncryptOutput + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (((_this).ChildKeyrings()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.IKeyring)).OnEncrypt(_7_onEncryptInput) + _8_onEncryptOutput = _out1 + var _9_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError3 + _9_valueOrError3 = m_Wrappers.Companion_Default___.Need((_8_onEncryptOutput).Is_Success(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Child keyring failed to encrypt plaintext data key"))) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _10_valueOrError4 + _10_valueOrError4 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterialsTransition(_1_returnMaterials, ((_8_onEncryptOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput)).Dtor_materials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Child keyring performed invalid transition on encryption materials"))) + if (_10_valueOrError4).IsFailure() { + res = (_10_valueOrError4).PropagateFailure() + return res + } + _1_returnMaterials = ((_8_onEncryptOutput).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnEncryptOutput)).Dtor_materials() + } + var _11_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _11_valueOrError5 + _11_valueOrError5 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.ValidEncryptionMaterialsTransition((input).Dtor_materials(), _1_returnMaterials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A child or generator keyring modified the encryption materials in illegal ways."))) + if (_11_valueOrError5).IsFailure() { + res = (_11_valueOrError5).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_1_returnMaterials)) + return res + return res + } +} +func (_this *MultiKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError0 + _1_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey((input).Dtor_materials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _2_failures _dafny.Sequence + _ = _2_failures + _2_failures = _dafny.SeqOf() + if ((_this).GeneratorKeyring()).Is_Some() { + var _3_result m_Wrappers.Result + _ = _3_result + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.AttemptDecryptDataKey(m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.CastTo_(((_this).GeneratorKeyring()).Dtor_value()), input) + _3_result = _out0 + if (_3_result).Is_Success() { + if ((((_3_result).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput)).Dtor_materials()).Dtor_plaintextDataKey()).Is_Some() { + res = m_Wrappers.Companion_Result_.Create_Success_((_3_result).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput)) + return res + } + } else { + _2_failures = _dafny.Companion_Sequence_.Concatenate(_2_failures, _dafny.SeqOf((_3_result).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error))) + } + } + var _hi0 _dafny.Int = _dafny.IntOfUint32(((_this).ChildKeyrings()).Cardinality()) + _ = _hi0 + for _4_j := _dafny.Zero; _4_j.Cmp(_hi0) < 0; _4_j = _4_j.Plus(_dafny.One) { + var _5_result m_Wrappers.Result + _ = _5_result + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.AttemptDecryptDataKey(((_this).ChildKeyrings()).Select((_4_j).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.IKeyring), input) + _5_result = _out1 + if (_5_result).Is_Success() { + res = m_Wrappers.Companion_Result_.Create_Success_((_5_result).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput)) + return res + } else { + _2_failures = _dafny.Companion_Sequence_.Concatenate(_2_failures, _dafny.SeqOf((_5_result).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error))) + } + } + var _6_combinedResult m_AwsCryptographyMaterialProvidersTypes.Error + _ = _6_combinedResult + _6_combinedResult = m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_2_failures, _dafny.SeqOfString("No Configured Keyring was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + res = m_Wrappers.Companion_Result_.Create_Failure_(_6_combinedResult) + return res + return res + } +} +func (_this *MultiKeyring) GeneratorKeyring() m_Wrappers.Option { + { + return _this._generatorKeyring + } +} +func (_this *MultiKeyring) ChildKeyrings() _dafny.Sequence { + { + return _this._childKeyrings + } +} + +// End of class MultiKeyring diff --git a/releases/go/mpl/README.md b/releases/go/mpl/README.md new file mode 100644 index 000000000..ed0265304 --- /dev/null +++ b/releases/go/mpl/README.md @@ -0,0 +1,49 @@ +# AWS Cryptographic Material Providers Library + +The AWS Cryptographic Material Providers Library helps you define your key distribution configuration. +It uses cryptographic best practices to protect the data keys that protect your data. +The data key is protected with a key encryption key called a _wrapping key_. +The encryption method returns the data key and one or more encrypted data keys. +Supported libraries use this information to perform envelope encryption. +The data key is used to protect your data, +and the encrypted data keys are stored alongside your data +so you don't need to keep track of the data keys separately. +You can use AWS KMS keys in [AWS Key Management Service](https://aws.amazon.com/kms/)(AWS KMS) as wrapping keys. +The AWS Cryptographic Material Providers Library +also provides APIs to define and use wrapping keys from other key providers. + +The AWS Cryptographic Material Providers Library provides methods for encrypting and decrypting cryptographic materials used in higher level client side encryption libraries. + +## Security + +If you discover a potential security issue in this project +we ask that you notify AWS/Amazon Security via our +[vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). +Please **do not** create a public GitHub issue. + +## Getting Started + +This library is written in Dafny, a formally verifiable programming language that can be compiled into +different runtimes. Dafny code is transpiled into Go code with the help of internal tools. + +### Installation + +`go get github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl@latest` + +### Optional Prerequisites + +#### AWS Integration + +You don't need an Amazon Web Services (AWS) account to use the AWS Cryptographic Material Providers Library, +but some APIs require an AWS account, an AWS KMS key, or an Amazon DynamoDB Table. +You might also need to use the AWS SDK for Go v2 sdk for some APIs. + +- **To create an AWS account**, go to [Sign In or Create an AWS Account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) and then choose **I am a new user.** Follow the instructions to create an AWS account. + +- **To create a symmetric encryption KMS key in AWS KMS**, see [Creating Keys](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html). + +- **To download and install the AWS SDK for Go v2**, see [Installing the AWS SDK for Go v2](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2). + +## FAQ + +See the [Frequently Asked Questions](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/faq.html) page in the official documentation. diff --git a/releases/go/mpl/RawAESKeyring/RawAESKeyring.go b/releases/go/mpl/RawAESKeyring/RawAESKeyring.go new file mode 100644 index 000000000..17806441d --- /dev/null +++ b/releases/go/mpl/RawAESKeyring/RawAESKeyring.go @@ -0,0 +1,1172 @@ +// Package RawAESKeyring +// Dafny module RawAESKeyring compiled into Go + +package RawAESKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "RawAESKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DeserializeEDKCiphertext(ciphertext _dafny.Sequence, tagLen _dafny.Int) m_AwsCryptographyPrimitivesTypes.AESEncryptOutput { + var _0_encryptedKeyLength _dafny.Int = (_dafny.IntOfUint32((ciphertext).Cardinality())).Minus(tagLen) + _ = _0_encryptedKeyLength + return m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Create_AESEncryptOutput_((ciphertext).Take((_0_encryptedKeyLength).Uint32()), (ciphertext).Drop((_0_encryptedKeyLength).Uint32())) +} +func (_static *CompanionStruct_Default___) SerializeEDKCiphertext(encOutput m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate((encOutput).Dtor_cipherText(), (encOutput).Dtor_authTag()) +} +func (_static *CompanionStruct_Default___) AUTH__TAG__LEN__LEN() _dafny.Int { + return _dafny.IntOfInt64(4) +} +func (_static *CompanionStruct_Default___) IV__LEN__LEN() _dafny.Int { + return _dafny.IntOfInt64(4) +} + +// End of class Default__ + +// Definition of class RawAESKeyring +type RawAESKeyring struct { + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _wrappingKey _dafny.Sequence + _wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM + _keyNamespace _dafny.Sequence + _keyName _dafny.Sequence +} + +func New_RawAESKeyring_() *RawAESKeyring { + _this := RawAESKeyring{} + + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._wrappingKey = _dafny.EmptySeq + _this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{} + _this._keyNamespace = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._keyName = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + return &_this +} + +type CompanionStruct_RawAESKeyring_ struct { +} + +var Companion_RawAESKeyring_ = CompanionStruct_RawAESKeyring_{} + +func (_this *RawAESKeyring) Equals(other *RawAESKeyring) bool { + return _this == other +} + +func (_this *RawAESKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RawAESKeyring) + return ok && _this.Equals(other) +} + +func (*RawAESKeyring) String() string { + return "RawAESKeyring.RawAESKeyring" +} + +func Type_RawAESKeyring_() _dafny.TypeDescriptor { + return type_RawAESKeyring_{} +} + +type type_RawAESKeyring_ struct { +} + +func (_this type_RawAESKeyring_) Default() interface{} { + return (*RawAESKeyring)(nil) +} + +func (_this type_RawAESKeyring_) String() string { + return "RawAESKeyring.RawAESKeyring" +} +func (_this *RawAESKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &RawAESKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &RawAESKeyring{} +var _ _dafny.TraitOffspring = &RawAESKeyring{} + +func (_this *RawAESKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out10 m_Wrappers.Result + _ = _out10 + _out10 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out10 +} +func (_this *RawAESKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out10 m_Wrappers.Result + _ = _out10 + _out10 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out10 +} +func (_this *RawAESKeyring) Ctor__(namespace _dafny.Sequence, name _dafny.Sequence, key _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyNamespace = namespace + (_this)._keyName = name + (_this)._wrappingKey = key + (_this)._wrappingAlgorithm = wrappingAlgorithm + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *RawAESKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = (_0_materials).Dtor_algorithmSuite() + var _2_wrap *AesWrapKeyMaterial + _ = _2_wrap + var _nw0 *AesWrapKeyMaterial = New_AesWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).WrappingKey(), (_this).WrappingAlgorithm(), (_this).CryptoPrimitives()) + _2_wrap = _nw0 + var _3_generateAndWrap *AesGenerateAndWrapKeyMaterial + _ = _3_generateAndWrap + var _nw1 *AesGenerateAndWrapKeyMaterial = New_AesGenerateAndWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__(_2_wrap) + _3_generateAndWrap = _nw1 + var _4_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_AesWrapInfo_.Default())) + _ = _4_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_0_materials, _2_wrap, _3_generateAndWrap) + _4_valueOrError0 = _out0 + if (_4_valueOrError0).IsFailure() { + output = (_4_valueOrError0).PropagateFailure() + return output + } + var _5_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _5_wrapOutput + _5_wrapOutput = (_4_valueOrError0).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _6_symmetricSigningKeyList m_Wrappers.Option + _ = _6_symmetricSigningKeyList + if ((_5_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_5_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _7_edk + _7_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_((_this).KeyNamespace(), (_this).SerializeProviderInfo(((_5_wrapOutput).Dtor_wrapInfo().(AesWrapInfo)).Dtor_iv()), (_5_wrapOutput).Dtor_wrappedMaterial()) + if (_5_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _8_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _8_valueOrError1 + _8_valueOrError1 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_0_materials, (_5_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList) + if (_8_valueOrError1).IsFailure() { + output = (_8_valueOrError1).PropagateFailure() + return output + } + var _9_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _9_result + _9_result = (_8_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_9_result)) + return output + } else if (_5_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _10_valueOrError2 + _10_valueOrError2 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_0_materials, _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList) + if (_10_valueOrError2).IsFailure() { + output = (_10_valueOrError2).PropagateFailure() + return output + } + var _11_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _11_result + _11_result = (_10_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_11_result)) + return output + } + return output + } +} +func (_this *RawAESKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError0 + _1_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_1_valueOrError0).IsFailure() { + output = (_1_valueOrError0).PropagateFailure() + return output + } + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError1 + _2_valueOrError1 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_aad _dafny.Sequence + _ = _3_aad + _3_aad = (_2_valueOrError1).Extract().(_dafny.Sequence) + var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError2 + _4_valueOrError2 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32(((_this).WrappingKey()).Cardinality())).Cmp(_dafny.IntOfInt32(((_this).WrappingAlgorithm()).Dtor_keyLength())) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("The wrapping key does not match the wrapping algorithm"))) + if (_4_valueOrError2).IsFailure() { + output = (_4_valueOrError2).PropagateFailure() + return output + } + var _5_errors _dafny.Sequence + _ = _5_errors + _5_errors = _dafny.SeqOf() + var _hi0 _dafny.Int = _dafny.IntOfUint32(((input).Dtor_encryptedDataKeys()).Cardinality()) + _ = _hi0 + for _6_i := _dafny.Zero; _6_i.Cmp(_hi0) < 0; _6_i = _6_i.Plus(_dafny.One) { + if (_this).ShouldDecryptEDK(((input).Dtor_encryptedDataKeys()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)) { + var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _7_edk + _7_edk = ((input).Dtor_encryptedDataKeys()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + var _8_iv _dafny.Sequence + _ = _8_iv + _8_iv = (_this).GetIvFromProvInfo((_7_edk).Dtor_keyProviderInfo()) + var _9_unwrap *AesUnwrapKeyMaterial + _ = _9_unwrap + var _nw0 *AesUnwrapKeyMaterial = New_AesUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).WrappingKey(), (_this).WrappingAlgorithm(), _8_iv, (_this).CryptoPrimitives()) + _9_unwrap = _nw0 + var _10_unwrapOutput m_Wrappers.Result + _ = _10_unwrapOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((_7_edk).Dtor_ciphertext(), _0_materials, _9_unwrap) + _10_unwrapOutput = _out0 + if (_10_unwrapOutput).Is_Success() { + var _11_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _11_valueOrError3 + _11_valueOrError3 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey(_0_materials, ((_10_unwrapOutput).Dtor_value().(m_EdkWrapping.UnwrapEdkMaterialOutput)).Dtor_plaintextDataKey(), ((_10_unwrapOutput).Dtor_value().(m_EdkWrapping.UnwrapEdkMaterialOutput)).Dtor_symmetricSigningKey()) + if (_11_valueOrError3).IsFailure() { + output = (_11_valueOrError3).PropagateFailure() + return output + } + var _12_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _12_result + _12_result = (_11_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + var _13_value m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput + _ = _13_value + _13_value = m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_12_result) + output = m_Wrappers.Companion_Result_.Create_Success_(_13_value) + return output + } else { + _5_errors = _dafny.Companion_Sequence_.Concatenate(_5_errors, _dafny.SeqOf((_10_unwrapOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error))) + } + } else { + var _14_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _14_valueOrError4 + _14_valueOrError4 = (m_UTF8.Decode((((input).Dtor_encryptedDataKeys()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)).Dtor_keyProviderId())).MapFailure(func(coer120 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg121 interface{}) interface{} { + return coer120(arg121.(_dafny.Sequence)) + } + }(func(_15_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_15_e) + })) + if (_14_valueOrError4).IsFailure() { + output = (_14_valueOrError4).PropagateFailure() + return output + } + var _16_extractedKeyProviderId _dafny.Sequence + _ = _16_extractedKeyProviderId + _16_extractedKeyProviderId = (_14_valueOrError4).Extract().(_dafny.Sequence) + _5_errors = _dafny.Companion_Sequence_.Concatenate(_5_errors, _dafny.SeqOf(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(m_ErrorMessages.Companion_Default___.IncorrectRawDataKeys(m_StandardLibrary_String.Companion_Default___.Base10Int2String(_6_i), _dafny.SeqOfString("AESKeyring"), _16_extractedKeyProviderId)))) + } + } + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_5_errors, _dafny.SeqOfString("Raw AES Keyring was unable to decrypt any encrypted data key. The list of encountered Exceptions is avaible via `list`."))) + return output + return output + } +} +func (_this *RawAESKeyring) SerializeProviderInfo(iv _dafny.Sequence) _dafny.Sequence { + { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_this).KeyName(), m_StandardLibrary_UInt.Companion_Default___.UInt32ToSeq(uint32((((_this).WrappingAlgorithm()).Dtor_tagLength())*(int32(8))))), m_StandardLibrary_UInt.Companion_Default___.UInt32ToSeq(uint32(((_this).WrappingAlgorithm()).Dtor_ivLength()))), iv) + } +} +func (_this *RawAESKeyring) ShouldDecryptEDK(edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) bool { + { + return (_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), (_this).KeyNamespace())) && ((_this).ValidProviderInfo((edk).Dtor_keyProviderInfo())) + } +} +func (_this *RawAESKeyring) ValidProviderInfo(info _dafny.Sequence) bool { + { + return ((((((_dafny.IntOfUint32((info).Cardinality())).Cmp((((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Plus(Companion_Default___.IV__LEN__LEN())).Plus(_dafny.IntOfInt32(((_this).WrappingAlgorithm()).Dtor_ivLength()))) == 0) && (_dafny.Companion_Sequence_.Equal((info).Subsequence(0, (_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Uint32()), (_this).KeyName()))) && ((m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((info).Subsequence((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Uint32(), ((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Uint32()))) == (uint32(128)))) && ((m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((info).Subsequence((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Uint32(), ((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Uint32()))) == ((uint32(((_this).WrappingAlgorithm()).Dtor_tagLength())) * (uint32(8))))) && ((m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((info).Subsequence(((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Uint32(), (((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Plus(Companion_Default___.IV__LEN__LEN())).Uint32()))) == (uint32(((_this).WrappingAlgorithm()).Dtor_ivLength())))) && ((m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((info).Subsequence(((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Uint32(), (((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Plus(Companion_Default___.IV__LEN__LEN())).Uint32()))) == (uint32(12))) + } +} +func (_this *RawAESKeyring) GetIvFromProvInfo(info _dafny.Sequence) _dafny.Sequence { + { + return (info).Drop((((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Plus(Companion_Default___.IV__LEN__LEN())).Uint32()) + } +} +func (_this *RawAESKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *RawAESKeyring) WrappingKey() _dafny.Sequence { + { + return _this._wrappingKey + } +} +func (_this *RawAESKeyring) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM { + { + return _this._wrappingAlgorithm + } +} +func (_this *RawAESKeyring) KeyNamespace() _dafny.Sequence { + { + return _this._keyNamespace + } +} +func (_this *RawAESKeyring) KeyName() _dafny.Sequence { + { + return _this._keyName + } +} + +// End of class RawAESKeyring + +// Definition of datatype AesUnwrapInfo +type AesUnwrapInfo struct { + Data_AesUnwrapInfo_ +} + +func (_this AesUnwrapInfo) Get_() Data_AesUnwrapInfo_ { + return _this.Data_AesUnwrapInfo_ +} + +type Data_AesUnwrapInfo_ interface { + isAesUnwrapInfo() +} + +type CompanionStruct_AesUnwrapInfo_ struct { +} + +var Companion_AesUnwrapInfo_ = CompanionStruct_AesUnwrapInfo_{} + +type AesUnwrapInfo_AesUnwrapInfo struct { +} + +func (AesUnwrapInfo_AesUnwrapInfo) isAesUnwrapInfo() {} + +func (CompanionStruct_AesUnwrapInfo_) Create_AesUnwrapInfo_() AesUnwrapInfo { + return AesUnwrapInfo{AesUnwrapInfo_AesUnwrapInfo{}} +} + +func (_this AesUnwrapInfo) Is_AesUnwrapInfo() bool { + _, ok := _this.Get_().(AesUnwrapInfo_AesUnwrapInfo) + return ok +} + +func (CompanionStruct_AesUnwrapInfo_) Default() AesUnwrapInfo { + return Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_() +} + +func (_ CompanionStruct_AesUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_(), true + default: + return AesUnwrapInfo{}, false + } + } +} + +func (_this AesUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case AesUnwrapInfo_AesUnwrapInfo: + { + return "RawAESKeyring.AesUnwrapInfo.AesUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this AesUnwrapInfo) Equals(other AesUnwrapInfo) bool { + switch _this.Get_().(type) { + case AesUnwrapInfo_AesUnwrapInfo: + { + _, ok := other.Get_().(AesUnwrapInfo_AesUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this AesUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AesUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_AesUnwrapInfo_() _dafny.TypeDescriptor { + return type_AesUnwrapInfo_{} +} + +type type_AesUnwrapInfo_ struct { +} + +func (_this type_AesUnwrapInfo_) Default() interface{} { + return Companion_AesUnwrapInfo_.Default() +} + +func (_this type_AesUnwrapInfo_) String() string { + return "RawAESKeyring.AesUnwrapInfo" +} +func (_this AesUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AesUnwrapInfo{} + +// End of datatype AesUnwrapInfo + +// Definition of datatype AesWrapInfo +type AesWrapInfo struct { + Data_AesWrapInfo_ +} + +func (_this AesWrapInfo) Get_() Data_AesWrapInfo_ { + return _this.Data_AesWrapInfo_ +} + +type Data_AesWrapInfo_ interface { + isAesWrapInfo() +} + +type CompanionStruct_AesWrapInfo_ struct { +} + +var Companion_AesWrapInfo_ = CompanionStruct_AesWrapInfo_{} + +type AesWrapInfo_AesWrapInfo struct { + Iv _dafny.Sequence +} + +func (AesWrapInfo_AesWrapInfo) isAesWrapInfo() {} + +func (CompanionStruct_AesWrapInfo_) Create_AesWrapInfo_(Iv _dafny.Sequence) AesWrapInfo { + return AesWrapInfo{AesWrapInfo_AesWrapInfo{Iv}} +} + +func (_this AesWrapInfo) Is_AesWrapInfo() bool { + _, ok := _this.Get_().(AesWrapInfo_AesWrapInfo) + return ok +} + +func (CompanionStruct_AesWrapInfo_) Default() AesWrapInfo { + return Companion_AesWrapInfo_.Create_AesWrapInfo_(_dafny.EmptySeq) +} + +func (_this AesWrapInfo) Dtor_iv() _dafny.Sequence { + return _this.Get_().(AesWrapInfo_AesWrapInfo).Iv +} + +func (_this AesWrapInfo) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case AesWrapInfo_AesWrapInfo: + { + return "RawAESKeyring.AesWrapInfo.AesWrapInfo" + "(" + _dafny.String(data.Iv) + ")" + } + default: + { + return "" + } + } +} + +func (_this AesWrapInfo) Equals(other AesWrapInfo) bool { + switch data1 := _this.Get_().(type) { + case AesWrapInfo_AesWrapInfo: + { + data2, ok := other.Get_().(AesWrapInfo_AesWrapInfo) + return ok && data1.Iv.Equals(data2.Iv) + } + default: + { + return false // unexpected + } + } +} + +func (_this AesWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(AesWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_AesWrapInfo_() _dafny.TypeDescriptor { + return type_AesWrapInfo_{} +} + +type type_AesWrapInfo_ struct { +} + +func (_this type_AesWrapInfo_) Default() interface{} { + return Companion_AesWrapInfo_.Default() +} + +func (_this type_AesWrapInfo_) String() string { + return "RawAESKeyring.AesWrapInfo" +} +func (_this AesWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = AesWrapInfo{} + +// End of datatype AesWrapInfo + +// Definition of class AesGenerateAndWrapKeyMaterial +type AesGenerateAndWrapKeyMaterial struct { + _wrap *AesWrapKeyMaterial +} + +func New_AesGenerateAndWrapKeyMaterial_() *AesGenerateAndWrapKeyMaterial { + _this := AesGenerateAndWrapKeyMaterial{} + + _this._wrap = (*AesWrapKeyMaterial)(nil) + return &_this +} + +type CompanionStruct_AesGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_AesGenerateAndWrapKeyMaterial_ = CompanionStruct_AesGenerateAndWrapKeyMaterial_{} + +func (_this *AesGenerateAndWrapKeyMaterial) Equals(other *AesGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *AesGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AesGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*AesGenerateAndWrapKeyMaterial) String() string { + return "RawAESKeyring.AesGenerateAndWrapKeyMaterial" +} + +func Type_AesGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_AesGenerateAndWrapKeyMaterial_{} +} + +type type_AesGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_AesGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*AesGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_AesGenerateAndWrapKeyMaterial_) String() string { + return "RawAESKeyring.AesGenerateAndWrapKeyMaterial" +} +func (_this *AesGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &AesGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &AesGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &AesGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &AesGenerateAndWrapKeyMaterial{} + +func (_this *AesGenerateAndWrapKeyMaterial) Ctor__(wrap *AesWrapKeyMaterial) { + { + (_this)._wrap = wrap + } +} +func (_this *AesGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_AesWrapInfo_.Default())) + _ = res + var _0_generateBytesResult m_Wrappers.Result + _ = _0_generateBytesResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (((_this).Wrap()).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))) + _0_generateBytesResult = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_generateBytesResult).MapFailure(func(coer121 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg122 interface{}) interface{} { + return coer121(arg122.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_plaintextMaterial _dafny.Sequence + _ = _3_plaintextMaterial + _3_plaintextMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence) + var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_AesWrapInfo_.Default())) + _ = _4_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = ((_this).Wrap()).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_3_plaintextMaterial, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext())) + _4_valueOrError1 = _out1.(m_Wrappers.Result) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_wrapOutput m_MaterialWrapping.WrapOutput + _ = _5_wrapOutput + _5_wrapOutput = (_4_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_3_plaintextMaterial, (_5_wrapOutput).Dtor_wrappedMaterial(), (_5_wrapOutput).Dtor_wrapInfo().(AesWrapInfo))) + return res + } +} +func (_this *AesGenerateAndWrapKeyMaterial) Wrap() *AesWrapKeyMaterial { + { + return _this._wrap + } +} + +// End of class AesGenerateAndWrapKeyMaterial + +// Definition of class AesWrapKeyMaterial +type AesWrapKeyMaterial struct { + _wrappingKey _dafny.Sequence + _wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_AesWrapKeyMaterial_() *AesWrapKeyMaterial { + _this := AesWrapKeyMaterial{} + + _this._wrappingKey = _dafny.EmptySeq + _this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{} + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_AesWrapKeyMaterial_ struct { +} + +var Companion_AesWrapKeyMaterial_ = CompanionStruct_AesWrapKeyMaterial_{} + +func (_this *AesWrapKeyMaterial) Equals(other *AesWrapKeyMaterial) bool { + return _this == other +} + +func (_this *AesWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AesWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*AesWrapKeyMaterial) String() string { + return "RawAESKeyring.AesWrapKeyMaterial" +} + +func Type_AesWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_AesWrapKeyMaterial_{} +} + +type type_AesWrapKeyMaterial_ struct { +} + +func (_this type_AesWrapKeyMaterial_) Default() interface{} { + return (*AesWrapKeyMaterial)(nil) +} + +func (_this type_AesWrapKeyMaterial_) String() string { + return "RawAESKeyring.AesWrapKeyMaterial" +} +func (_this *AesWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &AesWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &AesWrapKeyMaterial{} +var _ m_Actions.Action = &AesWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &AesWrapKeyMaterial{} + +func (_this *AesWrapKeyMaterial) Ctor__(wrappingKey _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._wrappingKey = wrappingKey + (_this)._wrappingAlgorithm = wrappingAlgorithm + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *AesWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_AesWrapInfo_.Default())) + _ = res + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_aad _dafny.Sequence + _ = _1_aad + _1_aad = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_randomIvResult m_Wrappers.Result + _ = _2_randomIvResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(((_this).WrappingAlgorithm()).Dtor_ivLength())) + _2_randomIvResult = _out0 + var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _3_valueOrError1 + _3_valueOrError1 = (_2_randomIvResult).MapFailure(func(coer122 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg123 interface{}) interface{} { + return coer122(arg123.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_4_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_4_e) + })) + if (_3_valueOrError1).IsFailure() { + res = (_3_valueOrError1).PropagateFailure() + return res + } + var _5_iv _dafny.Sequence + _ = _5_iv + _5_iv = (_3_valueOrError1).Extract().(_dafny.Sequence) + var _6_aesEncryptResult m_Wrappers.Result + _ = _6_aesEncryptResult + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = ((_this).CryptoPrimitives()).AESEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_((_this).WrappingAlgorithm(), _5_iv, (_this).WrappingKey(), (input).Dtor_plaintextMaterial(), _1_aad)) + _6_aesEncryptResult = _out1 + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default()) + _ = _7_valueOrError2 + _7_valueOrError2 = (_6_aesEncryptResult).MapFailure(func(coer123 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg124 interface{}) interface{} { + return coer123(arg124.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_8_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_8_e) + })) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _9_wrappedMaterialResult m_AwsCryptographyPrimitivesTypes.AESEncryptOutput + _ = _9_wrappedMaterialResult + _9_wrappedMaterialResult = (_7_valueOrError2).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) + var _10_wrappedMaterial _dafny.Sequence + _ = _10_wrappedMaterial + _10_wrappedMaterial = Companion_Default___.SerializeEDKCiphertext(_9_wrappedMaterialResult) + res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_10_wrappedMaterial, Companion_AesWrapInfo_.Create_AesWrapInfo_(_5_iv))) + return res + return res + } +} +func (_this *AesWrapKeyMaterial) WrappingKey() _dafny.Sequence { + { + return _this._wrappingKey + } +} +func (_this *AesWrapKeyMaterial) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM { + { + return _this._wrappingAlgorithm + } +} +func (_this *AesWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class AesWrapKeyMaterial + +// Definition of class AesUnwrapKeyMaterial +type AesUnwrapKeyMaterial struct { + _wrappingKey _dafny.Sequence + _iv _dafny.Sequence + _wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_AesUnwrapKeyMaterial_() *AesUnwrapKeyMaterial { + _this := AesUnwrapKeyMaterial{} + + _this._wrappingKey = _dafny.EmptySeq + _this._iv = _dafny.EmptySeq + _this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{} + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_AesUnwrapKeyMaterial_ struct { +} + +var Companion_AesUnwrapKeyMaterial_ = CompanionStruct_AesUnwrapKeyMaterial_{} + +func (_this *AesUnwrapKeyMaterial) Equals(other *AesUnwrapKeyMaterial) bool { + return _this == other +} + +func (_this *AesUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*AesUnwrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*AesUnwrapKeyMaterial) String() string { + return "RawAESKeyring.AesUnwrapKeyMaterial" +} + +func Type_AesUnwrapKeyMaterial_() _dafny.TypeDescriptor { + return type_AesUnwrapKeyMaterial_{} +} + +type type_AesUnwrapKeyMaterial_ struct { +} + +func (_this type_AesUnwrapKeyMaterial_) Default() interface{} { + return (*AesUnwrapKeyMaterial)(nil) +} + +func (_this type_AesUnwrapKeyMaterial_) String() string { + return "RawAESKeyring.AesUnwrapKeyMaterial" +} +func (_this *AesUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &AesUnwrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &AesUnwrapKeyMaterial{} +var _ m_Actions.Action = &AesUnwrapKeyMaterial{} +var _ _dafny.TraitOffspring = &AesUnwrapKeyMaterial{} + +func (_this *AesUnwrapKeyMaterial) Ctor__(wrappingKey _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, iv _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._wrappingKey = wrappingKey + (_this)._iv = iv + (_this)._wrappingAlgorithm = wrappingAlgorithm + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *AesUnwrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_AesUnwrapInfo_.Default())) + _ = res + var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _0_valueOrError0 + _0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext()) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_aad _dafny.Sequence + _ = _1_aad + _1_aad = (_0_valueOrError0).Extract().(_dafny.Sequence) + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError1 + _2_valueOrError1 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt32(((_this).WrappingAlgorithm()).Dtor_tagLength())).Cmp(_dafny.IntOfUint32(((input).Dtor_wrappedMaterial()).Cardinality())) <= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Insufficient data to decrypt."))) + if (_2_valueOrError1).IsFailure() { + res = (_2_valueOrError1).PropagateFailure() + return res + } + var _3_encryptionOutput m_AwsCryptographyPrimitivesTypes.AESEncryptOutput + _ = _3_encryptionOutput + _3_encryptionOutput = Companion_Default___.DeserializeEDKCiphertext((input).Dtor_wrappedMaterial(), _dafny.IntOfInt32(((_this).WrappingAlgorithm()).Dtor_tagLength())) + var _4_maybePtKey m_Wrappers.Result + _ = _4_maybePtKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).AESDecrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESDecryptInput_.Create_AESDecryptInput_((_this).WrappingAlgorithm(), (_this).WrappingKey(), (_3_encryptionOutput).Dtor_cipherText(), (_3_encryptionOutput).Dtor_authTag(), (_this).Iv(), _1_aad)) + _4_maybePtKey = _out0 + var _5_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError2 + _5_valueOrError2 = (_4_maybePtKey).MapFailure(func(coer124 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg125 interface{}) interface{} { + return coer124(arg125.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_6_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_6_e) + })) + if (_5_valueOrError2).IsFailure() { + res = (_5_valueOrError2).PropagateFailure() + return res + } + var _7_ptKey _dafny.Sequence + _ = _7_ptKey + _7_ptKey = (_5_valueOrError2).Extract().(_dafny.Sequence) + var _8_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError3 + _8_valueOrError3 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))).Cmp(_dafny.IntOfUint32((_7_ptKey).Cardinality())) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Plaintext Data Key is not the expected length"))) + if (_8_valueOrError3).IsFailure() { + res = (_8_valueOrError3).PropagateFailure() + return res + } + res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(_7_ptKey, Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_())) + return res + return res + } +} +func (_this *AesUnwrapKeyMaterial) WrappingKey() _dafny.Sequence { + { + return _this._wrappingKey + } +} +func (_this *AesUnwrapKeyMaterial) Iv() _dafny.Sequence { + { + return _this._iv + } +} +func (_this *AesUnwrapKeyMaterial) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM { + { + return _this._wrappingAlgorithm + } +} +func (_this *AesUnwrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class AesUnwrapKeyMaterial diff --git a/releases/go/mpl/RawECDHKeyring/RawECDHKeyring.go b/releases/go/mpl/RawECDHKeyring/RawECDHKeyring.go new file mode 100644 index 000000000..aec9bfc0a --- /dev/null +++ b/releases/go/mpl/RawECDHKeyring/RawECDHKeyring.go @@ -0,0 +1,1306 @@ +// Package RawECDHKeyring +// Dafny module RawECDHKeyring compiled into Go + +package RawECDHKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "RawECDHKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) ValidPublicKeyLength(p _dafny.Sequence) bool { + return (true) && ((((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__LEN__ECC__NIST__256()) == 0) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__LEN__ECC__NIST__384()) == 0)) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__LEN__ECC__NIST__521()) == 0)) +} +func (_static *CompanionStruct_Default___) ValidCompressedPublicKeyLength(p _dafny.Sequence) bool { + return (true) && ((((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__256()) == 0) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__384()) == 0)) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(m_Constants.Companion_Default___.ECDH__PUBLIC__KEY__COMPRESSED__LEN__ECC__NIST__521()) == 0)) +} +func (_static *CompanionStruct_Default___) ValidProviderInfoLength(p _dafny.Sequence) bool { + return (((_dafny.IntOfUint32((p).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__256__LEN())) == 0) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__384__LEN())) == 0)) || ((_dafny.IntOfUint32((p).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__521__LEN())) == 0) +} +func (_static *CompanionStruct_Default___) LocalDeriveSharedSecret(senderPrivateKey m_AwsCryptographyPrimitivesTypes.ECCPrivateKey, recipientPublicKey m_AwsCryptographyPrimitivesTypes.ECCPublicKey, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_maybeSharedSecret m_Wrappers.Result + _ = _0_maybeSharedSecret + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).DeriveSharedSecret(m_AwsCryptographyPrimitivesTypes.Companion_DeriveSharedSecretInput_.Create_DeriveSharedSecretInput_(curveSpec, senderPrivateKey, recipientPublicKey)) + _0_maybeSharedSecret = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_DeriveSharedSecretOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeSharedSecret).MapFailure(func(coer110 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg111 interface{}) interface{} { + return coer110(arg111.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_sharedSecretOutput m_AwsCryptographyPrimitivesTypes.DeriveSharedSecretOutput + _ = _3_sharedSecretOutput + _3_sharedSecretOutput = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.DeriveSharedSecretOutput) + res = m_Wrappers.Companion_Result_.Create_Success_((_3_sharedSecretOutput).Dtor_sharedSecret()) + return res + return res +} +func (_static *CompanionStruct_Default___) CompressPublicKey(publicKey m_AwsCryptographyPrimitivesTypes.ECCPublicKey, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_maybeCompressedPublicKey m_Wrappers.Result + _ = _0_maybeCompressedPublicKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_CompressPublicKeyInput_.Create_CompressPublicKeyInput_(publicKey, curveSpec)) + _0_maybeCompressedPublicKey = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_CompressPublicKeyOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeCompressedPublicKey).MapFailure(func(coer111 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg112 interface{}) interface{} { + return coer111(arg112.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_compresedPublicKey m_AwsCryptographyPrimitivesTypes.CompressPublicKeyOutput + _ = _3_compresedPublicKey + _3_compresedPublicKey = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.CompressPublicKeyOutput) + res = m_Wrappers.Companion_Result_.Create_Success_((_3_compresedPublicKey).Dtor_compressedPublicKey()) + return res + return res +} +func (_static *CompanionStruct_Default___) DecompressPublicKey(publicKey _dafny.Sequence, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_maybePublicKey m_Wrappers.Result + _ = _0_maybePublicKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).DecompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_DecompressPublicKeyInput_.Create_DecompressPublicKeyInput_(publicKey, curveSpec)) + _0_maybePublicKey = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_DecompressPublicKeyOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybePublicKey).MapFailure(func(coer112 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg113 interface{}) interface{} { + return coer112(arg113.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_publicKey m_AwsCryptographyPrimitivesTypes.DecompressPublicKeyOutput + _ = _3_publicKey + _3_publicKey = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.DecompressPublicKeyOutput) + res = m_Wrappers.Companion_Result_.Create_Success_(((_3_publicKey).Dtor_publicKey()).Dtor_der()) + return res + return res +} +func (_static *CompanionStruct_Default___) SerializeProviderInfo(senderPublicKey _dafny.Sequence, recipientPublicKey _dafny.Sequence) _dafny.Sequence { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(Companion_Default___.RAW__ECDH__KEYRING__VERSION(), m_StandardLibrary_UInt.Companion_Default___.UInt32ToSeq(uint32((recipientPublicKey).Cardinality()))), recipientPublicKey), m_StandardLibrary_UInt.Companion_Default___.UInt32ToSeq(uint32((senderPublicKey).Cardinality()))), senderPublicKey) +} +func (_static *CompanionStruct_Default___) GenerateEphemeralEccKeyPair(curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECCKeyPairOutput_.Default()) + _ = res + var _0_maybeKeyPair m_Wrappers.Result + _ = _0_maybeKeyPair + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).GenerateECCKeyPair(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECCKeyPairInput_.Create_GenerateECCKeyPairInput_(curveSpec)) + _0_maybeKeyPair = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECCKeyPairOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeKeyPair).MapFailure(func(coer113 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg114 interface{}) interface{} { + return coer113(arg114.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_keyPair m_AwsCryptographyPrimitivesTypes.GenerateECCKeyPairOutput + _ = _3_keyPair + _3_keyPair = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.GenerateECCKeyPairOutput) + res = m_Wrappers.Companion_Result_.Create_Success_(_3_keyPair) + return res +} +func (_static *CompanionStruct_Default___) ValidatePublicKey(crypto *m_AtomicPrimitives.AtomicPrimitivesClient, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, publicKey _dafny.Sequence) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + var _0_maybeValidate m_Wrappers.Result + _ = _0_maybeValidate + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).ValidatePublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ValidatePublicKeyInput_.Create_ValidatePublicKeyInput_(curveSpec, publicKey)) + _0_maybeValidate = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_ValidatePublicKeyOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybeValidate).MapFailure(func(coer114 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg115 interface{}) interface{} { + return coer114(arg115.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_validate m_AwsCryptographyPrimitivesTypes.ValidatePublicKeyOutput + _ = _3_validate + _3_validate = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.ValidatePublicKeyOutput) + res = m_Wrappers.Companion_Result_.Create_Success_((_3_validate).Dtor_success()) + return res +} +func (_static *CompanionStruct_Default___) CurveSpecTypeToString(c m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec) _dafny.Sequence { + var _source0 m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec = c + _ = _source0 + { + if _source0.Is_ECC__NIST__P256() { + return _dafny.SeqOfString("p256") + } + } + { + if _source0.Is_ECC__NIST__P384() { + return _dafny.SeqOfString("p384") + } + } + { + if _source0.Is_ECC__NIST__P521() { + return _dafny.SeqOfString("p521") + } + } + { + return _dafny.SeqOfString("sm2") + } +} +func (_static *CompanionStruct_Default___) E(s _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(s) +} +func (_static *CompanionStruct_Default___) RAW__ECDH__KEYRING__VERSION() _dafny.Sequence { + return _dafny.SeqOf(uint8(1)) +} + +// End of class Default__ + +// Definition of class RawEcdhKeyring +type RawEcdhKeyring struct { + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations + _curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec + _recipientPublicKey m_AwsCryptographyPrimitivesTypes.ECCPublicKey + _compressedRecipientPublicKey _dafny.Sequence + _senderPublicKey m_AwsCryptographyPrimitivesTypes.ECCPublicKey + _senderPrivateKey m_AwsCryptographyPrimitivesTypes.ECCPrivateKey + _compressedSenderPublicKey _dafny.Sequence +} + +func New_RawEcdhKeyring_() *RawEcdhKeyring { + _this := RawEcdhKeyring{} + + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_RawEcdhStaticConfigurations_.Default() + _this._curveSpec = m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default() + _this._recipientPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Default() + _this._compressedRecipientPublicKey = _dafny.EmptySeq + _this._senderPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Default() + _this._senderPrivateKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Default() + _this._compressedSenderPublicKey = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_RawEcdhKeyring_ struct { +} + +var Companion_RawEcdhKeyring_ = CompanionStruct_RawEcdhKeyring_{} + +func (_this *RawEcdhKeyring) Equals(other *RawEcdhKeyring) bool { + return _this == other +} + +func (_this *RawEcdhKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RawEcdhKeyring) + return ok && _this.Equals(other) +} + +func (*RawEcdhKeyring) String() string { + return "RawECDHKeyring.RawEcdhKeyring" +} + +func Type_RawEcdhKeyring_() _dafny.TypeDescriptor { + return type_RawEcdhKeyring_{} +} + +type type_RawEcdhKeyring_ struct { +} + +func (_this type_RawEcdhKeyring_) Default() interface{} { + return (*RawEcdhKeyring)(nil) +} + +func (_this type_RawEcdhKeyring_) String() string { + return "RawECDHKeyring.RawEcdhKeyring" +} +func (_this *RawEcdhKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &RawEcdhKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &RawEcdhKeyring{} +var _ _dafny.TraitOffspring = &RawEcdhKeyring{} + +func (_this *RawEcdhKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out8 m_Wrappers.Result + _ = _out8 + _out8 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out8 +} +func (_this *RawEcdhKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out8 m_Wrappers.Result + _ = _out8 + _out8 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out8 +} +func (_this *RawEcdhKeyring) Ctor__(keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, senderPrivateKey m_Wrappers.Option, senderPublicKey m_Wrappers.Option, recipientPublicKey _dafny.Sequence, compressedSenderPublicKey m_Wrappers.Option, compressedRecipientPublicKey _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyAgreementScheme = keyAgreementScheme + (_this)._curveSpec = curveSpec + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._recipientPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(recipientPublicKey) + (_this)._compressedRecipientPublicKey = compressedRecipientPublicKey + if (((senderPublicKey).Is_Some()) && ((senderPrivateKey).Is_Some())) && ((compressedSenderPublicKey).Is_Some()) { + (_this)._senderPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_((senderPublicKey).Dtor_value().(_dafny.Sequence)) + (_this)._senderPrivateKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Create_ECCPrivateKey_((senderPrivateKey).Dtor_value().(_dafny.Sequence)) + (_this)._compressedSenderPublicKey = (compressedSenderPublicKey).Dtor_value().(_dafny.Sequence) + } else { + (_this)._senderPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_dafny.SeqOf()) + (_this)._senderPrivateKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Create_ECCPrivateKey_(_dafny.SeqOf()) + (_this)._compressedSenderPublicKey = _dafny.SeqOf() + } + } +} +func (_this *RawEcdhKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + if ((_this).KeyAgreementScheme()).Is_PublicKeyDiscovery() { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("PublicKeyDiscovery Key Agreement Scheme is forbidden on encrypt."))) + return res + } + var _0_operationSenderPrivateKey m_AwsCryptographyPrimitivesTypes.ECCPrivateKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Default() + _ = _0_operationSenderPrivateKey + var _1_operationSenderPublicKey m_AwsCryptographyPrimitivesTypes.ECCPublicKey = m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Default() + _ = _1_operationSenderPublicKey + var _2_operationCompressedSenderPublicKey _dafny.Sequence = _dafny.EmptySeq + _ = _2_operationCompressedSenderPublicKey + if ((_this).KeyAgreementScheme()).Is_EphemeralPrivateKeyToStaticPublicKey() { + var _3_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_GenerateECCKeyPairOutput_.Default()) + _ = _3_valueOrError0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.GenerateEphemeralEccKeyPair((_this).CurveSpec(), (_this).CryptoPrimitives()) + _3_valueOrError0 = _out0 + if (_3_valueOrError0).IsFailure() { + res = (_3_valueOrError0).PropagateFailure() + return res + } + var _4_ephemeralKeyPair m_AwsCryptographyPrimitivesTypes.GenerateECCKeyPairOutput + _ = _4_ephemeralKeyPair + _4_ephemeralKeyPair = (_3_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.GenerateECCKeyPairOutput) + _0_operationSenderPrivateKey = (_4_ephemeralKeyPair).Dtor_privateKey() + _1_operationSenderPublicKey = (_4_ephemeralKeyPair).Dtor_publicKey() + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.CompressPublicKey(m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_((_1_operationSenderPublicKey).Dtor_der()), (_this).CurveSpec(), (_this).CryptoPrimitives()) + _5_valueOrError1 = _out1 + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_operationCompressedSenderPublicKey_q _dafny.Sequence + _ = _6_operationCompressedSenderPublicKey_q + _6_operationCompressedSenderPublicKey_q = (_5_valueOrError1).Extract().(_dafny.Sequence) + _2_operationCompressedSenderPublicKey = _6_operationCompressedSenderPublicKey_q + } else { + _0_operationSenderPrivateKey = (_this).SenderPrivateKey() + _1_operationSenderPublicKey = (_this).SenderPublicKey() + _2_operationCompressedSenderPublicKey = (_this).CompressedSenderPublicKey() + } + var _7_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _7_materials + _7_materials = (input).Dtor_materials() + var _8_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _8_suite + _8_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _9_valueOrError2 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = Companion_Default___.LocalDeriveSharedSecret(_0_operationSenderPrivateKey, (_this).RecipientPublicKey(), (_this).CurveSpec(), (_this).CryptoPrimitives()) + _9_valueOrError2 = _out2 + if (_9_valueOrError2).IsFailure() { + res = (_9_valueOrError2).PropagateFailure() + return res + } + var _10_sharedSecret _dafny.Sequence + _ = _10_sharedSecret + _10_sharedSecret = (_9_valueOrError2).Extract().(_dafny.Sequence) + var _11_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_UTF8.Companion_ValidUTF8Bytes_.Witness()) + _ = _11_valueOrError3 + _11_valueOrError3 = (m_UTF8.Encode(Companion_Default___.CurveSpecTypeToString((_this).CurveSpec()))).MapFailure(func(coer115 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg116 interface{}) interface{} { + return coer115(arg116.(_dafny.Sequence)) + } + }(Companion_Default___.E)) + if (_11_valueOrError3).IsFailure() { + res = (_11_valueOrError3).PropagateFailure() + return res + } + var _12_curveSpecUtf8 _dafny.Sequence + _ = _12_curveSpecUtf8 + _12_curveSpecUtf8 = (_11_valueOrError3).Extract().(_dafny.Sequence) + var _13_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _13_valueOrError4 + _13_valueOrError4 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(((input).Dtor_materials()).Dtor_encryptionContext()) + if (_13_valueOrError4).IsFailure() { + res = (_13_valueOrError4).PropagateFailure() + return res + } + var _14_canonicalizedEC _dafny.Sequence + _ = _14_canonicalizedEC + _14_canonicalizedEC = (_13_valueOrError4).Extract().(_dafny.Sequence) + var _15_fixedInfo _dafny.Sequence + _ = _15_fixedInfo + _15_fixedInfo = m_EcdhEdkWrapping.Companion_Default___.SerializeFixedInfo(m_Constants.Companion_Default___.ECDH__KDF__UTF8(), _12_curveSpecUtf8, _2_operationCompressedSenderPublicKey, (_this).CompressedRecipientPublicKey(), _14_canonicalizedEC, Companion_Default___.RAW__ECDH__KEYRING__VERSION()) + var _16_ecdhGenerateAndWrap *m_EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial + _ = _16_ecdhGenerateAndWrap + var _nw0 *m_EcdhEdkWrapping.EcdhGenerateAndWrapKeyMaterial = m_EcdhEdkWrapping.New_EcdhGenerateAndWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(_10_sharedSecret, _15_fixedInfo, (_this).CryptoPrimitives()) + _16_ecdhGenerateAndWrap = _nw0 + var _17_ecdhWrap *m_EcdhEdkWrapping.EcdhWrapKeyMaterial + _ = _17_ecdhWrap + var _nw1 *m_EcdhEdkWrapping.EcdhWrapKeyMaterial = m_EcdhEdkWrapping.New_EcdhWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__(_10_sharedSecret, _15_fixedInfo, (_this).CryptoPrimitives()) + _17_ecdhWrap = _nw1 + var _18_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(m_EcdhEdkWrapping.Companion_EcdhWrapInfo_.Default())) + _ = _18_valueOrError5 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_7_materials, _17_ecdhWrap, _16_ecdhGenerateAndWrap) + _18_valueOrError5 = _out3 + if (_18_valueOrError5).IsFailure() { + res = (_18_valueOrError5).PropagateFailure() + return res + } + var _19_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _19_wrapOutput + _19_wrapOutput = (_18_valueOrError5).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _20_symmetricSigningKeyList m_Wrappers.Option + _ = _20_symmetricSigningKeyList + if ((_19_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_19_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _20_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _21_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _21_valueOrError6 + _21_valueOrError6 = m_Wrappers.Companion_Default___.Need((Companion_Default___.ValidCompressedPublicKeyLength(_2_operationCompressedSenderPublicKey)) && (Companion_Default___.ValidCompressedPublicKeyLength((_this).CompressedRecipientPublicKey())), Companion_Default___.E(_dafny.SeqOfString("Invalid compressed public key length."))) + if (_21_valueOrError6).IsFailure() { + res = (_21_valueOrError6).PropagateFailure() + return res + } + var _22_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _22_edk + _22_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(m_Constants.Companion_Default___.RAW__ECDH__PROVIDER__ID(), Companion_Default___.SerializeProviderInfo(_2_operationCompressedSenderPublicKey, (_this).CompressedRecipientPublicKey()), (_19_wrapOutput).Dtor_wrappedMaterial()) + if (_19_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _23_valueOrError7 m_Wrappers.Result = m_Wrappers.Result{} + _ = _23_valueOrError7 + _23_valueOrError7 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_7_materials, (_19_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_22_edk), _20_symmetricSigningKeyList) + if (_23_valueOrError7).IsFailure() { + res = (_23_valueOrError7).PropagateFailure() + return res + } + var _24_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _24_result + _24_result = (_23_valueOrError7).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_24_result)) + return res + } else if (_19_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _25_valueOrError8 m_Wrappers.Result = m_Wrappers.Result{} + _ = _25_valueOrError8 + _25_valueOrError8 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_7_materials, _dafny.SeqOf(_22_edk), _20_symmetricSigningKeyList) + if (_25_valueOrError8).IsFailure() { + res = (_25_valueOrError8).PropagateFailure() + return res + } + var _26_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _26_result + _26_result = (_25_valueOrError8).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_26_result)) + return res + } + return res + } +} +func (_this *RawEcdhKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + if ((_this).KeyAgreementScheme()).Is_EphemeralPrivateKeyToStaticPublicKey() { + res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("EphemeralPrivateKeyToStaticPublicKey Key Agreement Scheme is forbidden on decrypt."))) + return res + } + var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _0_materials + _0_materials = (input).Dtor_materials() + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), Companion_Default___.E(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_operationCompressedSenderPublicKey m_Wrappers.Option + _ = _3_operationCompressedSenderPublicKey + if _dafny.Companion_Sequence_.Equal((_this).CompressedSenderPublicKey(), _dafny.SeqOf()) { + _3_operationCompressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_None_() + } else { + _3_operationCompressedSenderPublicKey = m_Wrappers.Companion_Option_.Create_Some_((_this).CompressedSenderPublicKey()) + } + var _4_filter *OnDecryptEcdhDataKeyFilter + _ = _4_filter + var _nw0 *OnDecryptEcdhDataKeyFilter = New_OnDecryptEcdhDataKeyFilter_() + _ = _nw0 + _nw0.Ctor__((_this).KeyAgreementScheme(), (_this).CompressedRecipientPublicKey(), _3_operationCompressedSenderPublicKey) + _4_filter = _nw0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_Actions.Companion_Default___.FilterWithResult(_4_filter, (input).Dtor_encryptedDataKeys()) + _5_valueOrError1 = _out0 + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_edksToAttempt _dafny.Sequence + _ = _6_edksToAttempt + _6_edksToAttempt = (_5_valueOrError1).Extract().(_dafny.Sequence) + if (_dafny.IntOfUint32((_6_edksToAttempt).Cardinality())).Sign() == 0 { + var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _7_valueOrError2 + _7_valueOrError2 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_errorMessage _dafny.Sequence + _ = _8_errorMessage + _8_errorMessage = (_7_valueOrError2).Extract().(_dafny.Sequence) + res = m_Wrappers.Companion_Result_.Create_Failure_(Companion_Default___.E(_8_errorMessage)) + return res + } + var _9_decryptClosure m_Actions.ActionWithResult + _ = _9_decryptClosure + var _nw1 *DecryptSingleEncryptedDataKey = New_DecryptSingleEncryptedDataKey_() + _ = _nw1 + _nw1.Ctor__(_0_materials, (_this).CryptoPrimitives(), (_this).CompressedSenderPublicKey(), (_this).CompressedRecipientPublicKey(), (_this).KeyAgreementScheme(), (_this).CurveSpec()) + _9_decryptClosure = _nw1 + var _10_outcome m_Wrappers.Result + _ = _10_outcome + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_Actions.Companion_Default___.ReduceToSuccess(_9_decryptClosure, _6_edksToAttempt) + _10_outcome = _out1 + var _11_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _11_valueOrError3 + _11_valueOrError3 = (_10_outcome).MapFailure(func(coer116 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg117 interface{}) interface{} { + return coer116(arg117.(_dafny.Sequence)) + } + }(func(_12_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_12_errors, _dafny.SeqOfString("No Configured Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")) + })) + if (_11_valueOrError3).IsFailure() { + res = (_11_valueOrError3).PropagateFailure() + return res + } + var _13_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _13_SealedDecryptionMaterials + _13_SealedDecryptionMaterials = (_11_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_13_SealedDecryptionMaterials)) + return res + return res + } +} +func (_this *RawEcdhKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *RawEcdhKeyring) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *RawEcdhKeyring) CurveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + { + return _this._curveSpec + } +} +func (_this *RawEcdhKeyring) RecipientPublicKey() m_AwsCryptographyPrimitivesTypes.ECCPublicKey { + { + return _this._recipientPublicKey + } +} +func (_this *RawEcdhKeyring) CompressedRecipientPublicKey() _dafny.Sequence { + { + return _this._compressedRecipientPublicKey + } +} +func (_this *RawEcdhKeyring) SenderPublicKey() m_AwsCryptographyPrimitivesTypes.ECCPublicKey { + { + return _this._senderPublicKey + } +} +func (_this *RawEcdhKeyring) SenderPrivateKey() m_AwsCryptographyPrimitivesTypes.ECCPrivateKey { + { + return _this._senderPrivateKey + } +} +func (_this *RawEcdhKeyring) CompressedSenderPublicKey() _dafny.Sequence { + { + return _this._compressedSenderPublicKey + } +} + +// End of class RawEcdhKeyring + +// Definition of class OnDecryptEcdhDataKeyFilter +type OnDecryptEcdhDataKeyFilter struct { + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations + _compressedRecipientPublicKey _dafny.Sequence + _compressedSenderPublicKey _dafny.Sequence +} + +func New_OnDecryptEcdhDataKeyFilter_() *OnDecryptEcdhDataKeyFilter { + _this := OnDecryptEcdhDataKeyFilter{} + + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_RawEcdhStaticConfigurations_.Default() + _this._compressedRecipientPublicKey = _dafny.EmptySeq + _this._compressedSenderPublicKey = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_OnDecryptEcdhDataKeyFilter_ struct { +} + +var Companion_OnDecryptEcdhDataKeyFilter_ = CompanionStruct_OnDecryptEcdhDataKeyFilter_{} + +func (_this *OnDecryptEcdhDataKeyFilter) Equals(other *OnDecryptEcdhDataKeyFilter) bool { + return _this == other +} + +func (_this *OnDecryptEcdhDataKeyFilter) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OnDecryptEcdhDataKeyFilter) + return ok && _this.Equals(other) +} + +func (*OnDecryptEcdhDataKeyFilter) String() string { + return "RawECDHKeyring.OnDecryptEcdhDataKeyFilter" +} + +func Type_OnDecryptEcdhDataKeyFilter_() _dafny.TypeDescriptor { + return type_OnDecryptEcdhDataKeyFilter_{} +} + +type type_OnDecryptEcdhDataKeyFilter_ struct { +} + +func (_this type_OnDecryptEcdhDataKeyFilter_) Default() interface{} { + return (*OnDecryptEcdhDataKeyFilter)(nil) +} + +func (_this type_OnDecryptEcdhDataKeyFilter_) String() string { + return "RawECDHKeyring.OnDecryptEcdhDataKeyFilter" +} +func (_this *OnDecryptEcdhDataKeyFilter) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} +} + +var _ m_Actions.DeterministicActionWithResult = &OnDecryptEcdhDataKeyFilter{} +var _ m_Actions.DeterministicAction = &OnDecryptEcdhDataKeyFilter{} +var _ _dafny.TraitOffspring = &OnDecryptEcdhDataKeyFilter{} + +func (_this *OnDecryptEcdhDataKeyFilter) Ctor__(keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations, compressedRecipientPublicKey _dafny.Sequence, compressedSenderPublicKey m_Wrappers.Option) { + { + (_this)._keyAgreementScheme = keyAgreementScheme + (_this)._compressedRecipientPublicKey = compressedRecipientPublicKey + if (compressedSenderPublicKey).Is_Some() { + (_this)._compressedSenderPublicKey = (compressedSenderPublicKey).Dtor_value().(_dafny.Sequence) + } else { + (_this)._compressedSenderPublicKey = _dafny.SeqOf() + } + } +} +func (_this *OnDecryptEcdhDataKeyFilter) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = res + var _0_providerInfo _dafny.Sequence + _ = _0_providerInfo + _0_providerInfo = (edk).Dtor_keyProviderInfo() + var _1_providerId _dafny.Sequence + _ = _1_providerId + _1_providerId = (edk).Dtor_keyProviderId() + if (!_dafny.Companion_Sequence_.Equal(_1_providerId, m_Constants.Companion_Default___.RAW__ECDH__PROVIDER__ID())) && (!_dafny.Companion_Sequence_.Equal(_1_providerId, m_Constants.Companion_Default___.KMS__ECDH__PROVIDER__ID())) { + res = m_Wrappers.Companion_Result_.Create_Success_(false) + return res + } + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError0 + _2_valueOrError0 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((_0_providerInfo).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__521__LEN())) <= 0) && (Companion_Default___.ValidProviderInfoLength(_0_providerInfo)), Companion_Default___.E(_dafny.SeqOfString("EDK ProviderInfo longer than expected"))) + if (_2_valueOrError0).IsFailure() { + res = (_2_valueOrError0).PropagateFailure() + return res + } + var _3_keyringVersion uint8 + _ = _3_keyringVersion + _3_keyringVersion = (_0_providerInfo).Select(0).(uint8) + var _4_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _4_valueOrError1 + _4_valueOrError1 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(_dafny.SeqOf(_3_keyringVersion), Companion_Default___.RAW__ECDH__KEYRING__VERSION()), Companion_Default___.E(_dafny.SeqOfString("Incorrect Keyring version found in provider info."))) + if (_4_valueOrError1).IsFailure() { + res = (_4_valueOrError1).PropagateFailure() + return res + } + var _5_recipientPublicKeyLength _dafny.Int + _ = _5_recipientPublicKeyLength + _5_recipientPublicKeyLength = _dafny.IntOfUint32(m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((_0_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPL__INDEX()), uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())))) + var _6_recipientPublicKeyLengthIndex _dafny.Int + _ = _6_recipientPublicKeyLengthIndex + _6_recipientPublicKeyLengthIndex = (_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())).Plus(_5_recipientPublicKeyLength) + var _7_senderPublicKeyIndex _dafny.Int + _ = _7_senderPublicKeyIndex + _7_senderPublicKeyIndex = (_6_recipientPublicKeyLengthIndex).Plus(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN()) + var _8_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError2 + _8_valueOrError2 = m_Wrappers.Companion_Default___.Need(((_6_recipientPublicKeyLengthIndex).Plus(_dafny.IntOfInt64(4))).Cmp(_dafny.IntOfUint32((_0_providerInfo).Cardinality())) < 0, Companion_Default___.E(_dafny.SeqOfString("Key Provider Info Serialization Error. Serialized length less than expected."))) + if (_8_valueOrError2).IsFailure() { + res = (_8_valueOrError2).PropagateFailure() + return res + } + var _9_providerInfoRecipientPublicKey _dafny.Sequence + _ = _9_providerInfoRecipientPublicKey + _9_providerInfoRecipientPublicKey = (_0_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX()), (_6_recipientPublicKeyLengthIndex).Uint32()) + var _10_providerInfoSenderPublicKey _dafny.Sequence + _ = _10_providerInfoSenderPublicKey + _10_providerInfoSenderPublicKey = (_0_providerInfo).Drop((_7_senderPublicKeyIndex).Uint32()) + if ((_this).KeyAgreementScheme()).Is_PublicKeyDiscovery() { + res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _9_providerInfoRecipientPublicKey)) + return res + } else { + res = m_Wrappers.Companion_Result_.Create_Success_(((_dafny.Companion_Sequence_.Equal((_this).CompressedSenderPublicKey(), _10_providerInfoSenderPublicKey)) && (_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _9_providerInfoRecipientPublicKey))) || ((_dafny.Companion_Sequence_.Equal((_this).CompressedSenderPublicKey(), _9_providerInfoRecipientPublicKey)) && (_dafny.Companion_Sequence_.Equal((_this).CompressedRecipientPublicKey(), _10_providerInfoSenderPublicKey)))) + return res + } + return res + } +} +func (_this *OnDecryptEcdhDataKeyFilter) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *OnDecryptEcdhDataKeyFilter) CompressedRecipientPublicKey() _dafny.Sequence { + { + return _this._compressedRecipientPublicKey + } +} +func (_this *OnDecryptEcdhDataKeyFilter) CompressedSenderPublicKey() _dafny.Sequence { + { + return _this._compressedSenderPublicKey + } +} + +// End of class OnDecryptEcdhDataKeyFilter + +// Definition of class DecryptSingleEncryptedDataKey +type DecryptSingleEncryptedDataKey struct { + _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _recipientPublicKey _dafny.Sequence + _senderPublicKey _dafny.Sequence + _keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations + _curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec +} + +func New_DecryptSingleEncryptedDataKey_() *DecryptSingleEncryptedDataKey { + _this := DecryptSingleEncryptedDataKey{} + + _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._recipientPublicKey = _dafny.EmptySeq + _this._senderPublicKey = _dafny.EmptySeq + _this._keyAgreementScheme = m_AwsCryptographyMaterialProvidersTypes.Companion_RawEcdhStaticConfigurations_.Default() + _this._curveSpec = m_AwsCryptographyPrimitivesTypes.Companion_ECDHCurveSpec_.Default() + return &_this +} + +type CompanionStruct_DecryptSingleEncryptedDataKey_ struct { +} + +var Companion_DecryptSingleEncryptedDataKey_ = CompanionStruct_DecryptSingleEncryptedDataKey_{} + +func (_this *DecryptSingleEncryptedDataKey) Equals(other *DecryptSingleEncryptedDataKey) bool { + return _this == other +} + +func (_this *DecryptSingleEncryptedDataKey) EqualsGeneric(x interface{}) bool { + other, ok := x.(*DecryptSingleEncryptedDataKey) + return ok && _this.Equals(other) +} + +func (*DecryptSingleEncryptedDataKey) String() string { + return "RawECDHKeyring.DecryptSingleEncryptedDataKey" +} + +func Type_DecryptSingleEncryptedDataKey_() _dafny.TypeDescriptor { + return type_DecryptSingleEncryptedDataKey_{} +} + +type type_DecryptSingleEncryptedDataKey_ struct { +} + +func (_this type_DecryptSingleEncryptedDataKey_) Default() interface{} { + return (*DecryptSingleEncryptedDataKey)(nil) +} + +func (_this type_DecryptSingleEncryptedDataKey_) String() string { + return "RawECDHKeyring.DecryptSingleEncryptedDataKey" +} +func (_this *DecryptSingleEncryptedDataKey) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_Actions.ActionWithResult = &DecryptSingleEncryptedDataKey{} +var _ m_Actions.Action = &DecryptSingleEncryptedDataKey{} +var _ _dafny.TraitOffspring = &DecryptSingleEncryptedDataKey{} + +func (_this *DecryptSingleEncryptedDataKey) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, senderPublicKey _dafny.Sequence, recipientPublicKey _dafny.Sequence, keyAgreementScheme m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations, curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec) { + { + (_this)._materials = materials + (_this)._cryptoPrimitives = cryptoPrimitives + (_this)._recipientPublicKey = recipientPublicKey + (_this)._senderPublicKey = senderPublicKey + (_this)._keyAgreementScheme = keyAgreementScheme + (_this)._curveSpec = curveSpec + } +} +func (_this *DecryptSingleEncryptedDataKey) Invoke(edk interface{}) interface{} { + { + var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + _ = edk + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderId()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Received invalid EDK provider id for AWS KMS ECDH Keyring"))) + if (_0_valueOrError0).IsFailure() { + res = (_0_valueOrError0).PropagateFailure() + return res + } + var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _1_suite + _1_suite = ((_this).Materials()).Dtor_algorithmSuite() + var _2_keyProviderId _dafny.Sequence + _ = _2_keyProviderId + _2_keyProviderId = (edk).Dtor_keyProviderId() + var _3_providerInfo _dafny.Sequence + _ = _3_providerInfo + _3_providerInfo = (edk).Dtor_keyProviderInfo() + var _4_ciphertext _dafny.Sequence + _ = _4_ciphertext + _4_ciphertext = (edk).Dtor_ciphertext() + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _5_valueOrError1 + _5_valueOrError1 = m_EdkWrapping.Companion_Default___.GetProviderWrappedMaterial(_4_ciphertext, _1_suite) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_providerWrappedMaterial _dafny.Sequence + _ = _6_providerWrappedMaterial + _6_providerWrappedMaterial = (_5_valueOrError1).Extract().(_dafny.Sequence) + var _7_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError2 + _7_valueOrError2 = m_Wrappers.Companion_Default___.Need(((_dafny.IntOfUint32((_3_providerInfo).Cardinality())).Cmp(_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__521__LEN())) <= 0) && (Companion_Default___.ValidProviderInfoLength(_3_providerInfo)), Companion_Default___.E(_dafny.SeqOfString("EDK ProviderInfo longer than expected"))) + if (_7_valueOrError2).IsFailure() { + res = (_7_valueOrError2).PropagateFailure() + return res + } + var _8_keyringVersion uint8 + _ = _8_keyringVersion + _8_keyringVersion = (_3_providerInfo).Select(0).(uint8) + var _9_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError3 + _9_valueOrError3 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(_dafny.SeqOf(_8_keyringVersion), Companion_Default___.RAW__ECDH__KEYRING__VERSION()), Companion_Default___.E(_dafny.SeqOfString("Incorrect Keyring version found in provider info."))) + if (_9_valueOrError3).IsFailure() { + res = (_9_valueOrError3).PropagateFailure() + return res + } + var _10_recipientPublicKeyLength _dafny.Int + _ = _10_recipientPublicKeyLength + _10_recipientPublicKeyLength = _dafny.IntOfUint32(m_StandardLibrary_UInt.Companion_Default___.SeqToUInt32((_3_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPL__INDEX()), uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())))) + var _11_recipientPublicKeyLengthIndex _dafny.Int + _ = _11_recipientPublicKeyLengthIndex + _11_recipientPublicKeyLengthIndex = (_dafny.IntOfUint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX())).Plus(_10_recipientPublicKeyLength) + var _12_senderPublicKeyIndex _dafny.Int + _ = _12_senderPublicKeyIndex + _12_senderPublicKeyIndex = (_11_recipientPublicKeyLengthIndex).Plus(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN()) + var _13_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _13_valueOrError4 + _13_valueOrError4 = m_Wrappers.Companion_Default___.Need(((_11_recipientPublicKeyLengthIndex).Plus(_dafny.IntOfInt64(4))).Cmp(_dafny.IntOfUint32((_3_providerInfo).Cardinality())) < 0, Companion_Default___.E(_dafny.SeqOfString("Key Provider Info Serialization Error. Serialized length less than expected."))) + if (_13_valueOrError4).IsFailure() { + res = (_13_valueOrError4).PropagateFailure() + return res + } + var _14_providerInfoRecipientPublicKey _dafny.Sequence + _ = _14_providerInfoRecipientPublicKey + _14_providerInfoRecipientPublicKey = (_3_providerInfo).Subsequence(uint32(m_Constants.Companion_Default___.ECDH__PROVIDER__INFO__RPK__INDEX()), (_11_recipientPublicKeyLengthIndex).Uint32()) + var _15_providerInfoSenderPublicKey _dafny.Sequence + _ = _15_providerInfoSenderPublicKey + _15_providerInfoSenderPublicKey = (_3_providerInfo).Drop((_12_senderPublicKeyIndex).Uint32()) + var _16_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _16_valueOrError5 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.DecompressPublicKey(_15_providerInfoSenderPublicKey, (_this).CurveSpec(), (_this).CryptoPrimitives()) + _16_valueOrError5 = _out0 + if (_16_valueOrError5).IsFailure() { + res = (_16_valueOrError5).PropagateFailure() + return res + } + var _17_senderPublicKey _dafny.Sequence + _ = _17_senderPublicKey + _17_senderPublicKey = (_16_valueOrError5).Extract().(_dafny.Sequence) + var _18_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _18_valueOrError6 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = Companion_Default___.DecompressPublicKey(_14_providerInfoRecipientPublicKey, (_this).CurveSpec(), (_this).CryptoPrimitives()) + _18_valueOrError6 = _out1 + if (_18_valueOrError6).IsFailure() { + res = (_18_valueOrError6).PropagateFailure() + return res + } + var _19_recipientPublicKey _dafny.Sequence + _ = _19_recipientPublicKey + _19_recipientPublicKey = (_18_valueOrError6).Extract().(_dafny.Sequence) + var _20_valueOrError7 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _20_valueOrError7 + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = Companion_Default___.ValidatePublicKey((_this).CryptoPrimitives(), (_this).CurveSpec(), _17_senderPublicKey) + _20_valueOrError7 = _out2 + if (_20_valueOrError7).IsFailure() { + res = (_20_valueOrError7).PropagateFailure() + return res + } + var _21___v0 bool + _ = _21___v0 + _21___v0 = (_20_valueOrError7).Extract().(bool) + var _22_valueOrError8 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _22_valueOrError8 + var _out3 m_Wrappers.Result + _ = _out3 + _out3 = Companion_Default___.ValidatePublicKey((_this).CryptoPrimitives(), (_this).CurveSpec(), _19_recipientPublicKey) + _22_valueOrError8 = _out3 + if (_22_valueOrError8).IsFailure() { + res = (_22_valueOrError8).PropagateFailure() + return res + } + var _23___v1 bool + _ = _23___v1 + _23___v1 = (_22_valueOrError8).Extract().(bool) + var _24_sharedSecretPublicKey _dafny.Sequence = _dafny.EmptySeq + _ = _24_sharedSecretPublicKey + var _25_sharedSecretPrivateKey _dafny.Sequence = _dafny.EmptySeq + _ = _25_sharedSecretPrivateKey + var _source0 m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations = (_this).KeyAgreementScheme() + _ = _source0 + { + { + if _source0.Is_PublicKeyDiscovery() { + var _26_publicKeyDiscovery m_AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations_PublicKeyDiscovery).PublicKeyDiscovery + _ = _26_publicKeyDiscovery + { + _24_sharedSecretPublicKey = _17_senderPublicKey + _25_sharedSecretPrivateKey = (_26_publicKeyDiscovery).Dtor_recipientStaticPrivateKey() + } + goto Lmatch0 + } + } + { + if _source0.Is_RawPrivateKeyToStaticPublicKey() { + var _27_rawPrivateKeyToStaticPublicKey m_AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput = _source0.Get_().(m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey).RawPrivateKeyToStaticPublicKey + _ = _27_rawPrivateKeyToStaticPublicKey + { + _25_sharedSecretPrivateKey = (_27_rawPrivateKeyToStaticPublicKey).Dtor_senderStaticPrivateKey() + if _dafny.Companion_Sequence_.Equal((_27_rawPrivateKeyToStaticPublicKey).Dtor_recipientPublicKey(), _19_recipientPublicKey) { + _24_sharedSecretPublicKey = _19_recipientPublicKey + } else { + _24_sharedSecretPublicKey = _17_senderPublicKey + } + } + goto Lmatch0 + } + } + { + { + res = m_Wrappers.Companion_Result_.Create_Failure_(Companion_Default___.E(_dafny.SeqOfString("EphemeralPrivateKeyToStaticPublicKey Not allowed on decrypt"))) + return res + } + } + goto Lmatch0 + } + Lmatch0: + var _28_valueOrError9 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) + _ = _28_valueOrError9 + var _out4 m_Wrappers.Result + _ = _out4 + _out4 = Companion_Default___.ValidatePublicKey((_this).CryptoPrimitives(), (_this).CurveSpec(), _24_sharedSecretPublicKey) + _28_valueOrError9 = _out4 + if (_28_valueOrError9).IsFailure() { + res = (_28_valueOrError9).PropagateFailure() + return res + } + var _29___v3 bool + _ = _29___v3 + _29___v3 = (_28_valueOrError9).Extract().(bool) + var _30_valueOrError10 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _30_valueOrError10 + var _out5 m_Wrappers.Result + _ = _out5 + _out5 = Companion_Default___.LocalDeriveSharedSecret(m_AwsCryptographyPrimitivesTypes.Companion_ECCPrivateKey_.Create_ECCPrivateKey_(_25_sharedSecretPrivateKey), m_AwsCryptographyPrimitivesTypes.Companion_ECCPublicKey_.Create_ECCPublicKey_(_24_sharedSecretPublicKey), (_this).CurveSpec(), (_this).CryptoPrimitives()) + _30_valueOrError10 = _out5 + if (_30_valueOrError10).IsFailure() { + res = (_30_valueOrError10).PropagateFailure() + return res + } + var _31_sharedSecret _dafny.Sequence + _ = _31_sharedSecret + _31_sharedSecret = (_30_valueOrError10).Extract().(_dafny.Sequence) + var _32_ecdhUnwrap *m_EcdhEdkWrapping.EcdhUnwrap + _ = _32_ecdhUnwrap + var _nw0 *m_EcdhEdkWrapping.EcdhUnwrap = m_EcdhEdkWrapping.New_EcdhUnwrap_() + _ = _nw0 + _nw0.Ctor__(_15_providerInfoSenderPublicKey, _14_providerInfoRecipientPublicKey, _31_sharedSecret, Companion_Default___.RAW__ECDH__KEYRING__VERSION(), (_this).CurveSpec(), (_this).CryptoPrimitives()) + _32_ecdhUnwrap = _nw0 + var _33_unwrapOutputRes m_Wrappers.Result + _ = _33_unwrapOutputRes + var _out6 m_Wrappers.Result + _ = _out6 + _out6 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _32_ecdhUnwrap) + _33_unwrapOutputRes = _out6 + var _34_valueOrError11 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_EcdhEdkWrapping.Companion_EcdhUnwrapInfo_.Default())) + _ = _34_valueOrError11 + _34_valueOrError11 = _33_unwrapOutputRes + if (_34_valueOrError11).IsFailure() { + res = (_34_valueOrError11).PropagateFailure() + return res + } + var _35_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput + _ = _35_unwrapOutput + _35_unwrapOutput = (_34_valueOrError11).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) + var _36_valueOrError12 m_Wrappers.Result = m_Wrappers.Result{} + _ = _36_valueOrError12 + _36_valueOrError12 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_35_unwrapOutput).Dtor_plaintextDataKey(), (_35_unwrapOutput).Dtor_symmetricSigningKey()) + if (_36_valueOrError12).IsFailure() { + res = (_36_valueOrError12).PropagateFailure() + return res + } + var _37_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _37_result + _37_result = (_36_valueOrError12).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + res = m_Wrappers.Companion_Result_.Create_Success_(_37_result) + return res + return res + } +} +func (_this *DecryptSingleEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + { + return _this._materials + } +} +func (_this *DecryptSingleEncryptedDataKey) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *DecryptSingleEncryptedDataKey) RecipientPublicKey() _dafny.Sequence { + { + return _this._recipientPublicKey + } +} +func (_this *DecryptSingleEncryptedDataKey) SenderPublicKey() _dafny.Sequence { + { + return _this._senderPublicKey + } +} +func (_this *DecryptSingleEncryptedDataKey) KeyAgreementScheme() m_AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations { + { + return _this._keyAgreementScheme + } +} +func (_this *DecryptSingleEncryptedDataKey) CurveSpec() m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + { + return _this._curveSpec + } +} + +// End of class DecryptSingleEncryptedDataKey diff --git a/releases/go/mpl/RawRSAKeyring/RawRSAKeyring.go b/releases/go/mpl/RawRSAKeyring/RawRSAKeyring.go new file mode 100644 index 000000000..9643a4f7c --- /dev/null +++ b/releases/go/mpl/RawRSAKeyring/RawRSAKeyring.go @@ -0,0 +1,1093 @@ +// Package RawRSAKeyring +// Dafny module RawRSAKeyring compiled into Go + +package RawRSAKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class RawRSAKeyring +type RawRSAKeyring struct { + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient + _keyNamespace _dafny.Sequence + _keyName _dafny.Sequence + _paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _publicKey m_Wrappers.Option + _privateKey m_Wrappers.Option +} + +func New_RawRSAKeyring_() *RawRSAKeyring { + _this := RawRSAKeyring{} + + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + _this._keyNamespace = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._keyName = m_UTF8.Companion_ValidUTF8Bytes_.Witness() + _this._paddingScheme = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Default() + _this._publicKey = m_Wrappers.Companion_Option_.Default() + _this._privateKey = m_Wrappers.Companion_Option_.Default() + return &_this +} + +type CompanionStruct_RawRSAKeyring_ struct { +} + +var Companion_RawRSAKeyring_ = CompanionStruct_RawRSAKeyring_{} + +func (_this *RawRSAKeyring) Equals(other *RawRSAKeyring) bool { + return _this == other +} + +func (_this *RawRSAKeyring) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RawRSAKeyring) + return ok && _this.Equals(other) +} + +func (*RawRSAKeyring) String() string { + return "RawRSAKeyring.RawRSAKeyring" +} + +func Type_RawRSAKeyring_() _dafny.TypeDescriptor { + return type_RawRSAKeyring_{} +} + +type type_RawRSAKeyring_ struct { +} + +func (_this type_RawRSAKeyring_) Default() interface{} { + return (*RawRSAKeyring)(nil) +} + +func (_this type_RawRSAKeyring_) String() string { + return "RawRSAKeyring.RawRSAKeyring" +} +func (_this *RawRSAKeyring) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} +} + +var _ m_Keyring.VerifiableInterface = &RawRSAKeyring{} +var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &RawRSAKeyring{} +var _ _dafny.TraitOffspring = &RawRSAKeyring{} + +func (_this *RawRSAKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + var _out11 m_Wrappers.Result + _ = _out11 + _out11 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) + return _out11 +} +func (_this *RawRSAKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + var _out11 m_Wrappers.Result + _ = _out11 + _out11 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) + return _out11 +} +func (_this *RawRSAKeyring) Ctor__(namespace _dafny.Sequence, name _dafny.Sequence, publicKey m_Wrappers.Option, privateKey m_Wrappers.Option, paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._keyNamespace = namespace + (_this)._keyName = name + (_this)._paddingScheme = paddingScheme + (_this)._publicKey = publicKey + (_this)._privateKey = privateKey + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *RawRSAKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((_this).PublicKey()).Is_Some()) && ((_dafny.IntOfUint32((((_this).PublicKey()).Extract().(_dafny.Sequence)).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A RawRSAKeyring without a public key cannot provide OnEncrypt"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _1_materials + _1_materials = (input).Dtor_materials() + var _2_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _2_suite + _2_suite = (_1_materials).Dtor_algorithmSuite() + var _3_wrap *RsaWrapKeyMaterial + _ = _3_wrap + var _nw0 *RsaWrapKeyMaterial = New_RsaWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _3_wrap = _nw0 + var _4_generateAndWrap *RsaGenerateAndWrapKeyMaterial + _ = _4_generateAndWrap + var _nw1 *RsaGenerateAndWrapKeyMaterial = New_RsaGenerateAndWrapKeyMaterial_() + _ = _nw1 + _nw1.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _4_generateAndWrap = _nw1 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_RsaWrapInfo_.Default())) + _ = _5_valueOrError1 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_1_materials, _3_wrap, _4_generateAndWrap) + _5_valueOrError1 = _out0 + if (_5_valueOrError1).IsFailure() { + output = (_5_valueOrError1).PropagateFailure() + return output + } + var _6_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput + _ = _6_wrapOutput + _6_wrapOutput = (_5_valueOrError1).Extract().(m_EdkWrapping.WrapEdkMaterialOutput) + var _7_symmetricSigningKeyList m_Wrappers.Option + _ = _7_symmetricSigningKeyList + if ((_6_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() { + _7_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_6_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence))) + } else { + _7_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_() + } + var _8_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _8_edk + _8_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_((_this).KeyNamespace(), (_this).KeyName(), (_6_wrapOutput).Dtor_wrappedMaterial()) + if (_6_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() { + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _9_valueOrError2 + _9_valueOrError2 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_1_materials, (_6_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_8_edk), _7_symmetricSigningKeyList) + if (_9_valueOrError2).IsFailure() { + output = (_9_valueOrError2).PropagateFailure() + return output + } + var _10_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _10_result + _10_result = (_9_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_10_result)) + return output + } else if (_6_wrapOutput).Is_WrapOnlyEdkMaterialOutput() { + var _11_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _11_valueOrError3 + _11_valueOrError3 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_1_materials, _dafny.SeqOf(_8_edk), _7_symmetricSigningKeyList) + if (_11_valueOrError3).IsFailure() { + output = (_11_valueOrError3).PropagateFailure() + return output + } + var _12_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials + _ = _12_result + _12_result = (_11_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_12_result)) + return output + } + return output + } +} +func (_this *RawRSAKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need((((_this).PrivateKey()).Is_Some()) && ((_dafny.IntOfUint32((((_this).PrivateKey()).Extract().(_dafny.Sequence)).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("A RawRSAKeyring without a private key cannot provide OnEncrypt"))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _1_materials + _1_materials = (input).Dtor_materials() + var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError1 + _2_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_1_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _3_errors _dafny.Sequence + _ = _3_errors + _3_errors = _dafny.SeqOf() + var _hi0 _dafny.Int = _dafny.IntOfUint32(((input).Dtor_encryptedDataKeys()).Cardinality()) + _ = _hi0 + for _4_i := _dafny.Zero; _4_i.Cmp(_hi0) < 0; _4_i = _4_i.Plus(_dafny.One) { + if (_this).ShouldDecryptEDK(((input).Dtor_encryptedDataKeys()).Select((_4_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)) { + var _5_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey + _ = _5_edk + _5_edk = ((input).Dtor_encryptedDataKeys()).Select((_4_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) + var _6_unwrap *RsaUnwrapKeyMaterial + _ = _6_unwrap + var _nw0 *RsaUnwrapKeyMaterial = New_RsaUnwrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__(((_this).PrivateKey()).Extract().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _6_unwrap = _nw0 + var _7_unwrapOutput m_Wrappers.Result + _ = _7_unwrapOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((_5_edk).Dtor_ciphertext(), _1_materials, _6_unwrap) + _7_unwrapOutput = _out0 + if (_7_unwrapOutput).Is_Success() { + var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _8_valueOrError2 + _8_valueOrError2 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey(_1_materials, ((_7_unwrapOutput).Dtor_value().(m_EdkWrapping.UnwrapEdkMaterialOutput)).Dtor_plaintextDataKey(), ((_7_unwrapOutput).Dtor_value().(m_EdkWrapping.UnwrapEdkMaterialOutput)).Dtor_symmetricSigningKey()) + if (_8_valueOrError2).IsFailure() { + output = (_8_valueOrError2).PropagateFailure() + return output + } + var _9_returnMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials + _ = _9_returnMaterials + _9_returnMaterials = (_8_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) + output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_9_returnMaterials)) + return output + } else { + _3_errors = _dafny.Companion_Sequence_.Concatenate(_3_errors, _dafny.SeqOf((_7_unwrapOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error))) + } + } else { + var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) + _ = _10_valueOrError3 + _10_valueOrError3 = (m_UTF8.Decode((((input).Dtor_encryptedDataKeys()).Select((_4_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)).Dtor_keyProviderId())).MapFailure(func(coer125 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg126 interface{}) interface{} { + return coer125(arg126.(_dafny.Sequence)) + } + }(func(_11_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_11_e) + })) + if (_10_valueOrError3).IsFailure() { + output = (_10_valueOrError3).PropagateFailure() + return output + } + var _12_extractedKeyProviderId _dafny.Sequence + _ = _12_extractedKeyProviderId + _12_extractedKeyProviderId = (_10_valueOrError3).Extract().(_dafny.Sequence) + _3_errors = _dafny.Companion_Sequence_.Concatenate(_3_errors, _dafny.SeqOf(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(m_ErrorMessages.Companion_Default___.IncorrectRawDataKeys(m_StandardLibrary_String.Companion_Default___.Base10Int2String(_4_i), _dafny.SeqOfString("RSAKeyring"), _12_extractedKeyProviderId)))) + } + } + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_3_errors, _dafny.SeqOfString("Raw RSA Key was unable to decrypt any encrypted data key. The list of encountered Exceptions is avaible via `list`."))) + return output + return output + } +} +func (_this *RawRSAKeyring) ShouldDecryptEDK(edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) bool { + { + return (((m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo())) && (_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderInfo(), (_this).KeyName()))) && (_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), (_this).KeyNamespace()))) && ((_dafny.IntOfUint32(((edk).Dtor_ciphertext()).Cardinality())).Sign() == 1) + } +} +func (_this *RawRSAKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} +func (_this *RawRSAKeyring) KeyNamespace() _dafny.Sequence { + { + return _this._keyNamespace + } +} +func (_this *RawRSAKeyring) KeyName() _dafny.Sequence { + { + return _this._keyName + } +} +func (_this *RawRSAKeyring) PaddingScheme() m_AwsCryptographyPrimitivesTypes.RSAPaddingMode { + { + return _this._paddingScheme + } +} +func (_this *RawRSAKeyring) PublicKey() m_Wrappers.Option { + { + return _this._publicKey + } +} +func (_this *RawRSAKeyring) PrivateKey() m_Wrappers.Option { + { + return _this._privateKey + } +} + +// End of class RawRSAKeyring + +// Definition of datatype RsaUnwrapInfo +type RsaUnwrapInfo struct { + Data_RsaUnwrapInfo_ +} + +func (_this RsaUnwrapInfo) Get_() Data_RsaUnwrapInfo_ { + return _this.Data_RsaUnwrapInfo_ +} + +type Data_RsaUnwrapInfo_ interface { + isRsaUnwrapInfo() +} + +type CompanionStruct_RsaUnwrapInfo_ struct { +} + +var Companion_RsaUnwrapInfo_ = CompanionStruct_RsaUnwrapInfo_{} + +type RsaUnwrapInfo_RsaUnwrapInfo struct { +} + +func (RsaUnwrapInfo_RsaUnwrapInfo) isRsaUnwrapInfo() {} + +func (CompanionStruct_RsaUnwrapInfo_) Create_RsaUnwrapInfo_() RsaUnwrapInfo { + return RsaUnwrapInfo{RsaUnwrapInfo_RsaUnwrapInfo{}} +} + +func (_this RsaUnwrapInfo) Is_RsaUnwrapInfo() bool { + _, ok := _this.Get_().(RsaUnwrapInfo_RsaUnwrapInfo) + return ok +} + +func (CompanionStruct_RsaUnwrapInfo_) Default() RsaUnwrapInfo { + return Companion_RsaUnwrapInfo_.Create_RsaUnwrapInfo_() +} + +func (_ CompanionStruct_RsaUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_RsaUnwrapInfo_.Create_RsaUnwrapInfo_(), true + default: + return RsaUnwrapInfo{}, false + } + } +} + +func (_this RsaUnwrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case RsaUnwrapInfo_RsaUnwrapInfo: + { + return "RawRSAKeyring.RsaUnwrapInfo.RsaUnwrapInfo" + } + default: + { + return "" + } + } +} + +func (_this RsaUnwrapInfo) Equals(other RsaUnwrapInfo) bool { + switch _this.Get_().(type) { + case RsaUnwrapInfo_RsaUnwrapInfo: + { + _, ok := other.Get_().(RsaUnwrapInfo_RsaUnwrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this RsaUnwrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(RsaUnwrapInfo) + return ok && _this.Equals(typed) +} + +func Type_RsaUnwrapInfo_() _dafny.TypeDescriptor { + return type_RsaUnwrapInfo_{} +} + +type type_RsaUnwrapInfo_ struct { +} + +func (_this type_RsaUnwrapInfo_) Default() interface{} { + return Companion_RsaUnwrapInfo_.Default() +} + +func (_this type_RsaUnwrapInfo_) String() string { + return "RawRSAKeyring.RsaUnwrapInfo" +} +func (_this RsaUnwrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = RsaUnwrapInfo{} + +// End of datatype RsaUnwrapInfo + +// Definition of datatype RsaWrapInfo +type RsaWrapInfo struct { + Data_RsaWrapInfo_ +} + +func (_this RsaWrapInfo) Get_() Data_RsaWrapInfo_ { + return _this.Data_RsaWrapInfo_ +} + +type Data_RsaWrapInfo_ interface { + isRsaWrapInfo() +} + +type CompanionStruct_RsaWrapInfo_ struct { +} + +var Companion_RsaWrapInfo_ = CompanionStruct_RsaWrapInfo_{} + +type RsaWrapInfo_RsaWrapInfo struct { +} + +func (RsaWrapInfo_RsaWrapInfo) isRsaWrapInfo() {} + +func (CompanionStruct_RsaWrapInfo_) Create_RsaWrapInfo_() RsaWrapInfo { + return RsaWrapInfo{RsaWrapInfo_RsaWrapInfo{}} +} + +func (_this RsaWrapInfo) Is_RsaWrapInfo() bool { + _, ok := _this.Get_().(RsaWrapInfo_RsaWrapInfo) + return ok +} + +func (CompanionStruct_RsaWrapInfo_) Default() RsaWrapInfo { + return Companion_RsaWrapInfo_.Create_RsaWrapInfo_() +} + +func (_ CompanionStruct_RsaWrapInfo_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_RsaWrapInfo_.Create_RsaWrapInfo_(), true + default: + return RsaWrapInfo{}, false + } + } +} + +func (_this RsaWrapInfo) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case RsaWrapInfo_RsaWrapInfo: + { + return "RawRSAKeyring.RsaWrapInfo.RsaWrapInfo" + } + default: + { + return "" + } + } +} + +func (_this RsaWrapInfo) Equals(other RsaWrapInfo) bool { + switch _this.Get_().(type) { + case RsaWrapInfo_RsaWrapInfo: + { + _, ok := other.Get_().(RsaWrapInfo_RsaWrapInfo) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this RsaWrapInfo) EqualsGeneric(other interface{}) bool { + typed, ok := other.(RsaWrapInfo) + return ok && _this.Equals(typed) +} + +func Type_RsaWrapInfo_() _dafny.TypeDescriptor { + return type_RsaWrapInfo_{} +} + +type type_RsaWrapInfo_ struct { +} + +func (_this type_RsaWrapInfo_) Default() interface{} { + return Companion_RsaWrapInfo_.Default() +} + +func (_this type_RsaWrapInfo_) String() string { + return "RawRSAKeyring.RsaWrapInfo" +} +func (_this RsaWrapInfo) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = RsaWrapInfo{} + +// End of datatype RsaWrapInfo + +// Definition of class RsaGenerateAndWrapKeyMaterial +type RsaGenerateAndWrapKeyMaterial struct { + _publicKey _dafny.Sequence + _paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_RsaGenerateAndWrapKeyMaterial_() *RsaGenerateAndWrapKeyMaterial { + _this := RsaGenerateAndWrapKeyMaterial{} + + _this._publicKey = _dafny.EmptySeq + _this._paddingScheme = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Default() + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_RsaGenerateAndWrapKeyMaterial_ struct { +} + +var Companion_RsaGenerateAndWrapKeyMaterial_ = CompanionStruct_RsaGenerateAndWrapKeyMaterial_{} + +func (_this *RsaGenerateAndWrapKeyMaterial) Equals(other *RsaGenerateAndWrapKeyMaterial) bool { + return _this == other +} + +func (_this *RsaGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RsaGenerateAndWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*RsaGenerateAndWrapKeyMaterial) String() string { + return "RawRSAKeyring.RsaGenerateAndWrapKeyMaterial" +} + +func Type_RsaGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_RsaGenerateAndWrapKeyMaterial_{} +} + +type type_RsaGenerateAndWrapKeyMaterial_ struct { +} + +func (_this type_RsaGenerateAndWrapKeyMaterial_) Default() interface{} { + return (*RsaGenerateAndWrapKeyMaterial)(nil) +} + +func (_this type_RsaGenerateAndWrapKeyMaterial_) String() string { + return "RawRSAKeyring.RsaGenerateAndWrapKeyMaterial" +} +func (_this *RsaGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.GenerateAndWrapMaterial = &RsaGenerateAndWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &RsaGenerateAndWrapKeyMaterial{} +var _ m_Actions.Action = &RsaGenerateAndWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &RsaGenerateAndWrapKeyMaterial{} + +func (_this *RsaGenerateAndWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._publicKey = publicKey + (_this)._paddingScheme = paddingScheme + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *RsaGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_RsaWrapInfo_.Default())) + _ = res + var _0_generateBytesResult m_Wrappers.Result + _ = _0_generateBytesResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite()))) + _0_generateBytesResult = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_generateBytesResult).MapFailure(func(coer126 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg127 interface{}) interface{} { + return coer126(arg127.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_plaintextMaterial _dafny.Sequence + _ = _3_plaintextMaterial + _3_plaintextMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence) + var _4_wrap *RsaWrapKeyMaterial + _ = _4_wrap + var _nw0 *RsaWrapKeyMaterial = New_RsaWrapKeyMaterial_() + _ = _nw0 + _nw0.Ctor__((_this).PublicKey(), (_this).PaddingScheme(), (_this).CryptoPrimitives()) + _4_wrap = _nw0 + var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_RsaWrapInfo_.Default())) + _ = _5_valueOrError1 + var _out1 interface{} + _ = _out1 + _out1 = (_4_wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_3_plaintextMaterial, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext())) + _5_valueOrError1 = _out1.(m_Wrappers.Result) + if (_5_valueOrError1).IsFailure() { + res = (_5_valueOrError1).PropagateFailure() + return res + } + var _6_wrapOutput m_MaterialWrapping.WrapOutput + _ = _6_wrapOutput + _6_wrapOutput = (_5_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput) + var _7_output m_MaterialWrapping.GenerateAndWrapOutput + _ = _7_output + _7_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_3_plaintextMaterial, (_6_wrapOutput).Dtor_wrappedMaterial(), Companion_RsaWrapInfo_.Create_RsaWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_7_output) + return res + return res + } +} +func (_this *RsaGenerateAndWrapKeyMaterial) PublicKey() _dafny.Sequence { + { + return _this._publicKey + } +} +func (_this *RsaGenerateAndWrapKeyMaterial) PaddingScheme() m_AwsCryptographyPrimitivesTypes.RSAPaddingMode { + { + return _this._paddingScheme + } +} +func (_this *RsaGenerateAndWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class RsaGenerateAndWrapKeyMaterial + +// Definition of class RsaWrapKeyMaterial +type RsaWrapKeyMaterial struct { + _publicKey _dafny.Sequence + _paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_RsaWrapKeyMaterial_() *RsaWrapKeyMaterial { + _this := RsaWrapKeyMaterial{} + + _this._publicKey = _dafny.EmptySeq + _this._paddingScheme = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Default() + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_RsaWrapKeyMaterial_ struct { +} + +var Companion_RsaWrapKeyMaterial_ = CompanionStruct_RsaWrapKeyMaterial_{} + +func (_this *RsaWrapKeyMaterial) Equals(other *RsaWrapKeyMaterial) bool { + return _this == other +} + +func (_this *RsaWrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RsaWrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*RsaWrapKeyMaterial) String() string { + return "RawRSAKeyring.RsaWrapKeyMaterial" +} + +func Type_RsaWrapKeyMaterial_() _dafny.TypeDescriptor { + return type_RsaWrapKeyMaterial_{} +} + +type type_RsaWrapKeyMaterial_ struct { +} + +func (_this type_RsaWrapKeyMaterial_) Default() interface{} { + return (*RsaWrapKeyMaterial)(nil) +} + +func (_this type_RsaWrapKeyMaterial_) String() string { + return "RawRSAKeyring.RsaWrapKeyMaterial" +} +func (_this *RsaWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.WrapMaterial = &RsaWrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &RsaWrapKeyMaterial{} +var _ m_Actions.Action = &RsaWrapKeyMaterial{} +var _ _dafny.TraitOffspring = &RsaWrapKeyMaterial{} + +func (_this *RsaWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._publicKey = publicKey + (_this)._paddingScheme = paddingScheme + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *RsaWrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_RsaWrapInfo_.Default())) + _ = res + var _0_RSAEncryptOutput m_Wrappers.Result + _ = _0_RSAEncryptOutput + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).RSAEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_RSAEncryptInput_.Create_RSAEncryptInput_((_this).PaddingScheme(), (_this).PublicKey(), (input).Dtor_plaintextMaterial())) + _0_RSAEncryptOutput = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_RSAEncryptOutput).MapFailure(func(coer127 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg128 interface{}) interface{} { + return coer127(arg128.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_ciphertext _dafny.Sequence + _ = _3_ciphertext + _3_ciphertext = (_1_valueOrError0).Extract().(_dafny.Sequence) + var _4_output m_MaterialWrapping.WrapOutput + _ = _4_output + _4_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_3_ciphertext, Companion_RsaWrapInfo_.Create_RsaWrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_4_output) + return res + return res + } +} +func (_this *RsaWrapKeyMaterial) PublicKey() _dafny.Sequence { + { + return _this._publicKey + } +} +func (_this *RsaWrapKeyMaterial) PaddingScheme() m_AwsCryptographyPrimitivesTypes.RSAPaddingMode { + { + return _this._paddingScheme + } +} +func (_this *RsaWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class RsaWrapKeyMaterial + +// Definition of class RsaUnwrapKeyMaterial +type RsaUnwrapKeyMaterial struct { + _privateKey _dafny.Sequence + _paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode + _cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient +} + +func New_RsaUnwrapKeyMaterial_() *RsaUnwrapKeyMaterial { + _this := RsaUnwrapKeyMaterial{} + + _this._privateKey = _dafny.EmptySeq + _this._paddingScheme = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Default() + _this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil) + return &_this +} + +type CompanionStruct_RsaUnwrapKeyMaterial_ struct { +} + +var Companion_RsaUnwrapKeyMaterial_ = CompanionStruct_RsaUnwrapKeyMaterial_{} + +func (_this *RsaUnwrapKeyMaterial) Equals(other *RsaUnwrapKeyMaterial) bool { + return _this == other +} + +func (_this *RsaUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RsaUnwrapKeyMaterial) + return ok && _this.Equals(other) +} + +func (*RsaUnwrapKeyMaterial) String() string { + return "RawRSAKeyring.RsaUnwrapKeyMaterial" +} + +func Type_RsaUnwrapKeyMaterial_() _dafny.TypeDescriptor { + return type_RsaUnwrapKeyMaterial_{} +} + +type type_RsaUnwrapKeyMaterial_ struct { +} + +func (_this type_RsaUnwrapKeyMaterial_) Default() interface{} { + return (*RsaUnwrapKeyMaterial)(nil) +} + +func (_this type_RsaUnwrapKeyMaterial_) String() string { + return "RawRSAKeyring.RsaUnwrapKeyMaterial" +} +func (_this *RsaUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} +} + +var _ m_MaterialWrapping.UnwrapMaterial = &RsaUnwrapKeyMaterial{} +var _ m_Actions.ActionWithResult = &RsaUnwrapKeyMaterial{} +var _ m_Actions.Action = &RsaUnwrapKeyMaterial{} +var _ _dafny.TraitOffspring = &RsaUnwrapKeyMaterial{} + +func (_this *RsaUnwrapKeyMaterial) Ctor__(privateKey _dafny.Sequence, paddingScheme m_AwsCryptographyPrimitivesTypes.RSAPaddingMode, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) { + { + (_this)._privateKey = privateKey + (_this)._paddingScheme = paddingScheme + (_this)._cryptoPrimitives = cryptoPrimitives + } +} +func (_this *RsaUnwrapKeyMaterial) Invoke(input interface{}) interface{} { + { + var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput) + _ = input + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_RsaUnwrapInfo_.Default())) + _ = res + var _0_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo + _ = _0_suite + _0_suite = (input).Dtor_algorithmSuite() + var _1_wrappedMaterial _dafny.Sequence + _ = _1_wrappedMaterial + _1_wrappedMaterial = (input).Dtor_wrappedMaterial() + var _2_aad _dafny.Map + _ = _2_aad + _2_aad = (input).Dtor_encryptionContext() + var _3_maybeDecryptResult m_Wrappers.Result + _ = _3_maybeDecryptResult + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).CryptoPrimitives()).RSADecrypt(m_AwsCryptographyPrimitivesTypes.Companion_RSADecryptInput_.Create_RSADecryptInput_((_this).PaddingScheme(), (_this).PrivateKey(), _1_wrappedMaterial)) + _3_maybeDecryptResult = _out0 + var _4_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _4_valueOrError0 + _4_valueOrError0 = (_3_maybeDecryptResult).MapFailure(func(coer128 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg129 interface{}) interface{} { + return coer128(arg129.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e) + })) + if (_4_valueOrError0).IsFailure() { + res = (_4_valueOrError0).PropagateFailure() + return res + } + var _6_decryptResult _dafny.Sequence + _ = _6_decryptResult + _6_decryptResult = (_4_valueOrError0).Extract().(_dafny.Sequence) + var _7_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _7_valueOrError1 + _7_valueOrError1 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_6_decryptResult).Cardinality())).Cmp(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(_0_suite))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid plaintext length."))) + if (_7_valueOrError1).IsFailure() { + res = (_7_valueOrError1).PropagateFailure() + return res + } + var _8_output m_MaterialWrapping.UnwrapOutput + _ = _8_output + _8_output = m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(_6_decryptResult, Companion_RsaUnwrapInfo_.Create_RsaUnwrapInfo_()) + res = m_Wrappers.Companion_Result_.Create_Success_(_8_output) + return res + return res + } +} +func (_this *RsaUnwrapKeyMaterial) PrivateKey() _dafny.Sequence { + { + return _this._privateKey + } +} +func (_this *RsaUnwrapKeyMaterial) PaddingScheme() m_AwsCryptographyPrimitivesTypes.RSAPaddingMode { + { + return _this._paddingScheme + } +} +func (_this *RsaUnwrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient { + { + return _this._cryptoPrimitives + } +} + +// End of class RsaUnwrapKeyMaterial diff --git a/releases/go/mpl/RequiredEncryptionContextCMM/RequiredEncryptionContextCMM.go b/releases/go/mpl/RequiredEncryptionContextCMM/RequiredEncryptionContextCMM.go new file mode 100644 index 000000000..b71f8740e --- /dev/null +++ b/releases/go/mpl/RequiredEncryptionContextCMM/RequiredEncryptionContextCMM.go @@ -0,0 +1,470 @@ +// Package RequiredEncryptionContextCMM +// Dafny module RequiredEncryptionContextCMM compiled into Go + +package RequiredEncryptionContextCMM + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DefaultCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultCMM" + m_DefaultClientSupplier "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultClientSupplier" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_Utils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Utils" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_SortedSets "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/SortedSets" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ +var _ m_DefaultCMM.Dummy__ +var _ m_DefaultClientSupplier.Dummy__ +var _ m_Utils.Dummy__ + +type Dummy__ struct{} + +// Definition of class RequiredEncryptionContextCMM +type RequiredEncryptionContextCMM struct { + _underlyingCMM m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + _requiredEncryptionContextKeys _dafny.Sequence +} + +func New_RequiredEncryptionContextCMM_() *RequiredEncryptionContextCMM { + _this := RequiredEncryptionContextCMM{} + + _this._underlyingCMM = (m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager)(nil) + _this._requiredEncryptionContextKeys = _dafny.EmptySeq + return &_this +} + +type CompanionStruct_RequiredEncryptionContextCMM_ struct { +} + +var Companion_RequiredEncryptionContextCMM_ = CompanionStruct_RequiredEncryptionContextCMM_{} + +func (_this *RequiredEncryptionContextCMM) Equals(other *RequiredEncryptionContextCMM) bool { + return _this == other +} + +func (_this *RequiredEncryptionContextCMM) EqualsGeneric(x interface{}) bool { + other, ok := x.(*RequiredEncryptionContextCMM) + return ok && _this.Equals(other) +} + +func (*RequiredEncryptionContextCMM) String() string { + return "RequiredEncryptionContextCMM.RequiredEncryptionContextCMM" +} + +func Type_RequiredEncryptionContextCMM_() _dafny.TypeDescriptor { + return type_RequiredEncryptionContextCMM_{} +} + +type type_RequiredEncryptionContextCMM_ struct { +} + +func (_this type_RequiredEncryptionContextCMM_) Default() interface{} { + return (*RequiredEncryptionContextCMM)(nil) +} + +func (_this type_RequiredEncryptionContextCMM_) String() string { + return "RequiredEncryptionContextCMM.RequiredEncryptionContextCMM" +} +func (_this *RequiredEncryptionContextCMM) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_CMM.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.TraitID_} +} + +var _ m_CMM.VerifiableInterface = &RequiredEncryptionContextCMM{} +var _ m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager = &RequiredEncryptionContextCMM{} +var _ _dafny.TraitOffspring = &RequiredEncryptionContextCMM{} + +func (_this *RequiredEncryptionContextCMM) DecryptMaterials(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result { + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.DecryptMaterials(_this, input) + return _out2 +} +func (_this *RequiredEncryptionContextCMM) GetEncryptionMaterials(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result { + var _out2 m_Wrappers.Result + _ = _out2 + _out2 = m_AwsCryptographyMaterialProvidersTypes.Companion_ICryptographicMaterialsManager_.GetEncryptionMaterials(_this, input) + return _out2 +} +func (_this *RequiredEncryptionContextCMM) Ctor__(inputCMM m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager, inputKeys _dafny.Set) { + { + var _0_keySet _dafny.Set + _ = _0_keySet + _0_keySet = inputKeys + var _1_keySeq _dafny.Sequence + _ = _1_keySeq + var _out0 _dafny.Sequence + _ = _out0 + _out0 = m_SortedSets.SetToSequence(_0_keySet) + _1_keySeq = _out0 + (_this)._underlyingCMM = inputCMM + (_this)._requiredEncryptionContextKeys = _1_keySeq + } +} +func (_this *RequiredEncryptionContextCMM) GetEncryptionMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((_this).RequiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _1_k _dafny.Sequence + _1_k = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_1_k) { + return !(_dafny.Companion_Sequence_.Contains((_this).RequiredEncryptionContextKeys(), _1_k)) || (((input).Dtor_encryptionContext()).Contains(_1_k)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context does not contain required keys."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _2_valueOrError1 + var _pat_let_tv0 = input + _ = _pat_let_tv0 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).UnderlyingCMM()).GetEncryptionMaterials(func(_pat_let8_0 m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + return func(_3_dt__update__tmp_h0 m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + return func(_pat_let9_0 m_Wrappers.Option) m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + return func(_4_dt__update_hrequiredEncryptionContextKeys_h0 m_Wrappers.Option) m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + return m_AwsCryptographyMaterialProvidersTypes.Companion_GetEncryptionMaterialsInput_.Create_GetEncryptionMaterialsInput_((_3_dt__update__tmp_h0).Dtor_encryptionContext(), (_3_dt__update__tmp_h0).Dtor_commitmentPolicy(), (_3_dt__update__tmp_h0).Dtor_algorithmSuiteId(), (_3_dt__update__tmp_h0).Dtor_maxPlaintextLength(), _4_dt__update_hrequiredEncryptionContextKeys_h0) + }(_pat_let9_0) + }(m_Wrappers.Companion_Option_.Create_Some_(_dafny.Companion_Sequence_.Concatenate(((_pat_let_tv0).Dtor_requiredEncryptionContextKeys()).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence), (_this).RequiredEncryptionContextKeys()))) + }(_pat_let8_0) + }(input)) + _2_valueOrError1 = _out0 + if (_2_valueOrError1).IsFailure() { + output = (_2_valueOrError1).PropagateFailure() + return output + } + var _5_result m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput + _ = _5_result + _5_result = (_2_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput) + var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError2 + _6_valueOrError2 = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((_this).RequiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_1 _dafny.Sequence) bool { + var _7_k _dafny.Sequence + _7_k = interface{}(_forall_var_1).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_7_k) { + return !(_dafny.Companion_Sequence_.Contains((_this).RequiredEncryptionContextKeys(), _7_k)) || (_dafny.Companion_Sequence_.Contains(((_5_result).Dtor_encryptionMaterials()).Dtor_requiredEncryptionContextKeys(), _7_k)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Expected encryption context keys do not exist in keys to only authenticate."))) + if (_6_valueOrError2).IsFailure() { + output = (_6_valueOrError2).PropagateFailure() + return output + } + var _8_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError3 + _8_valueOrError3 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.EncryptionMaterialsHasPlaintextDataKey((_5_result).Dtor_encryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Could not retrieve materials required for encryption"))) + if (_8_valueOrError3).IsFailure() { + output = (_8_valueOrError3).PropagateFailure() + return output + } + var _9_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError4 + _9_valueOrError4 = m_Wrappers.Companion_Default___.Need(m_CMM.Companion_Default___.RequiredEncryptionContextKeys_q((input).Dtor_requiredEncryptionContextKeys(), (_5_result).Dtor_encryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring returned an invalid response"))) + if (_9_valueOrError4).IsFailure() { + output = (_9_valueOrError4).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(_5_result) + return output + } +} +func (_this *RequiredEncryptionContextCMM) DecryptMaterials_k(input m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _0_valueOrError0 + _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(((input).Dtor_reproducedEncryptionContext()).Is_Some(), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("No reproduced encryption context on decrypt."))) + if (_0_valueOrError0).IsFailure() { + output = (_0_valueOrError0).PropagateFailure() + return output + } + var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _1_valueOrError1 + _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_CMM.Companion_Default___.ReproducedEncryptionContext_q(input), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption context does not match reproduced encryption context."))) + if (_1_valueOrError1).IsFailure() { + output = (_1_valueOrError1).PropagateFailure() + return output + } + var _2_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _2_valueOrError2 + _2_valueOrError2 = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((_this).RequiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _3_k _dafny.Sequence + _3_k = interface{}(_forall_var_0).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_3_k) { + return !(_dafny.Companion_Sequence_.Contains((_this).RequiredEncryptionContextKeys(), _3_k)) || ((((input).Dtor_reproducedEncryptionContext()).Dtor_value().(_dafny.Map)).Contains(_3_k)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Reproduced encryption context missing required keys."))) + if (_2_valueOrError2).IsFailure() { + output = (_2_valueOrError2).PropagateFailure() + return output + } + var _4_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _4_valueOrError3 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = ((_this).UnderlyingCMM()).DecryptMaterials(input) + _4_valueOrError3 = _out0 + if (_4_valueOrError3).IsFailure() { + output = (_4_valueOrError3).PropagateFailure() + return output + } + var _5_result m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput + _ = _5_result + _5_result = (_4_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput) + var _6_valueOrError4 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _6_valueOrError4 + _6_valueOrError4 = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier(((_this).RequiredEncryptionContextKeys()).UniqueElements(), true, func(_forall_var_1 _dafny.Sequence) bool { + var _7_k _dafny.Sequence + _7_k = interface{}(_forall_var_1).(_dafny.Sequence) + if m_UTF8.Companion_ValidUTF8Bytes_.Is_(_7_k) { + return !(_dafny.Companion_Sequence_.Contains((_this).RequiredEncryptionContextKeys(), _7_k)) || ((((_5_result).Dtor_decryptionMaterials()).Dtor_encryptionContext()).Contains(_7_k)) + } else { + return true + } + }), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Final encryption context missing required keys."))) + if (_6_valueOrError4).IsFailure() { + output = (_6_valueOrError4).PropagateFailure() + return output + } + var _8_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _8_valueOrError5 + _8_valueOrError5 = m_Wrappers.Companion_Default___.Need(m_CMM.Companion_Default___.EncryptionContextComplete(input, (_5_result).Dtor_decryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Reproduced encryption context missing from encryption context."))) + if (_8_valueOrError5).IsFailure() { + output = (_8_valueOrError5).PropagateFailure() + return output + } + var _9_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _9_valueOrError6 + _9_valueOrError6 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithPlaintextDataKey((_5_result).Dtor_decryptionMaterials()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring.OnDecrypt failed to decrypt the plaintext data key."))) + if (_9_valueOrError6).IsFailure() { + output = (_9_valueOrError6).PropagateFailure() + return output + } + output = m_Wrappers.Companion_Result_.Create_Success_(_5_result) + return output + return output + } +} +func (_this *RequiredEncryptionContextCMM) UnderlyingCMM() m_AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager { + { + return _this._underlyingCMM + } +} +func (_this *RequiredEncryptionContextCMM) RequiredEncryptionContextKeys() _dafny.Sequence { + { + return _this._requiredEncryptionContextKeys + } +} + +// End of class RequiredEncryptionContextCMM diff --git a/releases/go/mpl/StormTracker/StormTracker.go b/releases/go/mpl/StormTracker/StormTracker.go new file mode 100644 index 000000000..a1a7349ba --- /dev/null +++ b/releases/go/mpl/StormTracker/StormTracker.go @@ -0,0 +1,729 @@ +// Package StormTracker +// Dafny module StormTracker compiled into Go + +package StormTracker + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DafnyLibraries "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DafnyLibraries" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_SortedSets "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/SortedSets" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m__Time "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Time_" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "StormTracker.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DefaultStorm() m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache { + return m_AwsCryptographyMaterialProvidersTypes.Companion_StormTrackingCache_.Create_StormTrackingCache_(int32(1000), m_Wrappers.Companion_Option_.Create_Some_(int32(1)), (int32(10))*(int32(1000)), (int32(1))*(int32(1000)), int32(20), (int32(10))*(int32(1000)), int32(20), m_Wrappers.Companion_Option_.Create_Some_(m_AwsCryptographyMaterialProvidersTypes.Companion_TimeUnits_.Create_Milliseconds_())) +} +func (_static *CompanionStruct_Default___) ConsistentSettings(cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache) bool { + return ((((cache).Dtor_graceInterval()) <= ((cache).Dtor_gracePeriod())) && (((cache).Dtor_inFlightTTL()) <= ((cache).Dtor_gracePeriod()))) && (((cache).Dtor_graceInterval()) <= ((cache).Dtor_inFlightTTL())) +} +func (_static *CompanionStruct_Default___) N(n int32) _dafny.Sequence { + return m_StandardLibrary_String.Companion_Default___.Base10Int2String(_dafny.IntOfInt32(n)) +} +func (_static *CompanionStruct_Default___) BadCacheMsg(cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache) _dafny.Sequence { + var _0_msg _dafny.Sequence = _dafny.SeqOfString("For a StormCache : ") + _ = _0_msg + var _1_msg _dafny.Sequence = _dafny.Companion_Sequence_.Concatenate(_0_msg, (func() _dafny.Sequence { + if !(((cache).Dtor_graceInterval()) <= ((cache).Dtor_gracePeriod())) { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("graceInterval must not exceed gracePeriod, yet configuration has graceInterval="), Companion_Default___.N((cache).Dtor_graceInterval())), _dafny.SeqOfString(" and gracePeriod=")), Companion_Default___.N((cache).Dtor_gracePeriod())), _dafny.SeqOfString(". ")) + } + return _dafny.SeqOfString("") + })()) + _ = _1_msg + var _2_msg _dafny.Sequence = _dafny.Companion_Sequence_.Concatenate(_1_msg, (func() _dafny.Sequence { + if !(((cache).Dtor_inFlightTTL()) <= ((cache).Dtor_gracePeriod())) { + return _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate(_dafny.SeqOfString("inFlightTTL must not exceed gracePeriod, yet configuration has inFlightTTL="), Companion_Default___.N((cache).Dtor_inFlightTTL())), _dafny.SeqOfString(" and gracePeriod=")), Companion_Default___.N((cache).Dtor_gracePeriod())), _dafny.SeqOfString(". ")) + } + return _dafny.SeqOfString("") + })()) + _ = _2_msg + return _2_msg +} +func (_static *CompanionStruct_Default___) CheckSettings(cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache) m_Wrappers.Outcome { + if Companion_Default___.ConsistentSettings(cache) { + return m_Wrappers.Companion_Outcome_.Create_Pass_() + } else { + return m_Wrappers.Companion_Outcome_.Create_Fail_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(Companion_Default___.BadCacheMsg(cache))) + } +} + +// End of class Default__ + +// Definition of datatype CacheState +type CacheState struct { + Data_CacheState_ +} + +func (_this CacheState) Get_() Data_CacheState_ { + return _this.Data_CacheState_ +} + +type Data_CacheState_ interface { + isCacheState() +} + +type CompanionStruct_CacheState_ struct { +} + +var Companion_CacheState_ = CompanionStruct_CacheState_{} + +type CacheState_EmptyWait struct { +} + +func (CacheState_EmptyWait) isCacheState() {} + +func (CompanionStruct_CacheState_) Create_EmptyWait_() CacheState { + return CacheState{CacheState_EmptyWait{}} +} + +func (_this CacheState) Is_EmptyWait() bool { + _, ok := _this.Get_().(CacheState_EmptyWait) + return ok +} + +type CacheState_EmptyFetch struct { +} + +func (CacheState_EmptyFetch) isCacheState() {} + +func (CompanionStruct_CacheState_) Create_EmptyFetch_() CacheState { + return CacheState{CacheState_EmptyFetch{}} +} + +func (_this CacheState) Is_EmptyFetch() bool { + _, ok := _this.Get_().(CacheState_EmptyFetch) + return ok +} + +type CacheState_Full struct { + Data m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput +} + +func (CacheState_Full) isCacheState() {} + +func (CompanionStruct_CacheState_) Create_Full_(Data m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput) CacheState { + return CacheState{CacheState_Full{Data}} +} + +func (_this CacheState) Is_Full() bool { + _, ok := _this.Get_().(CacheState_Full) + return ok +} + +func (CompanionStruct_CacheState_) Default() CacheState { + return Companion_CacheState_.Create_EmptyWait_() +} + +func (_this CacheState) Dtor_data() m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput { + return _this.Get_().(CacheState_Full).Data +} + +func (_this CacheState) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case CacheState_EmptyWait: + { + return "StormTracker.CacheState.EmptyWait" + } + case CacheState_EmptyFetch: + { + return "StormTracker.CacheState.EmptyFetch" + } + case CacheState_Full: + { + return "StormTracker.CacheState.Full" + "(" + _dafny.String(data.Data) + ")" + } + default: + { + return "" + } + } +} + +func (_this CacheState) Equals(other CacheState) bool { + switch data1 := _this.Get_().(type) { + case CacheState_EmptyWait: + { + _, ok := other.Get_().(CacheState_EmptyWait) + return ok + } + case CacheState_EmptyFetch: + { + _, ok := other.Get_().(CacheState_EmptyFetch) + return ok + } + case CacheState_Full: + { + data2, ok := other.Get_().(CacheState_Full) + return ok && data1.Data.Equals(data2.Data) + } + default: + { + return false // unexpected + } + } +} + +func (_this CacheState) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CacheState) + return ok && _this.Equals(typed) +} + +func Type_CacheState_() _dafny.TypeDescriptor { + return type_CacheState_{} +} + +type type_CacheState_ struct { +} + +func (_this type_CacheState_) Default() interface{} { + return Companion_CacheState_.Default() +} + +func (_this type_CacheState_) String() string { + return "StormTracker.CacheState" +} +func (_this CacheState) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CacheState{} + +// End of datatype CacheState + +// Definition of class StormTracker +type StormTracker struct { + Wrapped *m_LocalCMC.LocalCMC + InFlight *m_DafnyLibraries.MutableMap + GracePeriod int64 + GraceInterval int64 + FanOut int64 + InFlightTTL int64 + LastPrune int64 + SleepMilli int64 +} + +func New_StormTracker_() *StormTracker { + _this := StormTracker{} + + _this.Wrapped = (*m_LocalCMC.LocalCMC)(nil) + _this.InFlight = (*m_DafnyLibraries.MutableMap)(nil) + _this.GracePeriod = int64(0) + _this.GraceInterval = int64(0) + _this.FanOut = int64(0) + _this.InFlightTTL = int64(0) + _this.LastPrune = int64(0) + _this.SleepMilli = int64(0) + return &_this +} + +type CompanionStruct_StormTracker_ struct { +} + +var Companion_StormTracker_ = CompanionStruct_StormTracker_{} + +func (_this *StormTracker) Equals(other *StormTracker) bool { + return _this == other +} + +func (_this *StormTracker) EqualsGeneric(x interface{}) bool { + other, ok := x.(*StormTracker) + return ok && _this.Equals(other) +} + +func (*StormTracker) String() string { + return "StormTracker.StormTracker" +} + +func Type_StormTracker_() _dafny.TypeDescriptor { + return type_StormTracker_{} +} + +type type_StormTracker_ struct { +} + +func (_this type_StormTracker_) Default() interface{} { + return (*StormTracker)(nil) +} + +func (_this type_StormTracker_) String() string { + return "StormTracker.StormTracker" +} +func (_this *StormTracker) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &StormTracker{} + +func (_this *StormTracker) Ctor__(cache m_AwsCryptographyMaterialProvidersTypes.StormTrackingCache) { + { + var _0_gracePeriod int64 = int64(0) + _ = _0_gracePeriod + var _1_graceInterval int64 = int64(0) + _ = _1_graceInterval + var _2_inFlightTTL int64 = int64(0) + _ = _2_inFlightTTL + if (((cache).Dtor_timeUnits()).UnwrapOr(m_AwsCryptographyMaterialProvidersTypes.Companion_TimeUnits_.Create_Seconds_()).(m_AwsCryptographyMaterialProvidersTypes.TimeUnits)).Is_Seconds() { + _0_gracePeriod = (int64((cache).Dtor_gracePeriod())) * (int64(1000)) + _1_graceInterval = (int64((cache).Dtor_graceInterval())) * (int64(1000)) + _2_inFlightTTL = (int64((cache).Dtor_inFlightTTL())) * (int64(1000)) + } else { + _0_gracePeriod = int64((cache).Dtor_gracePeriod()) + _1_graceInterval = int64((cache).Dtor_graceInterval()) + _2_inFlightTTL = int64((cache).Dtor_inFlightTTL()) + } + var _nw0 *m_LocalCMC.LocalCMC = m_LocalCMC.New_LocalCMC_() + _ = _nw0 + _nw0.Ctor__(_dafny.IntOfInt32((cache).Dtor_entryCapacity()), _dafny.IntOfInt32(((cache).Dtor_entryPruningTailSize()).UnwrapOr(int32(1)).(int32))) + (_this).Wrapped = _nw0 + var _nw1 *m_DafnyLibraries.MutableMap = m_DafnyLibraries.New_MutableMap_() + _ = _nw1 + (_this).InFlight = _nw1 + (_this).GracePeriod = _0_gracePeriod + (_this).GraceInterval = _1_graceInterval + (_this).FanOut = int64((cache).Dtor_fanOut()) + (_this).InFlightTTL = _2_inFlightTTL + (_this).SleepMilli = int64((cache).Dtor_sleepMilli()) + (_this).LastPrune = int64(0) + } +} +func (_this *StormTracker) FanOutReached(now int64) bool { + { + var res bool = false + _ = res + (_this).PruneInFlight(now) + res = (_this.FanOut) <= (((_this.InFlight).Size()).Int64()) + return res + return res + } +} +func (_this *StormTracker) AddLong(x int64, y int64) int64 { + { + if (x) < (((m_StandardLibrary_UInt.Companion_Default___.INT64__MAX__LIMIT()).Int64()) - (y)) { + return (x) + (y) + } else { + return (m_StandardLibrary_UInt.Companion_Default___.INT64__MAX__LIMIT()).Int64() + } + } +} +func (_this *StormTracker) GracePeriod_q(result m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput, now int64) bool { + { + return (((result).Dtor_expiryTime()) < (int64(9223372036854775))) && (((((result).Dtor_expiryTime()) * (int64(1000))) - (_this.GracePeriod)) <= (now)) + } +} +func (_this *StormTracker) CheckInFlight(identifier _dafny.Sequence, result m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput, now int64) CacheState { + { + var output CacheState = Companion_CacheState_.Default() + _ = output + var _0_fanOutReached bool + _ = _0_fanOutReached + var _out0 bool + _ = _out0 + _out0 = (_this).FanOutReached(now) + _0_fanOutReached = _out0 + if _0_fanOutReached { + output = Companion_CacheState_.Create_Full_(result) + return output + } else if !((_this).GracePeriod_q(result, now)) { + output = Companion_CacheState_.Create_Full_(result) + return output + } else { + if (_this.InFlight).HasKey(identifier) { + var _1_entry int64 + _ = _1_entry + _1_entry = (_this.InFlight).Select(identifier).(int64) + if ((_this).AddLong(_1_entry, _this.GraceInterval)) > (now) { + output = Companion_CacheState_.Create_Full_(result) + return output + } + } + (_this.InFlight).Put(identifier, now) + output = Companion_CacheState_.Create_EmptyFetch_() + return output + } + return output + } +} +func (_this *StormTracker) PruneInFlight(now int64) { + { + if (((_this.InFlight).Size()).Int64()) < (_this.FanOut) { + return + } + if ((now) - (int64(1000))) < (_this.LastPrune) { + return + } + (_this).LastPrune = now + var _0_keySet _dafny.Set + _ = _0_keySet + _0_keySet = (_this.InFlight).Keys() + var _1_keys _dafny.Sequence + _ = _1_keys + var _out0 _dafny.Sequence + _ = _out0 + _out0 = m_SortedSets.SetToSequence(_0_keySet) + _1_keys = _out0 + var _hi0 _dafny.Int = _dafny.IntOfUint32((_1_keys).Cardinality()) + _ = _hi0 + for _2_i := _dafny.Zero; _2_i.Cmp(_hi0) < 0; _2_i = _2_i.Plus(_dafny.One) { + var _3_v int64 + _ = _3_v + _3_v = (_this.InFlight).Select((_1_keys).Select((_2_i).Uint32()).(_dafny.Sequence)).(int64) + if (now) >= ((_this).AddLong(_3_v, _this.InFlightTTL)) { + (_this.InFlight).Remove((_1_keys).Select((_2_i).Uint32()).(_dafny.Sequence)) + } + } + } +} +func (_this *StormTracker) CheckNewEntry(identifier _dafny.Sequence, now int64) CacheState { + { + var output CacheState = Companion_CacheState_.Default() + _ = output + var _0_fanOutReached bool + _ = _0_fanOutReached + var _out0 bool + _ = _out0 + _out0 = (_this).FanOutReached(now) + _0_fanOutReached = _out0 + if _0_fanOutReached { + output = Companion_CacheState_.Create_EmptyWait_() + return output + } else if (_this.InFlight).HasKey(identifier) { + var _1_entry int64 + _ = _1_entry + _1_entry = (_this.InFlight).Select(identifier).(int64) + if (now) < ((_this).AddLong(_1_entry, _this.GraceInterval)) { + output = Companion_CacheState_.Create_EmptyWait_() + return output + } + } + (_this.InFlight).Put(identifier, now) + output = Companion_CacheState_.Create_EmptyFetch_() + return output + return output + } +} +func (_this *StormTracker) GetFromCacheWithTime(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput, now int64) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_CacheState_.Default()) + _ = output + var _0_result m_Wrappers.Result + _ = _0_result + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this.Wrapped).GetCacheEntryWithTime(input, _dafny.DivInt64(now, int64(1000))) + _0_result = _out0 + if (_0_result).Is_Success() { + var _1_newResult CacheState + _ = _1_newResult + var _out1 CacheState + _ = _out1 + _out1 = (_this).CheckInFlight((input).Dtor_identifier(), (_0_result).Dtor_value().(m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput), now) + _1_newResult = _out1 + output = m_Wrappers.Companion_Result_.Create_Success_(_1_newResult) + return output + } else if ((_0_result).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)).Is_EntryDoesNotExist() { + var _2_newResult CacheState + _ = _2_newResult + var _out2 CacheState + _ = _out2 + _out2 = (_this).CheckNewEntry((input).Dtor_identifier(), now) + _2_newResult = _out2 + output = m_Wrappers.Companion_Result_.Create_Success_(_2_newResult) + return output + } else { + output = m_Wrappers.Companion_Result_.Create_Failure_((_0_result).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return output + } + return output + } +} +func (_this *StormTracker) GetFromCache(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_CacheState_.Default()) + _ = output + var _0_now int64 + _ = _0_now + var _out0 int64 + _ = _out0 + _out0 = m__Time.CurrentRelativeTimeMilli() + _0_now = _out0 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (_this).GetFromCacheWithTime(input, _0_now) + output = _out1 + return output + } +} +func (_this *StormTracker) GetCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_result m_Wrappers.Result + _ = _0_result + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).GetFromCache(input) + _0_result = _out0 + if (_0_result).Is_Failure() { + output = m_Wrappers.Companion_Result_.Create_Failure_((_0_result).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)) + return output + } else if ((_0_result).Dtor_value().(CacheState)).Is_Full() { + output = m_Wrappers.Companion_Result_.Create_Success_(((_0_result).Dtor_value().(CacheState)).Dtor_data()) + return output + } else { + output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryDoesNotExist_(_dafny.SeqOfString("Entry does not exist"))) + return output + } + return output + } +} +func (_this *StormTracker) PutCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + (_this.InFlight).Remove((input).Dtor_identifier()) + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this.Wrapped).PutCacheEntry_k(input) + output = _out0 + return output + } +} +func (_this *StormTracker) DeleteCacheEntry(input m_AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + (_this.InFlight).Remove((input).Dtor_identifier()) + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this.Wrapped).DeleteCacheEntry_k(input) + output = _out0 + return output + } +} +func (_this *StormTracker) UpdateUsageMetadata(input m_AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this.Wrapped).UpdateUsageMetadata_k(input) + output = _out0 + return output + } +} + +// End of class StormTracker diff --git a/releases/go/mpl/StormTrackingCMC/StormTrackingCMC.go b/releases/go/mpl/StormTrackingCMC/StormTrackingCMC.go new file mode 100644 index 000000000..0b4fe8c88 --- /dev/null +++ b/releases/go/mpl/StormTrackingCMC/StormTrackingCMC.go @@ -0,0 +1,232 @@ +// Package StormTrackingCMC +// Dafny module StormTrackingCMC compiled into Go + +package StormTrackingCMC + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "StormTrackingCMC.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) CreateGetCacheEntrySuccess(output m_AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Success_(output) +} +func (_static *CompanionStruct_Default___) CreateGetCacheEntryFailure(error_ m_AwsCryptographyMaterialProvidersTypes.Error) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Failure_(error_) +} + +// End of class Default__ diff --git a/releases/go/mpl/StormTrackingCMC/externs.go b/releases/go/mpl/StormTrackingCMC/externs.go new file mode 100644 index 000000000..db2ab7329 --- /dev/null +++ b/releases/go/mpl/StormTrackingCMC/externs.go @@ -0,0 +1,86 @@ +package StormTrackingCMC + +import ( + "sync" + "time" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + DafnyTime "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Time_" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +type StormTrackingCMC struct { + stormTracker *StormTracker.StormTracker + //The Lock contention is not tested. + sync.Mutex +} + +func New_StormTrackingCMC_(stormTracker *StormTracker.StormTracker) *StormTrackingCMC { + return &StormTrackingCMC{stormTracker: stormTracker} +} + +func (cmc *StormTrackingCMC) PutCacheEntry(input AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.PutCacheEntry(input) +} +func (cmc *StormTrackingCMC) PutCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.PutCacheEntry(input) +} +func (cmc *StormTrackingCMC) UpdateUsageMetadata(input AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.UpdateUsageMetadata(input) +} +func (cmc *StormTrackingCMC) UpdateUsageMetadata_k(input AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.UpdateUsageMetadata(input) +} +func (cmc *StormTrackingCMC) GetCacheEntry(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + return cmc.GetCacheEntry_k(input) +} +func (cmc *StormTrackingCMC) GetCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + maxInFlight := DafnyTime.CurrentRelativeTimeMilli() + cmc.stormTracker.InFlightTTL + for { + res := cmc.GetFromInner(input) + if res.IsFailure() { + return Companion_Default___.CreateGetCacheEntryFailure(res.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error)) + } else if res.Dtor_value().(StormTracker.CacheState).Is_Full() { + return Companion_Default___.CreateGetCacheEntrySuccess(res.Dtor_value().(StormTracker.CacheState).Dtor_data()) + } else if res.Dtor_value().(StormTracker.CacheState).Is_EmptyFetch() { + return Companion_Default___.CreateGetCacheEntryFailure(AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryDoesNotExist_(_dafny.SeqOfChars([]_dafny.Char("Entry doesn't exists")...))) + } else { + if DafnyTime.CurrentRelativeTimeMilli() <= maxInFlight { + time.Sleep(time.Duration(cmc.stormTracker.SleepMilli)) + } else { + return Companion_Default___.CreateGetCacheEntryFailure(AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InFlightTTLExceeded_(_dafny.SeqOfChars([]_dafny.Char("Storm cache inFlightTTL exceeded.")...))) + } + } + } +} +func (cmc *StormTrackingCMC) DeleteCacheEntry(input AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.DeleteCacheEntry(input) + +} +func (cmc *StormTrackingCMC) DeleteCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.DeleteCacheEntry(input) +} + +func (cmc *StormTrackingCMC) String() string { + return "StormTrackerCMC" +} + +func (cmc *StormTrackingCMC) GetFromInner(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.stormTracker.GetFromCache(input) +} diff --git a/releases/go/mpl/StrictMultiKeyring/StrictMultiKeyring.go b/releases/go/mpl/StrictMultiKeyring/StrictMultiKeyring.go new file mode 100644 index 000000000..f915a9116 --- /dev/null +++ b/releases/go/mpl/StrictMultiKeyring/StrictMultiKeyring.go @@ -0,0 +1,381 @@ +// Package StrictMultiKeyring +// Dafny module StrictMultiKeyring compiled into Go + +package StrictMultiKeyring + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "StrictMultiKeyring.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) StrictMultiKeyring(generator m_Wrappers.Option, awsKmsKeys m_Wrappers.Option, clientSupplier m_AwsCryptographyMaterialProvidersTypes.IClientSupplier, grantTokens m_Wrappers.Option) m_Wrappers.Result { + var output m_Wrappers.Result = m_Wrappers.Result{} + _ = output + var _0_allStrings _dafny.Sequence + _ = _0_allStrings + var _source0 m_Wrappers.Option = generator + _ = _source0 + { + { + if _source0.Is_Some() { + var _1_g _dafny.Sequence = _source0.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _1_g + _0_allStrings = _dafny.Companion_Sequence_.Concatenate(_dafny.SeqOf(_1_g), (awsKmsKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + goto Lmatch0 + } + } + { + _0_allStrings = (awsKmsKeys).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence) + } + goto Lmatch0 + } +Lmatch0: + var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = _2_valueOrError0 + _2_valueOrError0 = (m_Seq.Companion_Default___.MapWithResult(func(coer59 func(_dafny.Sequence) m_Wrappers.Result) func(interface{}) m_Wrappers.Result { + return func(arg60 interface{}) m_Wrappers.Result { + return coer59(arg60.(_dafny.Sequence)) + } + }(m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString), _0_allStrings)).MapFailure(func(coer60 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg61 interface{}) interface{} { + return coer60(arg61.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_2_valueOrError0).IsFailure() { + output = (_2_valueOrError0).PropagateFailure() + return output + } + var _3_allIdentifiers _dafny.Sequence + _ = _3_allIdentifiers + _3_allIdentifiers = (_2_valueOrError0).Extract().(_dafny.Sequence) + var _4_generatorKeyring m_Wrappers.Option = m_Wrappers.Companion_Option_.Default() + _ = _4_generatorKeyring + var _source1 m_Wrappers.Option = generator + _ = _source1 + { + { + if _source1.Is_Some() { + var _5_generatorIdentifier _dafny.Sequence = _source1.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _5_generatorIdentifier + var _6_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} + _ = _6_valueOrError1 + _6_valueOrError1 = (m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString(_5_generatorIdentifier)).MapFailure(func(coer61 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg62 interface{}) interface{} { + return coer61(arg62.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_6_valueOrError1).IsFailure() { + output = (_6_valueOrError1).PropagateFailure() + return output + } + var _7_arn m_AwsArnParsing.AwsKmsIdentifier + _ = _7_arn + _7_arn = (_6_valueOrError1).Extract().(m_AwsArnParsing.AwsKmsIdentifier) + var _8_region m_Wrappers.Option + _ = _8_region + _8_region = m_AwsArnParsing.Companion_Default___.GetRegion(_7_arn) + var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} + _ = _9_valueOrError2 + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_((_8_region).UnwrapOr(_dafny.SeqOfString("")).(_dafny.Sequence))) + _9_valueOrError2 = _out0 + if (_9_valueOrError2).IsFailure() { + output = (_9_valueOrError2).PropagateFailure() + return output + } + var _10_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _10_client + _10_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_9_valueOrError2).Extract()) + var _11_g *m_AwsKmsKeyring.AwsKmsKeyring + _ = _11_g + var _nw0 *m_AwsKmsKeyring.AwsKmsKeyring = m_AwsKmsKeyring.New_AwsKmsKeyring_() + _ = _nw0 + _nw0.Ctor__(_10_client, _5_generatorIdentifier, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _11_g = _nw0 + _4_generatorKeyring = m_Wrappers.Companion_Option_.Create_Some_(_11_g) + goto Lmatch1 + } + } + { + _4_generatorKeyring = m_Wrappers.Companion_Option_.Create_None_() + } + goto Lmatch1 + } +Lmatch1: + var _12_children _dafny.Sequence + _ = _12_children + _12_children = _dafny.SeqOf() + var _source2 m_Wrappers.Option = awsKmsKeys + _ = _source2 + { + { + if _source2.Is_Some() { + var _13_childIdentifiers _dafny.Sequence = _source2.Get_().(m_Wrappers.Option_Some).Value.(_dafny.Sequence) + _ = _13_childIdentifiers + var _hi0 _dafny.Int = _dafny.IntOfUint32((_13_childIdentifiers).Cardinality()) + _ = _hi0 + for _14_index := _dafny.Zero; _14_index.Cmp(_hi0) < 0; _14_index = _14_index.Plus(_dafny.One) { + var _15_childIdentifier _dafny.Sequence + _ = _15_childIdentifier + _15_childIdentifier = (_13_childIdentifiers).Select((_14_index).Uint32()).(_dafny.Sequence) + var _16_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} + _ = _16_valueOrError3 + _16_valueOrError3 = (m_AwsArnParsing.Companion_Default___.IsAwsKmsIdentifierString(_15_childIdentifier)).MapFailure(func(coer62 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg63 interface{}) interface{} { + return coer62(arg63.(_dafny.Sequence)) + } + }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) + if (_16_valueOrError3).IsFailure() { + output = (_16_valueOrError3).PropagateFailure() + return output + } + var _17_info m_AwsArnParsing.AwsKmsIdentifier + _ = _17_info + _17_info = (_16_valueOrError3).Extract().(m_AwsArnParsing.AwsKmsIdentifier) + var _18_region m_Wrappers.Option + _ = _18_region + _18_region = m_AwsArnParsing.Companion_Default___.GetRegion(_17_info) + var _19_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{} + _ = _19_valueOrError4 + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = (clientSupplier).GetClient(m_AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_((_18_region).UnwrapOr(_dafny.SeqOfString("")).(_dafny.Sequence))) + _19_valueOrError4 = _out1 + if (_19_valueOrError4).IsFailure() { + output = (_19_valueOrError4).PropagateFailure() + return output + } + var _20_client m_ComAmazonawsKmsTypes.IKMSClient + _ = _20_client + _20_client = m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_((_19_valueOrError4).Extract()) + var _21_keyring *m_AwsKmsKeyring.AwsKmsKeyring + _ = _21_keyring + var _nw1 *m_AwsKmsKeyring.AwsKmsKeyring = m_AwsKmsKeyring.New_AwsKmsKeyring_() + _ = _nw1 + _nw1.Ctor__(_20_client, _15_childIdentifier, (grantTokens).UnwrapOr(_dafny.SeqOf()).(_dafny.Sequence)) + _21_keyring = _nw1 + _12_children = _dafny.Companion_Sequence_.Concatenate(_12_children, _dafny.SeqOf(_21_keyring)) + } + goto Lmatch2 + } + } + { + _12_children = _dafny.SeqOf() + } + goto Lmatch2 + } +Lmatch2: + var _22_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() + _ = _22_valueOrError5 + _22_valueOrError5 = m_Wrappers.Companion_Default___.Need(((_4_generatorKeyring).Is_Some()) || ((_dafny.IntOfUint32((_12_children).Cardinality())).Sign() == 1), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("generatorKeyring or child Keryings needed to create a multi keyring"))) + if (_22_valueOrError5).IsFailure() { + output = (_22_valueOrError5).PropagateFailure() + return output + } + var _23_keyring *m_MultiKeyring.MultiKeyring + _ = _23_keyring + var _nw2 *m_MultiKeyring.MultiKeyring = m_MultiKeyring.New_MultiKeyring_() + _ = _nw2 + _nw2.Ctor__(_4_generatorKeyring, _12_children) + _23_keyring = _nw2 + output = m_Wrappers.Companion_Result_.Create_Success_(_23_keyring) + return output + return output +} + +// End of class Default__ diff --git a/releases/go/mpl/Structure/Structure.go b/releases/go/mpl/Structure/Structure.go new file mode 100644 index 000000000..438ad3348 --- /dev/null +++ b/releases/go/mpl/Structure/Structure.go @@ -0,0 +1,602 @@ +// Package Structure +// Dafny module Structure compiled into Go + +package Structure + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Structure.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) BranchKeyContext_q(m _dafny.Map) bool { + return ((((((((((((((m).Contains(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD())) && ((m).Contains(Companion_Default___.TYPE__FIELD()))) && ((m).Contains(Companion_Default___.KEY__CREATE__TIME()))) && ((m).Contains(Companion_Default___.HIERARCHY__VERSION()))) && ((m).Contains(Companion_Default___.TABLE__FIELD()))) && ((m).Contains(Companion_Default___.KMS__FIELD()))) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType((m).Get(Companion_Default___.KMS__FIELD()).(_dafny.Sequence)))) && (!((m).Keys()).Contains(Companion_Default___.BRANCH__KEY__FIELD()))) && ((_dafny.IntOfUint32(((m).Get(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(_dafny.Sequence)).Cardinality())).Sign() == 1)) && ((_dafny.IntOfUint32(((m).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence)).Cardinality())).Sign() == 1)) && (_dafny.Quantifier(((m).Keys()).Elements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _0_k _dafny.Sequence + _0_k = interface{}(_forall_var_0).(_dafny.Sequence) + return !(((m).Keys()).Contains(_0_k)) || (m_ComAmazonawsDynamodbTypes.Companion_Default___.IsValid__AttributeName(_0_k)) + }))) && (((m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) == ((true) && (_dafny.Companion_Sequence_.Equal((m).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence), Companion_Default___.BRANCH__KEY__ACTIVE__TYPE()))))) && (!((m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) || ((true) && (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), (m).Get(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()).(_dafny.Sequence)))))) && ((!(m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) == ((_dafny.Companion_Sequence_.Equal((m).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence), Companion_Default___.BEACON__KEY__TYPE__VALUE())) || (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), (m).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence))))) +} +func (_static *CompanionStruct_Default___) ToAttributeMap(encryptionContext _dafny.Map, encryptedKey _dafny.Sequence) _dafny.Map { + return func() _dafny.Map { + var _coll0 = _dafny.NewMapBuilder() + _ = _coll0 + for _iter2 := _dafny.Iterate(((((encryptionContext).Keys()).Union(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD()))).Difference(_dafny.SetOf(Companion_Default___.TABLE__FIELD()))).Elements()); ; { + _compr_0, _ok2 := _iter2() + if !_ok2 { + break + } + var _0_k _dafny.Sequence + _0_k = interface{}(_compr_0).(_dafny.Sequence) + if m_ComAmazonawsDynamodbTypes.Companion_AttributeName_.Is_(_0_k) { + if ((((encryptionContext).Keys()).Union(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD()))).Difference(_dafny.SetOf(Companion_Default___.TABLE__FIELD()))).Contains(_0_k) { + _coll0.Add(_0_k, (func() m_ComAmazonawsDynamodbTypes.AttributeValue { + if _dafny.Companion_Sequence_.Equal(_0_k, Companion_Default___.HIERARCHY__VERSION()) { + return m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_N_((encryptionContext).Get(Companion_Default___.HIERARCHY__VERSION()).(_dafny.Sequence)) + } + return (func() m_ComAmazonawsDynamodbTypes.AttributeValue { + if _dafny.Companion_Sequence_.Equal(_0_k, Companion_Default___.BRANCH__KEY__FIELD()) { + return m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_B_(encryptedKey) + } + return m_ComAmazonawsDynamodbTypes.Companion_AttributeValue_.Create_S_((encryptionContext).Get(_0_k).(_dafny.Sequence)) + })() + })()) + } + } + } + return _coll0.ToMap() + }() +} +func (_static *CompanionStruct_Default___) ToBranchKeyContext(item _dafny.Map, logicalKeyStoreName _dafny.Sequence) _dafny.Map { + return func() _dafny.Map { + var _coll0 = _dafny.NewMapBuilder() + _ = _coll0 + for _iter3 := _dafny.Iterate(((((item).Keys()).Difference(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD()))).Union(_dafny.SetOf(Companion_Default___.TABLE__FIELD()))).Elements()); ; { + _compr_0, _ok3 := _iter3() + if !_ok3 { + break + } + var _0_k _dafny.Sequence + _0_k = interface{}(_compr_0).(_dafny.Sequence) + if ((((item).Keys()).Difference(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD()))).Union(_dafny.SetOf(Companion_Default___.TABLE__FIELD()))).Contains(_0_k) { + _coll0.Add(_0_k, (func() _dafny.Sequence { + if _dafny.Companion_Sequence_.Equal(_0_k, Companion_Default___.HIERARCHY__VERSION()) { + return ((item).Get(_0_k).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_N() + } + return (func() _dafny.Sequence { + if _dafny.Companion_Sequence_.Equal(_0_k, Companion_Default___.TABLE__FIELD()) { + return logicalKeyStoreName + } + return ((item).Get(_0_k).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S() + })() + })()) + } + } + return _coll0.ToMap() + }() +} +func (_static *CompanionStruct_Default___) ToBranchKeyMaterials(encryptionContext _dafny.Map, plaintextKey _dafny.Sequence) m_Wrappers.Result { + var _0_versionInformation _dafny.Sequence = (func() _dafny.Sequence { + if (encryptionContext).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()) { + return (encryptionContext).Get(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()).(_dafny.Sequence) + } + return (encryptionContext).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence) + })() + _ = _0_versionInformation + var _1_branchKeyVersion _dafny.Sequence = (_0_versionInformation).Drop((_dafny.IntOfUint32((Companion_Default___.BRANCH__KEY__TYPE__PREFIX()).Cardinality())).Uint32()) + _ = _1_branchKeyVersion + var _2_valueOrError0 m_Wrappers.Result = (m_UTF8.Encode(_1_branchKeyVersion)).MapFailure(func(coer10 func(_dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error) func(interface{}) interface{} { + return func(arg10 interface{}) interface{} { + return coer10(arg10.(_dafny.Sequence)) + } + }(func(_3_e _dafny.Sequence) m_AwsCryptographyKeyStoreTypes.Error { + return m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_3_e) + })) + _ = _2_valueOrError0 + if (_2_valueOrError0).IsFailure() { + return (_2_valueOrError0).PropagateFailure() + } else { + var _4_branchKeyVersionUtf8 _dafny.Sequence = (_2_valueOrError0).Extract().(_dafny.Sequence) + _ = _4_branchKeyVersionUtf8 + var _5_valueOrError1 m_Wrappers.Result = Companion_Default___.ExtractCustomEncryptionContext(encryptionContext) + _ = _5_valueOrError1 + if (_5_valueOrError1).IsFailure() { + return (_5_valueOrError1).PropagateFailure() + } else { + var _6_customEncryptionContext _dafny.Map = (_5_valueOrError1).Extract().(_dafny.Map) + _ = _6_customEncryptionContext + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Create_BranchKeyMaterials_((encryptionContext).Get(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(_dafny.Sequence), _4_branchKeyVersionUtf8, _6_customEncryptionContext, plaintextKey)) + } + } +} +func (_static *CompanionStruct_Default___) ToBeaconKeyMaterials(encryptionContext _dafny.Map, plaintextKey _dafny.Sequence) m_Wrappers.Result { + var _0_valueOrError0 m_Wrappers.Result = Companion_Default___.ExtractCustomEncryptionContext(encryptionContext) + _ = _0_valueOrError0 + if (_0_valueOrError0).IsFailure() { + return (_0_valueOrError0).PropagateFailure() + } else { + var _1_customEncryptionContext _dafny.Map = (_0_valueOrError0).Extract().(_dafny.Map) + _ = _1_customEncryptionContext + return m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyKeyStoreTypes.Companion_BeaconKeyMaterials_.Create_BeaconKeyMaterials_((encryptionContext).Get(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(_dafny.Sequence), _1_customEncryptionContext, m_Wrappers.Companion_Option_.Create_Some_(plaintextKey), m_Wrappers.Companion_Option_.Create_None_())) + } +} +func (_static *CompanionStruct_Default___) ExtractCustomEncryptionContext(encryptionContext _dafny.Map) m_Wrappers.Result { + var _0_encodedEncryptionContext _dafny.Set = func() _dafny.Set { + var _coll0 = _dafny.NewBuilder() + _ = _coll0 + for _iter4 := _dafny.Iterate((encryptionContext).Keys().Elements()); ; { + _compr_0, _ok4 := _iter4() + if !_ok4 { + break + } + var _1_k _dafny.Sequence + _1_k = interface{}(_compr_0).(_dafny.Sequence) + if ((encryptionContext).Contains(_1_k)) && (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.ENCRYPTION__CONTEXT__PREFIX(), _1_k)) { + _coll0.Add(_dafny.TupleOf(m_UTF8.Encode((_1_k).Drop((_dafny.IntOfUint32((Companion_Default___.ENCRYPTION__CONTEXT__PREFIX()).Cardinality())).Uint32())), m_UTF8.Encode((encryptionContext).Get(_1_k).(_dafny.Sequence)))) + } + } + return _coll0.ToSet() + }() + _ = _0_encodedEncryptionContext + var _2_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need(_dafny.Quantifier((_0_encodedEncryptionContext).Elements(), true, func(_forall_var_0 _dafny.Tuple) bool { + var _3_i _dafny.Tuple + _3_i = interface{}(_forall_var_0).(_dafny.Tuple) + return !((_0_encodedEncryptionContext).Contains(_3_i)) || ((((*(_3_i).IndexInt(0)).(m_Wrappers.Result)).Is_Success()) && (((*(_3_i).IndexInt(1)).(m_Wrappers.Result)).Is_Success())) + }), m_AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(_dafny.SeqOfString("Unable to encode string"))) + _ = _2_valueOrError0 + if (_2_valueOrError0).IsFailure() { + return (_2_valueOrError0).PropagateFailure() + } else { + return m_Wrappers.Companion_Result_.Create_Success_(func() _dafny.Map { + var _coll1 = _dafny.NewMapBuilder() + _ = _coll1 + for _iter5 := _dafny.Iterate((_0_encodedEncryptionContext).Elements()); ; { + _compr_1, _ok5 := _iter5() + if !_ok5 { + break + } + var _4_i _dafny.Tuple + _4_i = interface{}(_compr_1).(_dafny.Tuple) + if (_0_encodedEncryptionContext).Contains(_4_i) { + _coll1.Add(((*(_4_i).IndexInt(0)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence), ((*(_4_i).IndexInt(1)).(m_Wrappers.Result)).Dtor_value().(_dafny.Sequence)) + } + } + return _coll1.ToMap() + }()) + } +} +func (_static *CompanionStruct_Default___) DecryptOnlyBranchKeyEncryptionContext(branchKeyId _dafny.Sequence, branchKeyVersion _dafny.Sequence, timestamp _dafny.Sequence, logicalKeyStoreName _dafny.Sequence, kmsKeyArn _dafny.Sequence, customEncryptionContext _dafny.Map) _dafny.Map { + return (_dafny.NewMapBuilder().ToMap().UpdateUnsafe(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD(), branchKeyId).UpdateUnsafe(Companion_Default___.TYPE__FIELD(), _dafny.Companion_Sequence_.Concatenate(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), branchKeyVersion)).UpdateUnsafe(Companion_Default___.KEY__CREATE__TIME(), timestamp).UpdateUnsafe(Companion_Default___.TABLE__FIELD(), logicalKeyStoreName).UpdateUnsafe(Companion_Default___.KMS__FIELD(), kmsKeyArn).UpdateUnsafe(Companion_Default___.HIERARCHY__VERSION(), _dafny.SeqOfString("1"))).Merge(func() _dafny.Map { + var _coll0 = _dafny.NewMapBuilder() + _ = _coll0 + for _iter6 := _dafny.Iterate((customEncryptionContext).Keys().Elements()); ; { + _compr_0, _ok6 := _iter6() + if !_ok6 { + break + } + var _0_k _dafny.Sequence + _0_k = interface{}(_compr_0).(_dafny.Sequence) + if (customEncryptionContext).Contains(_0_k) { + _coll0.Add(_dafny.Companion_Sequence_.Concatenate(Companion_Default___.ENCRYPTION__CONTEXT__PREFIX(), _0_k), (customEncryptionContext).Get(_0_k).(_dafny.Sequence)) + } + } + return _coll0.ToMap() + }()) +} +func (_static *CompanionStruct_Default___) ActiveBranchKeyEncryptionContext(decryptOnlyEncryptionContext _dafny.Map) _dafny.Map { + return (decryptOnlyEncryptionContext).Merge(_dafny.NewMapBuilder().ToMap().UpdateUnsafe(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD(), (decryptOnlyEncryptionContext).Get(Companion_Default___.TYPE__FIELD()).(_dafny.Sequence)).UpdateUnsafe(Companion_Default___.TYPE__FIELD(), Companion_Default___.BRANCH__KEY__ACTIVE__TYPE())) +} +func (_static *CompanionStruct_Default___) BeaconKeyEncryptionContext(decryptOnlyEncryptionContext _dafny.Map) _dafny.Map { + return (decryptOnlyEncryptionContext).Merge(_dafny.NewMapBuilder().ToMap().UpdateUnsafe(Companion_Default___.TYPE__FIELD(), Companion_Default___.BEACON__KEY__TYPE__VALUE())) +} +func (_static *CompanionStruct_Default___) NewVersionFromActiveBranchKeyEncryptionContext(activeBranchKeyEncryptionContext _dafny.Map, branchKeyVersion _dafny.Sequence, timestamp _dafny.Sequence) _dafny.Map { + return ((activeBranchKeyEncryptionContext).Merge(_dafny.NewMapBuilder().ToMap().UpdateUnsafe(Companion_Default___.TYPE__FIELD(), _dafny.Companion_Sequence_.Concatenate(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), branchKeyVersion)).UpdateUnsafe(Companion_Default___.KEY__CREATE__TIME(), timestamp))).Subtract(_dafny.SetOf(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) +} +func (_static *CompanionStruct_Default___) BranchKeyItem_q(m _dafny.Map) bool { + return (((((((((((((((((((((m).Contains(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD())) && (((m).Get(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S())) && ((m).Contains(Companion_Default___.TYPE__FIELD()))) && (((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S())) && ((m).Contains(Companion_Default___.KEY__CREATE__TIME()))) && (((m).Get(Companion_Default___.KEY__CREATE__TIME()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S())) && ((m).Contains(Companion_Default___.HIERARCHY__VERSION()))) && (((m).Get(Companion_Default___.HIERARCHY__VERSION()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_N())) && (!(m).Contains(Companion_Default___.TABLE__FIELD()))) && ((m).Contains(Companion_Default___.KMS__FIELD()))) && (((m).Get(Companion_Default___.KMS__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S())) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__KeyIdType(((m).Get(Companion_Default___.KMS__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S()))) && ((m).Contains(Companion_Default___.BRANCH__KEY__FIELD()))) && (((m).Get(Companion_Default___.BRANCH__KEY__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_B())) && ((_dafny.IntOfUint32((((m).Get(Companion_Default___.BRANCH__KEY__IDENTIFIER__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S()).Cardinality())).Sign() == 1)) && ((_dafny.IntOfUint32((((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S()).Cardinality())).Sign() == 1)) && (_dafny.Quantifier((((m).Keys()).Difference(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD(), Companion_Default___.HIERARCHY__VERSION()))).Elements(), true, func(_forall_var_0 _dafny.Sequence) bool { + var _0_k _dafny.Sequence + _0_k = interface{}(_forall_var_0).(_dafny.Sequence) + return !((((m).Keys()).Difference(_dafny.SetOf(Companion_Default___.BRANCH__KEY__FIELD(), Companion_Default___.HIERARCHY__VERSION()))).Contains(_0_k)) || (((m).Get(_0_k).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S()) + }))) && (((m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) == ((true) && (_dafny.Companion_Sequence_.Equal(((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), Companion_Default___.BRANCH__KEY__ACTIVE__TYPE()))))) && (!((m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) || ((true) && (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), ((m).Get(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S()))))) && ((!(m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD())) == ((_dafny.Companion_Sequence_.Equal(((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), Companion_Default___.BEACON__KEY__TYPE__VALUE())) || (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), ((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S()))))) && (m_ComAmazonawsKmsTypes.Companion_Default___.IsValid__CiphertextType(((m).Get(Companion_Default___.BRANCH__KEY__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_B())) +} +func (_static *CompanionStruct_Default___) ActiveBranchKeyItem_q(m _dafny.Map) bool { + return ((((Companion_Default___.BranchKeyItem_q(m)) && (_dafny.Companion_Sequence_.Equal(((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), Companion_Default___.BRANCH__KEY__ACTIVE__TYPE()))) && ((m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()))) && (((m).Get(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Is_S())) && (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), ((m).Get(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S())) +} +func (_static *CompanionStruct_Default___) VersionBranchKeyItem_q(m _dafny.Map) bool { + return ((Companion_Default___.BranchKeyItem_q(m)) && (!(m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()))) && (_dafny.Companion_Sequence_.IsProperPrefixOf(Companion_Default___.BRANCH__KEY__TYPE__PREFIX(), ((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S())) +} +func (_static *CompanionStruct_Default___) BeaconKeyItem_q(m _dafny.Map) bool { + return ((Companion_Default___.BranchKeyItem_q(m)) && (!(m).Contains(Companion_Default___.BRANCH__KEY__ACTIVE__VERSION__FIELD()))) && (_dafny.Companion_Sequence_.Equal(((m).Get(Companion_Default___.TYPE__FIELD()).(m_ComAmazonawsDynamodbTypes.AttributeValue)).Dtor_S(), Companion_Default___.BEACON__KEY__TYPE__VALUE())) +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__IDENTIFIER__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("branch-key-id") +} +func (_static *CompanionStruct_Default___) TYPE__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("type") +} +func (_static *CompanionStruct_Default___) KEY__CREATE__TIME() _dafny.Sequence { + return _dafny.SeqOfString("create-time") +} +func (_static *CompanionStruct_Default___) HIERARCHY__VERSION() _dafny.Sequence { + return _dafny.SeqOfString("hierarchy-version") +} +func (_static *CompanionStruct_Default___) TABLE__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("tablename") +} +func (_static *CompanionStruct_Default___) KMS__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("kms-arn") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("enc") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__ACTIVE__VERSION__FIELD() _dafny.Sequence { + return _dafny.SeqOfString("version") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__ACTIVE__TYPE() _dafny.Sequence { + return _dafny.SeqOfString("branch:ACTIVE") +} +func (_static *CompanionStruct_Default___) BRANCH__KEY__TYPE__PREFIX() _dafny.Sequence { + return _dafny.SeqOfString("branch:version:") +} +func (_static *CompanionStruct_Default___) BEACON__KEY__TYPE__VALUE() _dafny.Sequence { + return _dafny.SeqOfString("beacon:ACTIVE") +} +func (_static *CompanionStruct_Default___) ENCRYPTION__CONTEXT__PREFIX() _dafny.Sequence { + return _dafny.SeqOfString("aws-crypto-ec:") +} + +// End of class Default__ + +// Definition of class BranchKeyContext +type BranchKeyContext struct { +} + +func New_BranchKeyContext_() *BranchKeyContext { + _this := BranchKeyContext{} + + return &_this +} + +type CompanionStruct_BranchKeyContext_ struct { +} + +var Companion_BranchKeyContext_ = CompanionStruct_BranchKeyContext_{} + +func (*BranchKeyContext) String() string { + return "Structure.BranchKeyContext" +} + +// End of class BranchKeyContext + +func Type_BranchKeyContext_() _dafny.TypeDescriptor { + return type_BranchKeyContext_{} +} + +type type_BranchKeyContext_ struct { +} + +func (_this type_BranchKeyContext_) Default() interface{} { + return _dafny.EmptyMap +} + +func (_this type_BranchKeyContext_) String() string { + return "Structure.BranchKeyContext" +} +func (_this *CompanionStruct_BranchKeyContext_) Is_(__source _dafny.Map) bool { + var _0_m _dafny.Map = (__source) + _ = _0_m + return Companion_Default___.BranchKeyContext_q(_0_m) +} + +// Definition of class BranchKeyItem +type BranchKeyItem struct { +} + +func New_BranchKeyItem_() *BranchKeyItem { + _this := BranchKeyItem{} + + return &_this +} + +type CompanionStruct_BranchKeyItem_ struct { +} + +var Companion_BranchKeyItem_ = CompanionStruct_BranchKeyItem_{} + +func (*BranchKeyItem) String() string { + return "Structure.BranchKeyItem" +} + +// End of class BranchKeyItem + +func Type_BranchKeyItem_() _dafny.TypeDescriptor { + return type_BranchKeyItem_{} +} + +type type_BranchKeyItem_ struct { +} + +func (_this type_BranchKeyItem_) Default() interface{} { + return _dafny.EmptyMap +} + +func (_this type_BranchKeyItem_) String() string { + return "Structure.BranchKeyItem" +} +func (_this *CompanionStruct_BranchKeyItem_) Is_(__source _dafny.Map) bool { + var _1_m _dafny.Map = (__source) + _ = _1_m + return Companion_Default___.BranchKeyItem_q(_1_m) +} + +// Definition of class ActiveBranchKeyItem +type ActiveBranchKeyItem struct { +} + +func New_ActiveBranchKeyItem_() *ActiveBranchKeyItem { + _this := ActiveBranchKeyItem{} + + return &_this +} + +type CompanionStruct_ActiveBranchKeyItem_ struct { +} + +var Companion_ActiveBranchKeyItem_ = CompanionStruct_ActiveBranchKeyItem_{} + +func (*ActiveBranchKeyItem) String() string { + return "Structure.ActiveBranchKeyItem" +} + +// End of class ActiveBranchKeyItem + +func Type_ActiveBranchKeyItem_() _dafny.TypeDescriptor { + return type_ActiveBranchKeyItem_{} +} + +type type_ActiveBranchKeyItem_ struct { +} + +func (_this type_ActiveBranchKeyItem_) Default() interface{} { + return _dafny.EmptyMap +} + +func (_this type_ActiveBranchKeyItem_) String() string { + return "Structure.ActiveBranchKeyItem" +} +func (_this *CompanionStruct_ActiveBranchKeyItem_) Is_(__source _dafny.Map) bool { + var _2_m _dafny.Map = (__source) + _ = _2_m + return Companion_Default___.ActiveBranchKeyItem_q(_2_m) +} + +// Definition of class VersionBranchKeyItem +type VersionBranchKeyItem struct { +} + +func New_VersionBranchKeyItem_() *VersionBranchKeyItem { + _this := VersionBranchKeyItem{} + + return &_this +} + +type CompanionStruct_VersionBranchKeyItem_ struct { +} + +var Companion_VersionBranchKeyItem_ = CompanionStruct_VersionBranchKeyItem_{} + +func (*VersionBranchKeyItem) String() string { + return "Structure.VersionBranchKeyItem" +} + +// End of class VersionBranchKeyItem + +func Type_VersionBranchKeyItem_() _dafny.TypeDescriptor { + return type_VersionBranchKeyItem_{} +} + +type type_VersionBranchKeyItem_ struct { +} + +func (_this type_VersionBranchKeyItem_) Default() interface{} { + return _dafny.EmptyMap +} + +func (_this type_VersionBranchKeyItem_) String() string { + return "Structure.VersionBranchKeyItem" +} +func (_this *CompanionStruct_VersionBranchKeyItem_) Is_(__source _dafny.Map) bool { + var _3_m _dafny.Map = (__source) + _ = _3_m + return Companion_Default___.VersionBranchKeyItem_q(_3_m) +} + +// Definition of class BeaconKeyItem +type BeaconKeyItem struct { +} + +func New_BeaconKeyItem_() *BeaconKeyItem { + _this := BeaconKeyItem{} + + return &_this +} + +type CompanionStruct_BeaconKeyItem_ struct { +} + +var Companion_BeaconKeyItem_ = CompanionStruct_BeaconKeyItem_{} + +func (*BeaconKeyItem) String() string { + return "Structure.BeaconKeyItem" +} + +// End of class BeaconKeyItem + +func Type_BeaconKeyItem_() _dafny.TypeDescriptor { + return type_BeaconKeyItem_{} +} + +type type_BeaconKeyItem_ struct { +} + +func (_this type_BeaconKeyItem_) Default() interface{} { + return _dafny.EmptyMap +} + +func (_this type_BeaconKeyItem_) String() string { + return "Structure.BeaconKeyItem" +} +func (_this *CompanionStruct_BeaconKeyItem_) Is_(__source _dafny.Map) bool { + var _4_m _dafny.Map = (__source) + _ = _4_m + return Companion_Default___.BeaconKeyItem_q(_4_m) +} diff --git a/releases/go/mpl/SynchronizedLocalCMC/SynchronizedLocalCMC.go b/releases/go/mpl/SynchronizedLocalCMC/SynchronizedLocalCMC.go new file mode 100644 index 000000000..deb89117d --- /dev/null +++ b/releases/go/mpl/SynchronizedLocalCMC/SynchronizedLocalCMC.go @@ -0,0 +1,185 @@ +// Package SynchronizedLocalCMC +// Dafny module SynchronizedLocalCMC compiled into Go + +package SynchronizedLocalCMC + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ + +type Dummy__ struct{} diff --git a/releases/go/mpl/SynchronizedLocalCMC/externs.go b/releases/go/mpl/SynchronizedLocalCMC/externs.go new file mode 100644 index 000000000..e42d36286 --- /dev/null +++ b/releases/go/mpl/SynchronizedLocalCMC/externs.go @@ -0,0 +1,63 @@ +package SynchronizedLocalCMC + +import ( + "sync" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" +) + +type SynchronizedLocalCMC struct { + localCMC *LocalCMC.LocalCMC + sync.Mutex +} + +func New_SynchronizedLocalCMC_(localCMC *LocalCMC.LocalCMC) *SynchronizedLocalCMC { + return &SynchronizedLocalCMC{localCMC: localCMC} +} + +func (cmc *SynchronizedLocalCMC) PutCacheEntry(input AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.PutCacheEntry(input) +} +func (cmc *SynchronizedLocalCMC) PutCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.PutCacheEntry_k(input) +} +func (cmc *SynchronizedLocalCMC) UpdateUsageMetadata(input AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.UpdateUsageMetadata(input) +} +func (cmc *SynchronizedLocalCMC) UpdateUsageMetadata_k(input AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.UpdateUsageMetadata_k(input) +} +func (cmc *SynchronizedLocalCMC) GetCacheEntry(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.GetCacheEntry(input) +} +func (cmc *SynchronizedLocalCMC) GetCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.GetCacheEntry_k(input) +} +func (cmc *SynchronizedLocalCMC) DeleteCacheEntry(input AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.DeleteCacheEntry(input) +} +func (cmc *SynchronizedLocalCMC) DeleteCacheEntry_k(input AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) Wrappers.Result { + cmc.Lock() + defer cmc.Unlock() + return cmc.localCMC.DeleteCacheEntry_k(input) +} + +func (*SynchronizedLocalCMC) String() string { + return "SynchronizedLocalCMC" +} diff --git a/releases/go/mpl/Utils/Utils.go b/releases/go/mpl/Utils/Utils.go new file mode 100644 index 000000000..5d60abc4d --- /dev/null +++ b/releases/go/mpl/Utils/Utils.go @@ -0,0 +1,282 @@ +// Package Utils +// Dafny module Utils compiled into Go + +package Utils + +import ( + os "os" + + m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes" + m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb" + m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms" + m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites" + m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing" + m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations" + m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring" + m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring" + m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring" + m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" + m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" + m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring" + m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring" + m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" + m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring" + m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" + m_CMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CMM" + m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants" + m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" + m_Commitment "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Commitment" + m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" + m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" + m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" + m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" + m_DefaultCMM "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultCMM" + m_DefaultClientSupplier "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DefaultClientSupplier" + m_Defaults "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Defaults" + m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring" + m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping" + m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" + m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" + m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" + m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" + m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" + m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" + m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" + m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" + m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC" + m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" + m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" + m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring" + m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring" + m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" + m_RawAESKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawAESKeyring" + m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring" + m_RawRSAKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawRSAKeyring" + m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker" + m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC" + m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" + m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" + m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC" + m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" + m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" + m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" + m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" + m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" + m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" + m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" + m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" + m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" + m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" + m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" + m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" + m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" + m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" + m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" + m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" + m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" + m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" + m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" + m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" + m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" + m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" + m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" + m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" + m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" + m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" + m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" + m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" + m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" + m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" + m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" + m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" + m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" + m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" + m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" + m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" + m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" + m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" + m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" + m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" + m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" + m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" + m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" + m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_BoundedInts.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary_Sequence.Dummy__ +var _ m_StandardLibrary_String.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_AwsCryptographyPrimitivesTypes.Dummy__ +var _ m_Random.Dummy__ +var _ m_Digest.Dummy__ +var _ m_WrappedHMAC.Dummy__ +var _ m_HKDF.Dummy__ +var _ m_WrappedHKDF.Dummy__ +var _ m_KdfCtr.Dummy__ +var _ m_AwsCryptographyPrimitivesOperations.Dummy__ +var _ m_AtomicPrimitives.Dummy__ +var _ m_ComAmazonawsDynamodbTypes.Dummy__ +var _ m_ComAmazonawsKmsTypes.Dummy__ +var _ m_Relations.Dummy__ +var _ m_Seq_MergeSort.Dummy__ +var _ m__Math.Dummy__ +var _ m_Seq.Dummy__ +var _ m__Unicode.Dummy__ +var _ m_Functions.Dummy__ +var _ m_Utf8EncodingForm.Dummy__ +var _ m_Utf16EncodingForm.Dummy__ +var _ m_UnicodeStrings.Dummy__ +var _ m_FileIO.Dummy__ +var _ m_GeneralInternals.Dummy__ +var _ m_MulInternalsNonlinear.Dummy__ +var _ m_MulInternals.Dummy__ +var _ m_Mul.Dummy__ +var _ m_ModInternalsNonlinear.Dummy__ +var _ m_DivInternalsNonlinear.Dummy__ +var _ m_ModInternals.Dummy__ +var _ m_DivInternals.Dummy__ +var _ m_DivMod.Dummy__ +var _ m_Power.Dummy__ +var _ m_Logarithm.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_Streams.Dummy__ +var _ m_Sorting.Dummy__ +var _ m_HexStrings.Dummy__ +var _ m_GetOpt.Dummy__ +var _ m_FloatCompare.Dummy__ +var _ m_Base64.Dummy__ +var _ m_Base64Lemmas.Dummy__ +var _ m_Actions.Dummy__ +var _ m_AwsCryptographyKeyStoreTypes.Dummy__ +var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ +var _ m_AwsArnParsing.Dummy__ +var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ +var _ m_AwsKmsUtils.Dummy__ +var _ m_KeyStoreErrorMessages.Dummy__ +var _ m_KmsArn.Dummy__ +var _ m_Structure.Dummy__ +var _ m_KMSKeystoreOperations.Dummy__ +var _ m_DDBKeystoreOperations.Dummy__ +var _ m_CreateKeys.Dummy__ +var _ m_CreateKeyStoreTable.Dummy__ +var _ m_GetKeys.Dummy__ +var _ m_AwsCryptographyKeyStoreOperations.Dummy__ +var _ m_Com_Amazonaws_Kms.Dummy__ +var _ m_Com_Amazonaws_Dynamodb.Dummy__ +var _ m_KeyStore.Dummy__ +var _ m_AlgorithmSuites.Dummy__ +var _ m_Materials.Dummy__ +var _ m_Keyring.Dummy__ +var _ m_MultiKeyring.Dummy__ +var _ m_AwsKmsMrkAreUnique.Dummy__ +var _ m_Constants.Dummy__ +var _ m_MaterialWrapping.Dummy__ +var _ m_CanonicalEncryptionContext.Dummy__ +var _ m_IntermediateKeyWrapping.Dummy__ +var _ m_EdkWrapping.Dummy__ +var _ m_ErrorMessages.Dummy__ +var _ m_AwsKmsKeyring.Dummy__ +var _ m_StrictMultiKeyring.Dummy__ +var _ m_AwsKmsDiscoveryKeyring.Dummy__ +var _ m_DiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__ +var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__ +var _ m_AwsKmsMrkKeyring.Dummy__ +var _ m_MrkAwareStrictMultiKeyring.Dummy__ +var _ m_LocalCMC.Dummy__ +var _ m_SynchronizedLocalCMC.Dummy__ +var _ m_StormTracker.Dummy__ +var _ m_StormTrackingCMC.Dummy__ +var _ m_CacheConstants.Dummy__ +var _ m_AwsKmsHierarchicalKeyring.Dummy__ +var _ m_AwsKmsRsaKeyring.Dummy__ +var _ m_EcdhEdkWrapping.Dummy__ +var _ m_RawECDHKeyring.Dummy__ +var _ m_AwsKmsEcdhKeyring.Dummy__ +var _ m_RawAESKeyring.Dummy__ +var _ m_RawRSAKeyring.Dummy__ +var _ m_CMM.Dummy__ +var _ m_Defaults.Dummy__ +var _ m_Commitment.Dummy__ +var _ m_DefaultCMM.Dummy__ +var _ m_DefaultClientSupplier.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "Utils.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) GetPublicKey(curveSpec m_AwsCryptographyPrimitivesTypes.ECDHCurveSpec, privateKey m_AwsCryptographyPrimitivesTypes.ECCPrivateKey, crypto *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) + _ = res + var _0_maybePublicKey m_Wrappers.Result + _ = _0_maybePublicKey + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (crypto).GetPublicKeyFromPrivateKey(m_AwsCryptographyPrimitivesTypes.Companion_GetPublicKeyFromPrivateKeyInput_.Create_GetPublicKeyFromPrivateKeyInput_(curveSpec, privateKey)) + _0_maybePublicKey = _out0 + var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_GetPublicKeyFromPrivateKeyOutput_.Default()) + _ = _1_valueOrError0 + _1_valueOrError0 = (_0_maybePublicKey).MapFailure(func(coer131 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { + return func(arg132 interface{}) interface{} { + return coer131(arg132.(m_AwsCryptographyPrimitivesTypes.Error)) + } + }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { + return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) + })) + if (_1_valueOrError0).IsFailure() { + res = (_1_valueOrError0).PropagateFailure() + return res + } + var _3_keyPairOutput m_AwsCryptographyPrimitivesTypes.GetPublicKeyFromPrivateKeyOutput + _ = _3_keyPairOutput + _3_keyPairOutput = (_1_valueOrError0).Extract().(m_AwsCryptographyPrimitivesTypes.GetPublicKeyFromPrivateKeyOutput) + res = m_Wrappers.Companion_Result_.Create_Success_((_3_keyPairOutput).Dtor_publicKey()) + return res +} + +// End of class Default__ diff --git a/releases/go/mpl/awscryptographykeystoresmithygenerated/api_client.go b/releases/go/mpl/awscryptographykeystoresmithygenerated/api_client.go new file mode 100644 index 000000000..56e706732 --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygenerated/api_client.go @@ -0,0 +1,164 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygenerated + +import ( + "context" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" +) + +type Client struct { + DafnyClient AwsCryptographyKeyStoreTypes.IKeyStoreClient +} + +func NewClient(clientConfig awscryptographykeystoresmithygeneratedtypes.KeyStoreConfig) (*Client, error) { + var dafnyConfig = KeyStoreConfig_ToDafny(clientConfig) + var dafny_response = KeyStore.Companion_Default___.KeyStore(dafnyConfig) + if dafny_response.Is_Failure() { + panic("Client construction failed. This should never happen") + } + var dafnyClient = dafny_response.Extract().(AwsCryptographyKeyStoreTypes.IKeyStoreClient) + client := &Client{dafnyClient} + return client, nil +} + +func (client *Client) GetKeyStoreInfo(ctx context.Context) (*awscryptographykeystoresmithygeneratedtypes.GetKeyStoreInfoOutput, error) { + + var dafny_response = client.DafnyClient.GetKeyStoreInfo() + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetKeyStoreInfoOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput)) + return &native_response, nil + +} + +func (client *Client) CreateKeyStore(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreInput) (*awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.CreateKeyStoreInput = CreateKeyStoreInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateKeyStore(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = CreateKeyStoreOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput)) + return &native_response, nil + +} + +func (client *Client) CreateKey(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.CreateKeyInput) (*awscryptographykeystoresmithygeneratedtypes.CreateKeyOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.CreateKeyInput = CreateKeyInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = CreateKeyOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.CreateKeyOutput)) + return &native_response, nil + +} + +func (client *Client) VersionKey(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.VersionKeyInput) (*awscryptographykeystoresmithygeneratedtypes.VersionKeyOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.VersionKeyInput = VersionKeyInput_ToDafny(params) + var dafny_response = client.DafnyClient.VersionKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = VersionKeyOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.VersionKeyOutput)) + return &native_response, nil + +} + +func (client *Client) GetActiveBranchKey(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyInput) (*awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput = GetActiveBranchKeyInput_ToDafny(params) + var dafny_response = client.DafnyClient.GetActiveBranchKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetActiveBranchKeyOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput)) + return &native_response, nil + +} + +func (client *Client) GetBranchKeyVersion(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionInput) (*awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput = GetBranchKeyVersionInput_ToDafny(params) + var dafny_response = client.DafnyClient.GetBranchKeyVersion(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetBranchKeyVersionOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput)) + return &native_response, nil + +} + +func (client *Client) GetBeaconKey(ctx context.Context, params awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyInput) (*awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyOutput, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyKeyStoreTypes.GetBeaconKeyInput = GetBeaconKeyInput_ToDafny(params) + var dafny_response = client.DafnyClient.GetBeaconKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyKeyStoreTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetBeaconKeyOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput)) + return &native_response, nil + +} diff --git a/releases/go/mpl/awscryptographykeystoresmithygenerated/to_dafny.go b/releases/go/mpl/awscryptographykeystoresmithygenerated/to_dafny.go new file mode 100644 index 000000000..065825c4a --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygenerated/to_dafny.go @@ -0,0 +1,612 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygenerated + +import ( + "unicode/utf8" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/DynamoDBwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/comamazonawsdynamodbsmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/KMSwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/comamazonawskmssmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" + "github.com/aws/aws-sdk-go-v2/service/kms" + "github.com/aws/smithy-go" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +func CreateKeyInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.CreateKeyInput) AwsCryptographyKeyStoreTypes.CreateKeyInput { + + return func() AwsCryptographyKeyStoreTypes.CreateKeyInput { + + return AwsCryptographyKeyStoreTypes.Companion_CreateKeyInput_.Create_CreateKeyInput_(aws_cryptography_keyStore_CreateKeyInput_branchKeyIdentifier_ToDafny(nativeInput.BranchKeyIdentifier), aws_cryptography_keyStore_CreateKeyInput_encryptionContext_ToDafny(nativeInput.EncryptionContext)) + }() + +} + +func CreateKeyOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.CreateKeyOutput) AwsCryptographyKeyStoreTypes.CreateKeyOutput { + + return func() AwsCryptographyKeyStoreTypes.CreateKeyOutput { + + return AwsCryptographyKeyStoreTypes.Companion_CreateKeyOutput_.Create_CreateKeyOutput_(aws_cryptography_keyStore_CreateKeyOutput_branchKeyIdentifier_ToDafny(nativeOutput.BranchKeyIdentifier)) + }() + +} + +func CreateKeyStoreInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreInput) AwsCryptographyKeyStoreTypes.CreateKeyStoreInput { + + return func() AwsCryptographyKeyStoreTypes.CreateKeyStoreInput { + + return AwsCryptographyKeyStoreTypes.Companion_CreateKeyStoreInput_.Create_CreateKeyStoreInput_() + }() + +} + +func CreateKeyStoreOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreOutput) AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput { + + return func() AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput { + + return AwsCryptographyKeyStoreTypes.Companion_CreateKeyStoreOutput_.Create_CreateKeyStoreOutput_(aws_cryptography_keyStore_CreateKeyStoreOutput_tableArn_ToDafny(nativeOutput.TableArn)) + }() + +} + +func GetActiveBranchKeyInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyInput) AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput { + + return func() AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput { + + return AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyInput_.Create_GetActiveBranchKeyInput_(aws_cryptography_keyStore_GetActiveBranchKeyInput_branchKeyIdentifier_ToDafny(nativeInput.BranchKeyIdentifier)) + }() + +} + +func GetActiveBranchKeyOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyOutput) AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput { + + return func() AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput { + + return AwsCryptographyKeyStoreTypes.Companion_GetActiveBranchKeyOutput_.Create_GetActiveBranchKeyOutput_(aws_cryptography_keyStore_GetActiveBranchKeyOutput_branchKeyMaterials_ToDafny(nativeOutput.BranchKeyMaterials)) + }() + +} + +func GetBeaconKeyInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyInput) AwsCryptographyKeyStoreTypes.GetBeaconKeyInput { + + return func() AwsCryptographyKeyStoreTypes.GetBeaconKeyInput { + + return AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyInput_.Create_GetBeaconKeyInput_(aws_cryptography_keyStore_GetBeaconKeyInput_branchKeyIdentifier_ToDafny(nativeInput.BranchKeyIdentifier)) + }() + +} + +func GetBeaconKeyOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyOutput) AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput { + + return func() AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput { + + return AwsCryptographyKeyStoreTypes.Companion_GetBeaconKeyOutput_.Create_GetBeaconKeyOutput_(aws_cryptography_keyStore_GetBeaconKeyOutput_beaconKeyMaterials_ToDafny(nativeOutput.BeaconKeyMaterials)) + }() + +} + +func GetBranchKeyVersionInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionInput) AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput { + + return func() AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput { + + return AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionInput_.Create_GetBranchKeyVersionInput_(aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyIdentifier_ToDafny(nativeInput.BranchKeyIdentifier), aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyVersion_ToDafny(nativeInput.BranchKeyVersion)) + }() + +} + +func GetBranchKeyVersionOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionOutput) AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput { + + return func() AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput { + + return AwsCryptographyKeyStoreTypes.Companion_GetBranchKeyVersionOutput_.Create_GetBranchKeyVersionOutput_(aws_cryptography_keyStore_GetBranchKeyVersionOutput_branchKeyMaterials_ToDafny(nativeOutput.BranchKeyMaterials)) + }() + +} + +func GetKeyStoreInfoOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.GetKeyStoreInfoOutput) AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput { + + return func() AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput { + + return AwsCryptographyKeyStoreTypes.Companion_GetKeyStoreInfoOutput_.Create_GetKeyStoreInfoOutput_(aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreId_ToDafny(nativeOutput.KeyStoreId), aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreName_ToDafny(nativeOutput.KeyStoreName), aws_cryptography_keyStore_GetKeyStoreInfoOutput_logicalKeyStoreName_ToDafny(nativeOutput.LogicalKeyStoreName), aws_cryptography_keyStore_GetKeyStoreInfoOutput_grantTokens_ToDafny(nativeOutput.GrantTokens), aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_ToDafny(nativeOutput.KmsConfiguration)) + }() + +} + +func VersionKeyInput_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.VersionKeyInput) AwsCryptographyKeyStoreTypes.VersionKeyInput { + + return func() AwsCryptographyKeyStoreTypes.VersionKeyInput { + + return AwsCryptographyKeyStoreTypes.Companion_VersionKeyInput_.Create_VersionKeyInput_(aws_cryptography_keyStore_VersionKeyInput_branchKeyIdentifier_ToDafny(nativeInput.BranchKeyIdentifier)) + }() + +} + +func VersionKeyOutput_ToDafny(nativeOutput awscryptographykeystoresmithygeneratedtypes.VersionKeyOutput) AwsCryptographyKeyStoreTypes.VersionKeyOutput { + + return func() AwsCryptographyKeyStoreTypes.VersionKeyOutput { + + return AwsCryptographyKeyStoreTypes.Companion_VersionKeyOutput_.Create_VersionKeyOutput_() + }() + +} + +func KeyStoreException_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.KeyStoreException) AwsCryptographyKeyStoreTypes.Error { + return func() AwsCryptographyKeyStoreTypes.Error { + + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_KeyStoreException_(aws_cryptography_keyStore_KeyStoreException_message_ToDafny(nativeInput.Message)) + }() + +} + +func CollectionOfErrors_Input_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.CollectionOfErrors) AwsCryptographyKeyStoreTypes.Error { + var e []interface{} + for _, i2 := range nativeInput.ListOfErrors { + e = append(e, Error_ToDafny(i2)) + } + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) +} +func OpaqueError_Input_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.OpaqueError) AwsCryptographyKeyStoreTypes.Error { + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) +} + +func Error_ToDafny(err error) AwsCryptographyKeyStoreTypes.Error { + switch err.(type) { + // Service Errors + case awscryptographykeystoresmithygeneratedtypes.KeyStoreException: + return KeyStoreException_ToDafny(err.(awscryptographykeystoresmithygeneratedtypes.KeyStoreException)) + + //DependentErrors + case *smithy.OperationError: + if err.(*smithy.OperationError).Service() == "DynamoDB" { + DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err) + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError) + } + if err.(*smithy.OperationError).Service() == "KMS" { + KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err) + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError) + } + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_Opaque_(err) + + case smithy.APIError: + DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err) + if !DynamoDBError.Is_OpaqueWithText() { + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError) + } + KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err) + if !KMSError.Is_OpaqueWithText() { + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError) + } + return AwsCryptographyKeyStoreTypes.Companion_Error_.Create_Opaque_(err) + + //Unmodelled Errors + case awscryptographykeystoresmithygeneratedtypes.CollectionOfErrors: + return CollectionOfErrors_Input_ToDafny(err.(awscryptographykeystoresmithygeneratedtypes.CollectionOfErrors)) + + default: + error, ok := err.(awscryptographykeystoresmithygeneratedtypes.OpaqueError) + if !ok { + panic("Error is not an OpaqueError") + } + return OpaqueError_Input_ToDafny(error) + } +} + +func KeyStoreConfig_ToDafny(nativeInput awscryptographykeystoresmithygeneratedtypes.KeyStoreConfig) AwsCryptographyKeyStoreTypes.KeyStoreConfig { + return func() AwsCryptographyKeyStoreTypes.KeyStoreConfig { + + return AwsCryptographyKeyStoreTypes.Companion_KeyStoreConfig_.Create_KeyStoreConfig_(aws_cryptography_keyStore_KeyStoreConfig_ddbTableName_ToDafny(nativeInput.DdbTableName), aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_ToDafny(nativeInput.KmsConfiguration), aws_cryptography_keyStore_KeyStoreConfig_logicalKeyStoreName_ToDafny(nativeInput.LogicalKeyStoreName), aws_cryptography_keyStore_KeyStoreConfig_id_ToDafny(nativeInput.Id), aws_cryptography_keyStore_KeyStoreConfig_grantTokens_ToDafny(nativeInput.GrantTokens), aws_cryptography_keyStore_KeyStoreConfig_ddbClient_ToDafny(nativeInput.DdbClient), aws_cryptography_keyStore_KeyStoreConfig_kmsClient_ToDafny(nativeInput.KmsClient)) + }() + +} + +func aws_cryptography_keyStore_CreateKeyInput_branchKeyIdentifier_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_keyStore_CreateKeyInput_encryptionContext_ToDafny(input map[string]string) Wrappers.Option { + return func() Wrappers.Option { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_EncryptionContext_key_ToDafny(key), aws_cryptography_keyStore_EncryptionContext_value_ToDafny(val)) + } + return Wrappers.Companion_Option_.Create_Some_(fieldValue.ToMap()) + }() +} + +func aws_cryptography_keyStore_EncryptionContext_key_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_EncryptionContext_value_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_CreateKeyOutput_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_CreateKeyStoreOutput_tableArn_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetActiveBranchKeyInput_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetActiveBranchKeyOutput_branchKeyMaterials_ToDafny(input awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials) AwsCryptographyKeyStoreTypes.BranchKeyMaterials { + return func() AwsCryptographyKeyStoreTypes.BranchKeyMaterials { + + return AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Create_BranchKeyMaterials_(aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_ToDafny(input.BranchKeyIdentifier), aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_ToDafny(input.BranchKeyVersion), aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_keyStore_BranchKeyMaterials_branchKey_ToDafny(input.BranchKey)) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_EncryptionContext_key_ToDafny(key), aws_cryptography_keyStore_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_keyStore_GetBeaconKeyInput_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetBeaconKeyOutput_beaconKeyMaterials_ToDafny(input awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials) AwsCryptographyKeyStoreTypes.BeaconKeyMaterials { + return func() AwsCryptographyKeyStoreTypes.BeaconKeyMaterials { + + return AwsCryptographyKeyStoreTypes.Companion_BeaconKeyMaterials_.Create_BeaconKeyMaterials_(aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_ToDafny(input.BeaconKeyIdentifier), aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_ToDafny(input.BeaconKey), aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_ToDafny(input.HmacKeys)) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_EncryptionContext_key_ToDafny(key), aws_cryptography_keyStore_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_ToDafny(input map[string][]byte) Wrappers.Option { + return func() Wrappers.Option { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_HmacKeyMap_key_ToDafny(key), aws_cryptography_keyStore_HmacKeyMap_value_ToDafny(val)) + } + return Wrappers.Companion_Option_.Create_Some_(fieldValue.ToMap()) + }() +} + +func aws_cryptography_keyStore_HmacKeyMap_key_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_HmacKeyMap_value_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyVersion_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetBranchKeyVersionOutput_branchKeyMaterials_ToDafny(input awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials) AwsCryptographyKeyStoreTypes.BranchKeyMaterials { + return func() AwsCryptographyKeyStoreTypes.BranchKeyMaterials { + + return AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Create_BranchKeyMaterials_(aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_ToDafny(input.BranchKeyIdentifier), aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_ToDafny(input.BranchKeyVersion), aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_keyStore_BranchKeyMaterials_branchKey_ToDafny(input.BranchKey)) + }() +} + +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_logicalKeyStoreName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_grantTokens_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_keyStore_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_keyStore_GrantTokenList_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_ToDafny(input awscryptographykeystoresmithygeneratedtypes.KMSConfiguration) AwsCryptographyKeyStoreTypes.KMSConfiguration { + return func() AwsCryptographyKeyStoreTypes.KMSConfiguration { + + switch input.(type) { + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_kmsKeyArn_(inputToConversion.UnwrapOr(nil).(dafny.Sequence)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_kmsMRKeyArn_(inputToConversion.UnwrapOr(nil).(dafny.Sequence)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_discovery_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_discovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.Discovery)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_mrDiscovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.MRDiscovery)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_ToDafny(input string) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(input)...)) + }() +} + +func aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_ToDafny(input string) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(input)...)) + }() +} + +func aws_cryptography_keyStore_KMSConfiguration_discovery_ToDafny(input awscryptographykeystoresmithygeneratedtypes.Discovery) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyKeyStoreTypes.Companion_Discovery_.Create_Discovery_()) + }() +} + +func aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_ToDafny(input awscryptographykeystoresmithygeneratedtypes.MRDiscovery) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyKeyStoreTypes.Companion_MRDiscovery_.Create_MRDiscovery_(aws_cryptography_keyStore_MRDiscovery_region_ToDafny(input.Region))) + }() +} + +func aws_cryptography_keyStore_MRDiscovery_region_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_VersionKeyInput_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_KeyStoreException_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_ddbTableName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_ToDafny(input awscryptographykeystoresmithygeneratedtypes.KMSConfiguration) AwsCryptographyKeyStoreTypes.KMSConfiguration { + return func() AwsCryptographyKeyStoreTypes.KMSConfiguration { + + switch input.(type) { + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_kmsKeyArn_(inputToConversion.UnwrapOr(nil).(dafny.Sequence)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_kmsMRKeyArn_(inputToConversion.UnwrapOr(nil).(dafny.Sequence)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_discovery_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_discovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.Discovery)) + case *awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery: + var inputToConversion = aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_ToDafny(input.(*awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery).Value) + return AwsCryptographyKeyStoreTypes.CompanionStruct_KMSConfiguration_{}.Create_mrDiscovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.MRDiscovery)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_logicalKeyStoreName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_id_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_keyStore_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_ddbClient_ToDafny(input *dynamodb.Client) Wrappers.Option { + return func() Wrappers.Option { + if (input) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(&DynamoDBwrapped.Shim{Client: input}) + }() +} + +func aws_cryptography_keyStore_KeyStoreConfig_kmsClient_ToDafny(input *kms.Client) Wrappers.Option { + return func() Wrappers.Option { + if (input) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(&KMSwrapped.Shim{Client: input}) + }() +} diff --git a/releases/go/mpl/awscryptographykeystoresmithygenerated/to_native.go b/releases/go/mpl/awscryptographykeystoresmithygenerated/to_native.go new file mode 100644 index 000000000..055492519 --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygenerated/to_native.go @@ -0,0 +1,763 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/DynamoDBwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/comamazonawsdynamodbsmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/KMSwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/comamazonawskmssmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" + "github.com/aws/aws-sdk-go-v2/service/kms" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +func CreateKeyInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.CreateKeyInput) awscryptographykeystoresmithygeneratedtypes.CreateKeyInput { + + return awscryptographykeystoresmithygeneratedtypes.CreateKeyInput{BranchKeyIdentifier: aws_cryptography_keyStore_CreateKeyInput_branchKeyIdentifier_FromDafny(dafnyInput.Dtor_branchKeyIdentifier().UnwrapOr(nil)), + EncryptionContext: aws_cryptography_keyStore_CreateKeyInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext().UnwrapOr(nil)), + } + +} + +func CreateKeyOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.CreateKeyOutput) awscryptographykeystoresmithygeneratedtypes.CreateKeyOutput { + + return awscryptographykeystoresmithygeneratedtypes.CreateKeyOutput{BranchKeyIdentifier: aws_cryptography_keyStore_CreateKeyOutput_branchKeyIdentifier_FromDafny(dafnyOutput.Dtor_branchKeyIdentifier())} + +} + +func CreateKeyStoreInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.CreateKeyStoreInput) awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreInput { + + return awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreInput{} + +} + +func CreateKeyStoreOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.CreateKeyStoreOutput) awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreOutput { + + return awscryptographykeystoresmithygeneratedtypes.CreateKeyStoreOutput{TableArn: aws_cryptography_keyStore_CreateKeyStoreOutput_tableArn_FromDafny(dafnyOutput.Dtor_tableArn())} + +} + +func GetActiveBranchKeyInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.GetActiveBranchKeyInput) awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyInput { + + return awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyInput{BranchKeyIdentifier: aws_cryptography_keyStore_GetActiveBranchKeyInput_branchKeyIdentifier_FromDafny(dafnyInput.Dtor_branchKeyIdentifier())} + +} + +func GetActiveBranchKeyOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.GetActiveBranchKeyOutput) awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyOutput { + + return awscryptographykeystoresmithygeneratedtypes.GetActiveBranchKeyOutput{BranchKeyMaterials: aws_cryptography_keyStore_GetActiveBranchKeyOutput_branchKeyMaterials_FromDafny(dafnyOutput.Dtor_branchKeyMaterials())} + +} + +func GetBeaconKeyInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.GetBeaconKeyInput) awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyInput { + + return awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyInput{BranchKeyIdentifier: aws_cryptography_keyStore_GetBeaconKeyInput_branchKeyIdentifier_FromDafny(dafnyInput.Dtor_branchKeyIdentifier())} + +} + +func GetBeaconKeyOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.GetBeaconKeyOutput) awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyOutput { + + return awscryptographykeystoresmithygeneratedtypes.GetBeaconKeyOutput{BeaconKeyMaterials: aws_cryptography_keyStore_GetBeaconKeyOutput_beaconKeyMaterials_FromDafny(dafnyOutput.Dtor_beaconKeyMaterials())} + +} + +func GetBranchKeyVersionInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.GetBranchKeyVersionInput) awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionInput { + + return awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionInput{BranchKeyIdentifier: aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyIdentifier_FromDafny(dafnyInput.Dtor_branchKeyIdentifier()), + BranchKeyVersion: aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyVersion_FromDafny(dafnyInput.Dtor_branchKeyVersion()), + } + +} + +func GetBranchKeyVersionOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.GetBranchKeyVersionOutput) awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionOutput { + + return awscryptographykeystoresmithygeneratedtypes.GetBranchKeyVersionOutput{BranchKeyMaterials: aws_cryptography_keyStore_GetBranchKeyVersionOutput_branchKeyMaterials_FromDafny(dafnyOutput.Dtor_branchKeyMaterials())} + +} + +func GetKeyStoreInfoOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.GetKeyStoreInfoOutput) awscryptographykeystoresmithygeneratedtypes.GetKeyStoreInfoOutput { + + return awscryptographykeystoresmithygeneratedtypes.GetKeyStoreInfoOutput{KeyStoreId: aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreId_FromDafny(dafnyOutput.Dtor_keyStoreId()), + KeyStoreName: aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreName_FromDafny(dafnyOutput.Dtor_keyStoreName()), + LogicalKeyStoreName: aws_cryptography_keyStore_GetKeyStoreInfoOutput_logicalKeyStoreName_FromDafny(dafnyOutput.Dtor_logicalKeyStoreName()), + GrantTokens: aws_cryptography_keyStore_GetKeyStoreInfoOutput_grantTokens_FromDafny(dafnyOutput.Dtor_grantTokens()), + KmsConfiguration: aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_FromDafny(dafnyOutput.Dtor_kmsConfiguration()), + } + +} + +func VersionKeyInput_FromDafny(dafnyInput AwsCryptographyKeyStoreTypes.VersionKeyInput) awscryptographykeystoresmithygeneratedtypes.VersionKeyInput { + + return awscryptographykeystoresmithygeneratedtypes.VersionKeyInput{BranchKeyIdentifier: aws_cryptography_keyStore_VersionKeyInput_branchKeyIdentifier_FromDafny(dafnyInput.Dtor_branchKeyIdentifier())} + +} + +func VersionKeyOutput_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.VersionKeyOutput) awscryptographykeystoresmithygeneratedtypes.VersionKeyOutput { + + return awscryptographykeystoresmithygeneratedtypes.VersionKeyOutput{} + +} + +func KeyStoreException_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.Error) awscryptographykeystoresmithygeneratedtypes.KeyStoreException { + return awscryptographykeystoresmithygeneratedtypes.KeyStoreException{Message: aws_cryptography_keyStore_KeyStoreException_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func CollectionOfErrors_Output_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.Error) awscryptographykeystoresmithygeneratedtypes.CollectionOfErrors { + listOfErrors := dafnyOutput.Dtor_list() + message := dafnyOutput.Dtor_message() + t := awscryptographykeystoresmithygeneratedtypes.CollectionOfErrors{} + for i := dafny.Iterate(listOfErrors); ; { + val, ok := i() + if !ok { + break + } + err := val.(AwsCryptographyKeyStoreTypes.Error) + t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) + + } + t.Message = func() string { + var s string + for i := dafny.Iterate(message); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() + return t +} +func OpaqueError_Output_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.Error) awscryptographykeystoresmithygeneratedtypes.OpaqueError { + return awscryptographykeystoresmithygeneratedtypes.OpaqueError{ + ErrObject: dafnyOutput.Dtor_obj(), + } +} + +func Error_FromDafny(err AwsCryptographyKeyStoreTypes.Error) error { + // Service Errors + if err.Is_KeyStoreException() { + return KeyStoreException_FromDafny(err) + } + + //DependentErrors + if err.Is_ComAmazonawsDynamodb() { + return comamazonawsdynamodbsmithygenerated.Error_FromDafny(err.Dtor_ComAmazonawsDynamodb()) + } + + if err.Is_ComAmazonawsKms() { + return comamazonawskmssmithygenerated.Error_FromDafny(err.Dtor_ComAmazonawsKms()) + } + + //Unmodelled Errors + if err.Is_CollectionOfErrors() { + return CollectionOfErrors_Output_FromDafny(err) + } + + return OpaqueError_Output_FromDafny(err) +} + +func KeyStoreConfig_FromDafny(dafnyOutput AwsCryptographyKeyStoreTypes.KeyStoreConfig) awscryptographykeystoresmithygeneratedtypes.KeyStoreConfig { + return awscryptographykeystoresmithygeneratedtypes.KeyStoreConfig{DdbTableName: aws_cryptography_keyStore_KeyStoreConfig_ddbTableName_FromDafny(dafnyOutput.Dtor_ddbTableName()), + KmsConfiguration: aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_FromDafny(dafnyOutput.Dtor_kmsConfiguration()), + LogicalKeyStoreName: aws_cryptography_keyStore_KeyStoreConfig_logicalKeyStoreName_FromDafny(dafnyOutput.Dtor_logicalKeyStoreName()), + Id: aws_cryptography_keyStore_KeyStoreConfig_id_FromDafny(dafnyOutput.Dtor_id().UnwrapOr(nil)), + GrantTokens: aws_cryptography_keyStore_KeyStoreConfig_grantTokens_FromDafny(dafnyOutput.Dtor_grantTokens().UnwrapOr(nil)), + DdbClient: aws_cryptography_keyStore_KeyStoreConfig_ddbClient_FromDafny(dafnyOutput.Dtor_ddbClient().UnwrapOr(nil)), + KmsClient: aws_cryptography_keyStore_KeyStoreConfig_kmsClient_FromDafny(dafnyOutput.Dtor_kmsClient().UnwrapOr(nil)), + } + +} + +func aws_cryptography_keyStore_CreateKeyInput_branchKeyIdentifier_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_CreateKeyInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_EncryptionContext_key_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_EncryptionContext_value_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_CreateKeyOutput_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_CreateKeyStoreOutput_tableArn_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetActiveBranchKeyInput_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetActiveBranchKeyOutput_branchKeyMaterials_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials { + return awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials{BranchKeyIdentifier: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyIdentifier()), + BranchKeyVersion: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyVersion()), + EncryptionContext: aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_encryptionContext()), + BranchKey: aws_cryptography_keyStore_BranchKeyMaterials_branchKey_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKey()), + } +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_keyStore_GetBeaconKeyInput_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetBeaconKeyOutput_beaconKeyMaterials_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials { + return awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials{BeaconKeyIdentifier: aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_beaconKeyIdentifier()), + EncryptionContext: aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_encryptionContext()), + BeaconKey: aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_beaconKey().UnwrapOr(nil)), + HmacKeys: aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_hmacKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_FromDafny(input interface{}) map[string][]byte { + var m map[string][]byte = make(map[string][]byte) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_HmacKeyMap_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_HmacKeyMap_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_HmacKeyMap_key_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_HmacKeyMap_value_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetBranchKeyVersionInput_branchKeyVersion_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetBranchKeyVersionOutput_branchKeyMaterials_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials { + return awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials{BranchKeyIdentifier: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyIdentifier()), + BranchKeyVersion: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyVersion()), + EncryptionContext: aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_encryptionContext()), + BranchKey: aws_cryptography_keyStore_BranchKeyMaterials_branchKey_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKey()), + } +} +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_keyStoreName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_logicalKeyStoreName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_grantTokens_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_keyStore_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_keyStore_GrantTokenList_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.KMSConfiguration { + var union awscryptographykeystoresmithygeneratedtypes.KMSConfiguration + + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_kmsKeyArn() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_kmsKeyArn()) + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn{ + Value: (aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_kmsMRKeyArn() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_kmsMRKeyArn()) + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn{ + Value: (aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_discovery() { + + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery{ + Value: (aws_cryptography_keyStore_KMSConfiguration_discovery_FromDafny((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_discovery())), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_mrDiscovery() { + + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery{ + Value: (aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_FromDafny((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_mrDiscovery())), + } + } + + return union + +} +func aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KMSConfiguration_discovery_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.Discovery { + return awscryptographykeystoresmithygeneratedtypes.Discovery{} +} +func aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.MRDiscovery { + return awscryptographykeystoresmithygeneratedtypes.MRDiscovery{Region: aws_cryptography_keyStore_MRDiscovery_region_FromDafny(input.(AwsCryptographyKeyStoreTypes.MRDiscovery).Dtor_region())} +} +func aws_cryptography_keyStore_MRDiscovery_region_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_VersionKeyInput_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KeyStoreException_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KeyStoreConfig_ddbTableName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.KMSConfiguration { + var union awscryptographykeystoresmithygeneratedtypes.KMSConfiguration + + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_kmsKeyArn() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_kmsKeyArn()) + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsKeyArn{ + Value: (aws_cryptography_keyStore_KMSConfiguration_kmsKeyArn_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_kmsMRKeyArn() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_kmsMRKeyArn()) + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberkmsMRKeyArn{ + Value: (aws_cryptography_keyStore_KMSConfiguration_kmsMRKeyArn_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_discovery() { + + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMemberdiscovery{ + Value: (aws_cryptography_keyStore_KMSConfiguration_discovery_FromDafny((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_discovery())), + } + } + if (input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Is_mrDiscovery() { + + union = &awscryptographykeystoresmithygeneratedtypes.KMSConfigurationMembermrDiscovery{ + Value: (aws_cryptography_keyStore_KMSConfiguration_mrDiscovery_FromDafny((input.(AwsCryptographyKeyStoreTypes.KMSConfiguration)).Dtor_mrDiscovery())), + } + } + + return union + +} +func aws_cryptography_keyStore_KeyStoreConfig_logicalKeyStoreName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KeyStoreConfig_id_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_KeyStoreConfig_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_keyStore_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_keyStore_KeyStoreConfig_ddbClient_FromDafny(input interface{}) *dynamodb.Client { + shim, ok := input.(*DynamoDBwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_keyStore_KeyStoreConfig_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} diff --git a/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/errors.go b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/errors.go new file mode 100644 index 000000000..7753b7b83 --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/errors.go @@ -0,0 +1,17 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygeneratedtypes + +import ( + "fmt" +) + +type KeyStoreException struct { + KeyStoreBaseException + Message string + ErrorCodeOverride *string +} + +func (e KeyStoreException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} diff --git a/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/types.go b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/types.go new file mode 100644 index 000000000..90c25acc2 --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/types.go @@ -0,0 +1,436 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygeneratedtypes + +import ( + "fmt" + "unicode/utf8" + + "github.com/aws/aws-sdk-go-v2/service/dynamodb" + "github.com/aws/aws-sdk-go-v2/service/kms" +) + +type BeaconKeyMaterials struct { + BeaconKeyIdentifier string + + EncryptionContext map[string]string + + BeaconKey []byte + + HmacKeys map[string][]byte +} + +func (input BeaconKeyMaterials) Validate() error { + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_Validate() != nil { + return input.aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_Validate() + } + + return nil +} + +func (input BeaconKeyMaterials) aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} + +type BranchKeyMaterials struct { + BranchKey []byte + + BranchKeyIdentifier string + + BranchKeyVersion string + + EncryptionContext map[string]string +} + +func (input BranchKeyMaterials) Validate() error { + if !utf8.ValidString(input.BranchKeyVersion) { + return fmt.Errorf("Invalid UTF bytes %s ", input.BranchKeyVersion) + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_Validate() != nil { + return input.aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_Validate() + } + + return nil +} + +func (input BranchKeyMaterials) aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} + +type CreateKeyInput struct { + BranchKeyIdentifier *string + + EncryptionContext map[string]string +} + +func (input CreateKeyInput) Validate() error { + if input.aws_cryptography_keyStore_CreateKeyInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_keyStore_CreateKeyInput_encryptionContext_Validate() + } + + return nil +} + +func (input CreateKeyInput) aws_cryptography_keyStore_CreateKeyInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} + +type CreateKeyOutput struct { + BranchKeyIdentifier string +} + +func (input CreateKeyOutput) Validate() error { + + return nil +} + +type CreateKeyStoreInput struct { +} + +func (input CreateKeyStoreInput) Validate() error { + + return nil +} + +type CreateKeyStoreOutput struct { + TableArn string +} + +func (input CreateKeyStoreOutput) Validate() error { + if len(input.TableArn) < 1 { + return fmt.Errorf("TableArn has a minimum length of 1 but has the length of %d.", len(input.TableArn)) + } + if len(input.TableArn) > 1024 { + return fmt.Errorf("TableArn has a maximum length of 1024 but has the length of %d.", len(input.TableArn)) + } + + return nil +} + +type Discovery struct { +} + +func (input Discovery) Validate() error { + + return nil +} + +type GetActiveBranchKeyInput struct { + BranchKeyIdentifier string +} + +func (input GetActiveBranchKeyInput) Validate() error { + + return nil +} + +type GetActiveBranchKeyOutput struct { + BranchKeyMaterials BranchKeyMaterials +} + +func (input GetActiveBranchKeyOutput) Validate() error { + if input.BranchKeyMaterials.Validate() != nil { + return input.BranchKeyMaterials.Validate() + } + + return nil +} + +type GetBeaconKeyInput struct { + BranchKeyIdentifier string +} + +func (input GetBeaconKeyInput) Validate() error { + + return nil +} + +type GetBeaconKeyOutput struct { + BeaconKeyMaterials BeaconKeyMaterials +} + +func (input GetBeaconKeyOutput) Validate() error { + if input.BeaconKeyMaterials.Validate() != nil { + return input.BeaconKeyMaterials.Validate() + } + + return nil +} + +type GetBranchKeyVersionInput struct { + BranchKeyIdentifier string + + BranchKeyVersion string +} + +func (input GetBranchKeyVersionInput) Validate() error { + + return nil +} + +type GetBranchKeyVersionOutput struct { + BranchKeyMaterials BranchKeyMaterials +} + +func (input GetBranchKeyVersionOutput) Validate() error { + if input.BranchKeyMaterials.Validate() != nil { + return input.BranchKeyMaterials.Validate() + } + + return nil +} + +type MRDiscovery struct { + Region string +} + +func (input MRDiscovery) Validate() error { + if len(input.Region) < 1 { + return fmt.Errorf("RegionType has a minimum length of 1 but has the length of %d.", len(input.Region)) + } + if len(input.Region) > 32 { + return fmt.Errorf("RegionType has a maximum length of 32 but has the length of %d.", len(input.Region)) + } + + return nil +} + +type GetKeyStoreInfoOutput struct { + GrantTokens []string + + KeyStoreId string + + KeyStoreName string + + KmsConfiguration KMSConfiguration + + LogicalKeyStoreName string +} + +func (input GetKeyStoreInfoOutput) Validate() error { + if input.GrantTokens == nil { + return fmt.Errorf("input.GrantTokens is required but has a nil value.") + } + if len(input.KeyStoreName) < 3 { + return fmt.Errorf("TableName has a minimum length of 3 but has the length of %d.", len(input.KeyStoreName)) + } + if len(input.KeyStoreName) > 255 { + return fmt.Errorf("TableName has a maximum length of 255 but has the length of %d.", len(input.KeyStoreName)) + } + if input.KmsConfiguration == nil { + return fmt.Errorf("input.KmsConfiguration is required but has a nil value.") + } + if input.aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_Validate() != nil { + return input.aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_Validate() + } + + return nil +} + +func (input GetKeyStoreInfoOutput) aws_cryptography_keyStore_GetKeyStoreInfoOutput_kmsConfiguration_Validate() error { + if input.KmsConfiguration == nil { + return nil + } + switch unionType := input.KmsConfiguration.(type) { + case *KMSConfigurationMemberkmsKeyArn: + if len(unionType.Value) < 1 { + return fmt.Errorf("KeyIdType has a minimum length of 1 but has the length of %d.", len(unionType.Value)) + } + if len(unionType.Value) > 2048 { + return fmt.Errorf("KeyIdType has a maximum length of 2048 but has the length of %d.", len(unionType.Value)) + } + case *KMSConfigurationMemberkmsMRKeyArn: + if len(unionType.Value) < 1 { + return fmt.Errorf("KeyIdType has a minimum length of 1 but has the length of %d.", len(unionType.Value)) + } + if len(unionType.Value) > 2048 { + return fmt.Errorf("KeyIdType has a maximum length of 2048 but has the length of %d.", len(unionType.Value)) + } + case *KMSConfigurationMemberdiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *KMSConfigurationMembermrDiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type VersionKeyInput struct { + BranchKeyIdentifier string +} + +func (input VersionKeyInput) Validate() error { + + return nil +} + +type VersionKeyOutput struct { +} + +func (input VersionKeyOutput) Validate() error { + + return nil +} + +type DdbClientReference struct { +} + +func (input DdbClientReference) Validate() error { + + return nil +} + +type KmsClientReference struct { +} + +func (input KmsClientReference) Validate() error { + + return nil +} + +type KeyStoreConfig struct { + DdbTableName string + + KmsConfiguration KMSConfiguration + + LogicalKeyStoreName string + + DdbClient *dynamodb.Client + + GrantTokens []string + + Id *string + + KmsClient *kms.Client +} + +func (input KeyStoreConfig) Validate() error { + if len(input.DdbTableName) < 3 { + return fmt.Errorf("TableName has a minimum length of 3 but has the length of %d.", len(input.DdbTableName)) + } + if len(input.DdbTableName) > 255 { + return fmt.Errorf("TableName has a maximum length of 255 but has the length of %d.", len(input.DdbTableName)) + } + if input.KmsConfiguration == nil { + return fmt.Errorf("input.KmsConfiguration is required but has a nil value.") + } + if input.aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_Validate() != nil { + return input.aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_Validate() + } + + return nil +} + +func (input KeyStoreConfig) aws_cryptography_keyStore_KeyStoreConfig_kmsConfiguration_Validate() error { + if input.KmsConfiguration == nil { + return nil + } + switch unionType := input.KmsConfiguration.(type) { + case *KMSConfigurationMemberkmsKeyArn: + if len(unionType.Value) < 1 { + return fmt.Errorf("KeyIdType has a minimum length of 1 but has the length of %d.", len(unionType.Value)) + } + if len(unionType.Value) > 2048 { + return fmt.Errorf("KeyIdType has a maximum length of 2048 but has the length of %d.", len(unionType.Value)) + } + case *KMSConfigurationMemberkmsMRKeyArn: + if len(unionType.Value) < 1 { + return fmt.Errorf("KeyIdType has a minimum length of 1 but has the length of %d.", len(unionType.Value)) + } + if len(unionType.Value) > 2048 { + return fmt.Errorf("KeyIdType has a maximum length of 2048 but has the length of %d.", len(unionType.Value)) + } + case *KMSConfigurationMemberdiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *KMSConfigurationMembermrDiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +// KMSConfigurationMemberdiscovery +// KMSConfigurationMemberkmsKeyArn +// KMSConfigurationMemberkmsMRKeyArn +// KMSConfigurationMembermrDiscovery +type KMSConfiguration interface { + isKMSConfiguration() +} + +type KMSConfigurationMemberdiscovery struct { + Value Discovery +} + +func (*KMSConfigurationMemberdiscovery) isKMSConfiguration() {} + +type KMSConfigurationMemberkmsKeyArn struct { + Value string +} + +func (*KMSConfigurationMemberkmsKeyArn) isKMSConfiguration() {} + +type KMSConfigurationMemberkmsMRKeyArn struct { + Value string +} + +func (*KMSConfigurationMemberkmsMRKeyArn) isKMSConfiguration() {} + +type KMSConfigurationMembermrDiscovery struct { + Value MRDiscovery +} + +func (*KMSConfigurationMembermrDiscovery) isKMSConfiguration() {} + +type KeyStoreBaseException interface { + // This is a dummy method to allow type assertion since Go empty interfaces + // aren't useful for type assertion checks. No concrete class is expected to implement + // this method. This is also not exported. + interfaceBindingMethod() +} diff --git a/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/unmodelled_errors.go b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/unmodelled_errors.go new file mode 100644 index 000000000..6a297ad93 --- /dev/null +++ b/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes/unmodelled_errors.go @@ -0,0 +1,26 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographykeystoresmithygeneratedtypes + +import ( + "fmt" +) + +type CollectionOfErrors struct { + KeyStoreBaseException + ListOfErrors []error + Message string +} + +func (e CollectionOfErrors) Error() string { + return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) +} + +type OpaqueError struct { + KeyStoreBaseException + ErrObject interface{} +} + +func (e OpaqueError) Error() string { + return fmt.Sprintf("message: %v", e.ErrObject) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplier.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplier.go new file mode 100644 index 000000000..c4f0ed18e --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplier.go @@ -0,0 +1,25 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" +) + +type BranchKeyIdSupplier struct { + Impl AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier +} + +func (this *BranchKeyIdSupplier) GetBranchKeyId(params awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdInput) (*awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput = GetBranchKeyIdInput_ToDafny(params) + var dafny_response = this.Impl.GetBranchKeyId(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetBranchKeyIdOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput)) + return &native_response, nil + +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplierNativeWrapper.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplierNativeWrapper.go new file mode 100644 index 000000000..871667bb3 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/BranchKeyIdSupplierNativeWrapper.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" +) + +type BranchKeyIdSupplierNativeWrapper struct { + AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier + Impl awscryptographymaterialproviderssmithygeneratedtypes.IBranchKeyIdSupplier +} + +func (this *BranchKeyIdSupplierNativeWrapper) GetBranchKeyId(input AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput) Wrappers.Result { + var native_request = GetBranchKeyIdInput_FromDafny(input) + var native_response, native_error = this.Impl.GetBranchKeyId(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(GetBranchKeyIdOutput_ToDafny(*native_response)) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplier.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplier.go new file mode 100644 index 000000000..cbb9bd4e2 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplier.go @@ -0,0 +1,27 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-sdk-go-v2/service/kms" +) + +type ClientSupplier struct { + Impl AwsCryptographyMaterialProvidersTypes.IClientSupplier +} + +func (this *ClientSupplier) GetClient(params awscryptographymaterialproviderssmithygeneratedtypes.GetClientInput) (kms.Client, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.GetClientInput = GetClientInput_ToDafny(params) + var dafny_response = this.Impl.GetClient(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal kms.Client + return defaultVal, Error_FromDafny(err) + } + var native_response = Aws_cryptography_materialProviders_GetClientOutput_client_FromDafny(dafny_response.Dtor_value()) + return *native_response, nil + +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplierNativeWrapper.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplierNativeWrapper.go new file mode 100644 index 000000000..051546fcb --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/ClientSupplierNativeWrapper.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" +) + +type ClientSupplierNativeWrapper struct { + AwsCryptographyMaterialProvidersTypes.IClientSupplier + Impl awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier +} + +func (this *ClientSupplierNativeWrapper) GetClient(input AwsCryptographyMaterialProvidersTypes.GetClientInput) Wrappers.Result { + var native_request = GetClientInput_FromDafny(input) + var native_response, native_error = this.Impl.GetClient(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(Aws_cryptography_materialProviders_GetClientOutput_client_ToDafny(&native_response)) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCache.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCache.go new file mode 100644 index 000000000..db46a15f6 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCache.go @@ -0,0 +1,58 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" +) + +type CryptographicMaterialsCache struct { + Impl AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache +} + +func (this *CryptographicMaterialsCache) PutCacheEntry(params awscryptographymaterialproviderssmithygeneratedtypes.PutCacheEntryInput) error { + var dafny_request AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput = PutCacheEntryInput_ToDafny(params) + var dafny_response = this.Impl.PutCacheEntry(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (this *CryptographicMaterialsCache) GetCacheEntry(params awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryInput) (*awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput = GetCacheEntryInput_ToDafny(params) + var dafny_response = this.Impl.GetCacheEntry(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetCacheEntryOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput)) + return &native_response, nil + +} + +func (this *CryptographicMaterialsCache) UpdateUsageMetadata(params awscryptographymaterialproviderssmithygeneratedtypes.UpdateUsageMetadataInput) error { + var dafny_request AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput = UpdateUsageMetadataInput_ToDafny(params) + var dafny_response = this.Impl.UpdateUsageMetadata(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (this *CryptographicMaterialsCache) DeleteCacheEntry(params awscryptographymaterialproviderssmithygeneratedtypes.DeleteCacheEntryInput) error { + var dafny_request AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput = DeleteCacheEntryInput_ToDafny(params) + var dafny_response = this.Impl.DeleteCacheEntry(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCacheNativeWrapper.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCacheNativeWrapper.go new file mode 100644 index 000000000..19374a413 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsCacheNativeWrapper.go @@ -0,0 +1,51 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +type CryptographicMaterialsCacheNativeWrapper struct { + AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache + Impl awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache +} + +func (this *CryptographicMaterialsCacheNativeWrapper) PutCacheEntry(input AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) Wrappers.Result { + var native_request = PutCacheEntryInput_FromDafny(input) + var native_error = this.Impl.PutCacheEntry(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(dafny.TupleOf()) +} + +func (this *CryptographicMaterialsCacheNativeWrapper) GetCacheEntry(input AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) Wrappers.Result { + var native_request = GetCacheEntryInput_FromDafny(input) + var native_response, native_error = this.Impl.GetCacheEntry(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(GetCacheEntryOutput_ToDafny(*native_response)) +} + +func (this *CryptographicMaterialsCacheNativeWrapper) UpdateUsageMetadata(input AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) Wrappers.Result { + var native_request = UpdateUsageMetadataInput_FromDafny(input) + var native_error = this.Impl.UpdateUsageMetadata(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(dafny.TupleOf()) +} + +func (this *CryptographicMaterialsCacheNativeWrapper) DeleteCacheEntry(input AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) Wrappers.Result { + var native_request = DeleteCacheEntryInput_FromDafny(input) + var native_error = this.Impl.DeleteCacheEntry(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(dafny.TupleOf()) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManager.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManager.go new file mode 100644 index 000000000..88926baf4 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManager.go @@ -0,0 +1,38 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" +) + +type CryptographicMaterialsManager struct { + Impl AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager +} + +func (this *CryptographicMaterialsManager) GetEncryptionMaterials(params awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsInput) (*awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput = GetEncryptionMaterialsInput_ToDafny(params) + var dafny_response = this.Impl.GetEncryptionMaterials(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = GetEncryptionMaterialsOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput)) + return &native_response, nil + +} + +func (this *CryptographicMaterialsManager) DecryptMaterials(params awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsInput) (*awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput = DecryptMaterialsInput_ToDafny(params) + var dafny_response = this.Impl.DecryptMaterials(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = DecryptMaterialsOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput)) + return &native_response, nil + +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManagerNativeWrapper.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManagerNativeWrapper.go new file mode 100644 index 000000000..3d0faaa25 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/CryptographicMaterialsManagerNativeWrapper.go @@ -0,0 +1,32 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" +) + +type CryptographicMaterialsManagerNativeWrapper struct { + AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager + Impl awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager +} + +func (this *CryptographicMaterialsManagerNativeWrapper) GetEncryptionMaterials(input AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) Wrappers.Result { + var native_request = GetEncryptionMaterialsInput_FromDafny(input) + var native_response, native_error = this.Impl.GetEncryptionMaterials(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(GetEncryptionMaterialsOutput_ToDafny(*native_response)) +} + +func (this *CryptographicMaterialsManagerNativeWrapper) DecryptMaterials(input AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) Wrappers.Result { + var native_request = DecryptMaterialsInput_FromDafny(input) + var native_response, native_error = this.Impl.DecryptMaterials(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(DecryptMaterialsOutput_ToDafny(*native_response)) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/Keyring.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/Keyring.go new file mode 100644 index 000000000..dad41e289 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/Keyring.go @@ -0,0 +1,38 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" +) + +type Keyring struct { + Impl AwsCryptographyMaterialProvidersTypes.IKeyring +} + +func (this *Keyring) OnEncrypt(params awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptInput) (*awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.OnEncryptInput = OnEncryptInput_ToDafny(params) + var dafny_response = this.Impl.OnEncrypt(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = OnEncryptOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.OnEncryptOutput)) + return &native_response, nil + +} + +func (this *Keyring) OnDecrypt(params awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptInput) (*awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptOutput, error) { + var dafny_request AwsCryptographyMaterialProvidersTypes.OnDecryptInput = OnDecryptInput_ToDafny(params) + var dafny_response = this.Impl.OnDecrypt(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = OnDecryptOutput_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.OnDecryptOutput)) + return &native_response, nil + +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/KeyringNativeWrapper.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/KeyringNativeWrapper.go new file mode 100644 index 000000000..a94369a82 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/KeyringNativeWrapper.go @@ -0,0 +1,32 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" +) + +type KeyringNativeWrapper struct { + AwsCryptographyMaterialProvidersTypes.IKeyring + Impl awscryptographymaterialproviderssmithygeneratedtypes.IKeyring +} + +func (this *KeyringNativeWrapper) OnEncrypt(input AwsCryptographyMaterialProvidersTypes.OnEncryptInput) Wrappers.Result { + var native_request = OnEncryptInput_FromDafny(input) + var native_response, native_error = this.Impl.OnEncrypt(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(OnEncryptOutput_ToDafny(*native_response)) +} + +func (this *KeyringNativeWrapper) OnDecrypt(input AwsCryptographyMaterialProvidersTypes.OnDecryptInput) Wrappers.Result { + var native_request = OnDecryptInput_FromDafny(input) + var native_response, native_error = this.Impl.OnDecrypt(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(OnDecryptOutput_ToDafny(*native_response)) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/api_client.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/api_client.go new file mode 100644 index 000000000..46f7887a7 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/api_client.go @@ -0,0 +1,653 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "context" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialProviders" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +type Client struct { + DafnyClient AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient +} + +func NewClient(clientConfig awscryptographymaterialproviderssmithygeneratedtypes.MaterialProvidersConfig) (*Client, error) { + var dafnyConfig = MaterialProvidersConfig_ToDafny(clientConfig) + var dafny_response = MaterialProviders.Companion_Default___.MaterialProviders(dafnyConfig) + if dafny_response.Is_Failure() { + panic("Client construction failed. This should never happen") + } + var dafnyClient = dafny_response.Extract().(AwsCryptographyMaterialProvidersTypes.IAwsCryptographicMaterialProvidersClient) + client := &Client{dafnyClient} + return client, nil +} + +func (client *Client) CreateAwsKmsKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput = CreateAwsKmsKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsDiscoveryKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput = CreateAwsKmsDiscoveryKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsDiscoveryKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsMultiKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMultiKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput = CreateAwsKmsMultiKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsMultiKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsDiscoveryMultiKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryMultiKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput = CreateAwsKmsDiscoveryMultiKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsDiscoveryMultiKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsMrkKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput = CreateAwsKmsMrkKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsMrkKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsMrkMultiKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkMultiKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput = CreateAwsKmsMrkMultiKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsMrkMultiKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsMrkDiscoveryKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput = CreateAwsKmsMrkDiscoveryKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsMrkDiscoveryKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsMrkDiscoveryMultiKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput = CreateAwsKmsMrkDiscoveryMultiKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsMrkDiscoveryMultiKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsHierarchicalKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsHierarchicalKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput = CreateAwsKmsHierarchicalKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsHierarchicalKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsRsaKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsRsaKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput = CreateAwsKmsRsaKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsRsaKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateAwsKmsEcdhKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsEcdhKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput = CreateAwsKmsEcdhKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateAwsKmsEcdhKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateMultiKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateMultiKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput = CreateMultiKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateMultiKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateRawAesKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateRawAesKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput = CreateRawAesKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateRawAesKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateRawRsaKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateRawRsaKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput = CreateRawRsaKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateRawRsaKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateRawEcdhKeyring(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateRawEcdhKeyringInput) (awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput = CreateRawEcdhKeyringInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateRawEcdhKeyring(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IKeyring + return defaultVal, Error_FromDafny(err) + } + var native_response = Keyring_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IKeyring)) + return native_response, nil + +} + +func (client *Client) CreateDefaultCryptographicMaterialsManager(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultCryptographicMaterialsManagerInput) (awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput = CreateDefaultCryptographicMaterialsManagerInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateDefaultCryptographicMaterialsManager(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager + return defaultVal, Error_FromDafny(err) + } + var native_response = CryptographicMaterialsManager_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager)) + return native_response, nil + +} + +func (client *Client) CreateRequiredEncryptionContextCMM(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateRequiredEncryptionContextCMMInput) (awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput = CreateRequiredEncryptionContextCMMInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateRequiredEncryptionContextCMM(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager + return defaultVal, Error_FromDafny(err) + } + var native_response = CryptographicMaterialsManager_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager)) + return native_response, nil + +} + +func (client *Client) CreateCryptographicMaterialsCache(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateCryptographicMaterialsCacheInput) (awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput = CreateCryptographicMaterialsCacheInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateCryptographicMaterialsCache(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache + return defaultVal, Error_FromDafny(err) + } + var native_response = CryptographicMaterialsCache_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache)) + return native_response, nil + +} + +func (client *Client) CreateDefaultClientSupplier(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultClientSupplierInput) (awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier + return defaultVal, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput = CreateDefaultClientSupplierInput_ToDafny(params) + var dafny_response = client.DafnyClient.CreateDefaultClientSupplier(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + var defaultVal awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier + return defaultVal, Error_FromDafny(err) + } + var native_response = ClientSupplier_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.IClientSupplier)) + return native_response, nil + +} + +func (client *Client) InitializeEncryptionMaterials(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.InitializeEncryptionMaterialsInput) (*awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput = InitializeEncryptionMaterialsInput_ToDafny(params) + var dafny_response = client.DafnyClient.InitializeEncryptionMaterials(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = EncryptionMaterials_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)) + return &native_response, nil + +} + +func (client *Client) InitializeDecryptionMaterials(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.InitializeDecryptionMaterialsInput) (*awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials, error) { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return nil, opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput = InitializeDecryptionMaterialsInput_ToDafny(params) + var dafny_response = client.DafnyClient.InitializeDecryptionMaterials(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = DecryptionMaterials_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)) + return &native_response, nil + +} + +func (client *Client) ValidEncryptionMaterialsTransition(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.ValidEncryptionMaterialsTransitionInput) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput = ValidEncryptionMaterialsTransitionInput_ToDafny(params) + var dafny_response = client.DafnyClient.ValidEncryptionMaterialsTransition(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) ValidDecryptionMaterialsTransition(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.ValidDecryptionMaterialsTransitionInput) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput = ValidDecryptionMaterialsTransitionInput_ToDafny(params) + var dafny_response = client.DafnyClient.ValidDecryptionMaterialsTransition(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) EncryptionMaterialsHasPlaintextDataKey(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.EncryptionMaterials = EncryptionMaterials_ToDafny(params) + var dafny_response = client.DafnyClient.EncryptionMaterialsHasPlaintextDataKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) DecryptionMaterialsWithPlaintextDataKey(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = DecryptionMaterials_ToDafny(params) + var dafny_response = client.DafnyClient.DecryptionMaterialsWithPlaintextDataKey(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) GetAlgorithmSuiteInfo(ctx context.Context, params []byte) (*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo, error) { + + var dafny_request dafny.Sequence = Aws_cryptography_materialProviders_GetAlgorithmSuiteInfoInput_binaryId_ToDafny(params) + var dafny_response = client.DafnyClient.GetAlgorithmSuiteInfo(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = AlgorithmSuiteInfo_FromDafny(dafny_response.Dtor_value().(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo)) + return &native_response, nil + +} + +func (client *Client) ValidAlgorithmSuiteInfo(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo = AlgorithmSuiteInfo_ToDafny(params) + var dafny_response = client.DafnyClient.ValidAlgorithmSuiteInfo(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) ValidateCommitmentPolicyOnEncrypt(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnEncryptInput) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput = ValidateCommitmentPolicyOnEncryptInput_ToDafny(params) + var dafny_response = client.DafnyClient.ValidateCommitmentPolicyOnEncrypt(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} + +func (client *Client) ValidateCommitmentPolicyOnDecrypt(ctx context.Context, params awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnDecryptInput) error { + err := params.Validate() + if err != nil { + opaqueErr := awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: err, + } + return opaqueErr + } + + var dafny_request AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput = ValidateCommitmentPolicyOnDecryptInput_ToDafny(params) + var dafny_response = client.DafnyClient.ValidateCommitmentPolicyOnDecrypt(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(AwsCryptographyMaterialProvidersTypes.Error) + return Error_FromDafny(err) + } + return nil +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_dafny.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_dafny.go new file mode 100644 index 000000000..62222368a --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_dafny.go @@ -0,0 +1,3227 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "unicode/utf8" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/comamazonawsdynamodbsmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/KMSwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/comamazonawskmssmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/awscryptographyprimitivessmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/awscryptographyprimitivessmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + "github.com/aws/aws-sdk-go-v2/service/kms" + kmstypes "github.com/aws/aws-sdk-go-v2/service/kms/types" + "github.com/aws/smithy-go" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +func CreateAwsKmsDiscoveryKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsDiscoveryKeyringInput_.Create_CreateAwsKmsDiscoveryKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_discoveryFilter_ToDafny(nativeInput.DiscoveryFilter), aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsDiscoveryMultiKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryMultiKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsDiscoveryMultiKeyringInput_.Create_CreateAwsKmsDiscoveryMultiKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_regions_ToDafny(nativeInput.Regions), aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_discoveryFilter_ToDafny(nativeInput.DiscoveryFilter), func() Wrappers.Option { + if (nativeInput.ClientSupplier) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(ClientSupplier_ToDafny(nativeInput.ClientSupplier)) + }(), aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsEcdhKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsEcdhKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsEcdhKeyringInput_.Create_CreateAwsKmsEcdhKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_ToDafny(nativeInput.KeyAgreementScheme), aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_curveSpec_ToDafny(nativeInput.CurveSpec), aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsHierarchicalKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsHierarchicalKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsHierarchicalKeyringInput_.Create_CreateAwsKmsHierarchicalKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_branchKeyId_ToDafny(nativeInput.BranchKeyId), func() Wrappers.Option { + if (nativeInput.BranchKeyIdSupplier) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(BranchKeyIdSupplier_ToDafny(nativeInput.BranchKeyIdSupplier)) + }(), aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_keyStore_ToDafny(nativeInput.KeyStore), aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_ttlSeconds_ToDafny(nativeInput.TtlSeconds), aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_ToDafny(nativeInput.Cache), aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_partitionId_ToDafny(nativeInput.PartitionId)) + }() + +} + +func CreateAwsKmsKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsKeyringInput_.Create_CreateAwsKmsKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsKeyId_ToDafny(nativeInput.KmsKeyId), aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsMrkDiscoveryKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsMrkDiscoveryKeyringInput_.Create_CreateAwsKmsMrkDiscoveryKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_discoveryFilter_ToDafny(nativeInput.DiscoveryFilter), aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens), aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_region_ToDafny(nativeInput.Region)) + }() + +} + +func CreateAwsKmsMrkDiscoveryMultiKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsMrkDiscoveryMultiKeyringInput_.Create_CreateAwsKmsMrkDiscoveryMultiKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_regions_ToDafny(nativeInput.Regions), aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_discoveryFilter_ToDafny(nativeInput.DiscoveryFilter), func() Wrappers.Option { + if (nativeInput.ClientSupplier) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(ClientSupplier_ToDafny(nativeInput.ClientSupplier)) + }(), aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsMrkKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsMrkKeyringInput_.Create_CreateAwsKmsMrkKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsKeyId_ToDafny(nativeInput.KmsKeyId), aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsMrkMultiKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkMultiKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsMrkMultiKeyringInput_.Create_CreateAwsKmsMrkMultiKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_generator_ToDafny(nativeInput.Generator), aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_kmsKeyIds_ToDafny(nativeInput.KmsKeyIds), func() Wrappers.Option { + if (nativeInput.ClientSupplier) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(ClientSupplier_ToDafny(nativeInput.ClientSupplier)) + }(), aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsMultiKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMultiKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsMultiKeyringInput_.Create_CreateAwsKmsMultiKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_generator_ToDafny(nativeInput.Generator), aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_kmsKeyIds_ToDafny(nativeInput.KmsKeyIds), func() Wrappers.Option { + if (nativeInput.ClientSupplier) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(ClientSupplier_ToDafny(nativeInput.ClientSupplier)) + }(), aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateAwsKmsRsaKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsRsaKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateAwsKmsRsaKeyringInput_.Create_CreateAwsKmsRsaKeyringInput_(aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_publicKey_ToDafny(nativeInput.PublicKey), aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsKeyId_ToDafny(nativeInput.KmsKeyId), aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_encryptionAlgorithm_ToDafny(nativeInput.EncryptionAlgorithm), aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsClient_ToDafny(nativeInput.KmsClient), aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_grantTokens_ToDafny(nativeInput.GrantTokens)) + }() + +} + +func CreateCryptographicMaterialsCacheInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateCryptographicMaterialsCacheInput) AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateCryptographicMaterialsCacheInput_.Create_CreateCryptographicMaterialsCacheInput_(aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_ToDafny(nativeInput.Cache)) + }() + +} + +func CreateDefaultClientSupplierInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultClientSupplierInput) AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultClientSupplierInput_.Create_CreateDefaultClientSupplierInput_() + }() + +} + +func CreateDefaultCryptographicMaterialsManagerInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultCryptographicMaterialsManagerInput) AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateDefaultCryptographicMaterialsManagerInput_.Create_CreateDefaultCryptographicMaterialsManagerInput_(Keyring_ToDafny(nativeInput.Keyring)) + }() + +} + +func CreateMultiKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateMultiKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateMultiKeyringInput_.Create_CreateMultiKeyringInput_(func() Wrappers.Option { + if (nativeInput.Generator) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(Keyring_ToDafny(nativeInput.Generator)) + }(), aws_cryptography_materialProviders_CreateMultiKeyringInput_childKeyrings_ToDafny(nativeInput.ChildKeyrings)) + }() + +} + +func CreateRawAesKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateRawAesKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateRawAesKeyringInput_.Create_CreateRawAesKeyringInput_(aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyNamespace_ToDafny(nativeInput.KeyNamespace), aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyName_ToDafny(nativeInput.KeyName), aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingKey_ToDafny(nativeInput.WrappingKey), aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingAlg_ToDafny(nativeInput.WrappingAlg)) + }() + +} + +func CreateRawEcdhKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateRawEcdhKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateRawEcdhKeyringInput_.Create_CreateRawEcdhKeyringInput_(aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_ToDafny(nativeInput.KeyAgreementScheme), aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_curveSpec_ToDafny(nativeInput.CurveSpec)) + }() + +} + +func CreateRawRsaKeyringInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateRawRsaKeyringInput) AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateRawRsaKeyringInput_.Create_CreateRawRsaKeyringInput_(aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyNamespace_ToDafny(nativeInput.KeyNamespace), aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyName_ToDafny(nativeInput.KeyName), aws_cryptography_materialProviders_CreateRawRsaKeyringInput_paddingScheme_ToDafny(nativeInput.PaddingScheme), aws_cryptography_materialProviders_CreateRawRsaKeyringInput_publicKey_ToDafny(nativeInput.PublicKey), aws_cryptography_materialProviders_CreateRawRsaKeyringInput_privateKey_ToDafny(nativeInput.PrivateKey)) + }() + +} + +func CreateRequiredEncryptionContextCMMInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CreateRequiredEncryptionContextCMMInput) AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput { + + return func() AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_CreateRequiredEncryptionContextCMMInput_.Create_CreateRequiredEncryptionContextCMMInput_(func() Wrappers.Option { + if (nativeInput.UnderlyingCMM) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(CryptographicMaterialsManager_ToDafny(nativeInput.UnderlyingCMM)) + }(), func() Wrappers.Option { + if (nativeInput.Keyring) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(Keyring_ToDafny(nativeInput.Keyring)) + }(), aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys)) + }() + +} + +func DecryptionMaterials_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(nativeInput.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(nativeInput.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(nativeInput.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(nativeInput.SymmetricSigningKey)) + }() + +} + +func EncryptionMaterials_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(nativeInput.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(nativeInput.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(nativeInput.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(nativeInput.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(nativeInput.SymmetricSigningKeys)) + }() + +} + +func GetAlgorithmSuiteInfoInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.GetAlgorithmSuiteInfoInput) dafny.Sequence { + + return Aws_cryptography_materialProviders_GetAlgorithmSuiteInfoInput_binaryId_ToDafny(nativeInput.BinaryId) + +} + +func AlgorithmSuiteInfo_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + + return AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_ToDafny(nativeOutput.Id), aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_ToDafny(nativeOutput.BinaryId), aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_ToDafny(nativeOutput.MessageVersion), aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_ToDafny(nativeOutput.Encrypt), aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_ToDafny(nativeOutput.Kdf), aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_ToDafny(nativeOutput.Commitment), aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_ToDafny(nativeOutput.Signature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_ToDafny(nativeOutput.SymmetricSignature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_ToDafny(nativeOutput.EdkWrapping)) + }() + +} + +func InitializeDecryptionMaterialsInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InitializeDecryptionMaterialsInput) AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput { + + return func() AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_InitializeDecryptionMaterialsInput_.Create_InitializeDecryptionMaterialsInput_(aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_ToDafny(nativeInput.AlgorithmSuiteId), aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys)) + }() + +} + +func InitializeEncryptionMaterialsInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InitializeEncryptionMaterialsInput) AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput { + + return func() AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_InitializeEncryptionMaterialsInput_.Create_InitializeEncryptionMaterialsInput_(aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_ToDafny(nativeInput.AlgorithmSuiteId), aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_signingKey_ToDafny(nativeInput.SigningKey), aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_verificationKey_ToDafny(nativeInput.VerificationKey)) + }() + +} + +func ValidateCommitmentPolicyOnDecryptInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnDecryptInput) AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput { + + return func() AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_ValidateCommitmentPolicyOnDecryptInput_.Create_ValidateCommitmentPolicyOnDecryptInput_(aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_ToDafny(nativeInput.Algorithm), aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_ToDafny(nativeInput.CommitmentPolicy)) + }() + +} + +func ValidateCommitmentPolicyOnEncryptInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnEncryptInput) AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput { + + return func() AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_ValidateCommitmentPolicyOnEncryptInput_.Create_ValidateCommitmentPolicyOnEncryptInput_(aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_ToDafny(nativeInput.Algorithm), aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_ToDafny(nativeInput.CommitmentPolicy)) + }() + +} + +func ValidDecryptionMaterialsTransitionInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.ValidDecryptionMaterialsTransitionInput) AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput { + + return func() AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_ValidDecryptionMaterialsTransitionInput_.Create_ValidDecryptionMaterialsTransitionInput_(aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_start_ToDafny(nativeInput.Start), aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_stop_ToDafny(nativeInput.Stop)) + }() + +} + +func ValidEncryptionMaterialsTransitionInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.ValidEncryptionMaterialsTransitionInput) AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput { + + return func() AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_ValidEncryptionMaterialsTransitionInput_.Create_ValidEncryptionMaterialsTransitionInput_(aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_start_ToDafny(nativeInput.Start), aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_stop_ToDafny(nativeInput.Stop)) + }() + +} + +func GetBranchKeyIdInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdInput) AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput { + + return func() AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetBranchKeyIdInput_.Create_GetBranchKeyIdInput_(aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_ToDafny(nativeInput.EncryptionContext)) + }() + +} + +func GetBranchKeyIdOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdOutput) AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput { + + return func() AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetBranchKeyIdOutput_.Create_GetBranchKeyIdOutput_(aws_cryptography_materialProviders_GetBranchKeyIdOutput_branchKeyId_ToDafny(nativeOutput.BranchKeyId)) + }() + +} + +func BranchKeyIdSupplier_ToDafny(nativeResource awscryptographymaterialproviderssmithygeneratedtypes.IBranchKeyIdSupplier) AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier { + val, ok := nativeResource.(*BranchKeyIdSupplier) + if ok { + return val.Impl + } + return BranchKeyIdSupplier{&BranchKeyIdSupplierNativeWrapper{Impl: nativeResource}}.Impl + +} + +func GetClientInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.GetClientInput) AwsCryptographyMaterialProvidersTypes.GetClientInput { + + return func() AwsCryptographyMaterialProvidersTypes.GetClientInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetClientInput_.Create_GetClientInput_(aws_cryptography_materialProviders_GetClientInput_region_ToDafny(nativeInput.Region)) + }() + +} + +func ClientSupplier_ToDafny(nativeResource awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier) AwsCryptographyMaterialProvidersTypes.IClientSupplier { + val, ok := nativeResource.(*ClientSupplier) + if ok { + return val.Impl + } + return ClientSupplier{&ClientSupplierNativeWrapper{Impl: nativeResource}}.Impl + +} + +func DeleteCacheEntryInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.DeleteCacheEntryInput) AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput { + + return func() AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_DeleteCacheEntryInput_.Create_DeleteCacheEntryInput_(aws_cryptography_materialProviders_DeleteCacheEntryInput_identifier_ToDafny(nativeInput.Identifier)) + }() + +} + +func CryptographicMaterialsCache_ToDafny(nativeResource awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache) AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache { + val, ok := nativeResource.(*CryptographicMaterialsCache) + if ok { + return val.Impl + } + return CryptographicMaterialsCache{&CryptographicMaterialsCacheNativeWrapper{Impl: nativeResource}}.Impl + +} + +func GetCacheEntryInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryInput) AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput { + + return func() AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetCacheEntryInput_.Create_GetCacheEntryInput_(aws_cryptography_materialProviders_GetCacheEntryInput_identifier_ToDafny(nativeInput.Identifier), aws_cryptography_materialProviders_GetCacheEntryInput_bytesUsed_ToDafny(nativeInput.BytesUsed)) + }() + +} + +func GetCacheEntryOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryOutput) AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput { + + return func() AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetCacheEntryOutput_.Create_GetCacheEntryOutput_(aws_cryptography_materialProviders_GetCacheEntryOutput_materials_ToDafny(nativeOutput.Materials), aws_cryptography_materialProviders_GetCacheEntryOutput_creationTime_ToDafny(nativeOutput.CreationTime), aws_cryptography_materialProviders_GetCacheEntryOutput_expiryTime_ToDafny(nativeOutput.ExpiryTime), aws_cryptography_materialProviders_GetCacheEntryOutput_messagesUsed_ToDafny(nativeOutput.MessagesUsed), aws_cryptography_materialProviders_GetCacheEntryOutput_bytesUsed_ToDafny(nativeOutput.BytesUsed)) + }() + +} + +func PutCacheEntryInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.PutCacheEntryInput) AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput { + + return func() AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_PutCacheEntryInput_.Create_PutCacheEntryInput_(aws_cryptography_materialProviders_PutCacheEntryInput_identifier_ToDafny(nativeInput.Identifier), aws_cryptography_materialProviders_PutCacheEntryInput_materials_ToDafny(nativeInput.Materials), aws_cryptography_materialProviders_PutCacheEntryInput_creationTime_ToDafny(nativeInput.CreationTime), aws_cryptography_materialProviders_PutCacheEntryInput_expiryTime_ToDafny(nativeInput.ExpiryTime), aws_cryptography_materialProviders_PutCacheEntryInput_messagesUsed_ToDafny(nativeInput.MessagesUsed), aws_cryptography_materialProviders_PutCacheEntryInput_bytesUsed_ToDafny(nativeInput.BytesUsed)) + }() + +} + +func UpdateUsageMetadataInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.UpdateUsageMetadataInput) AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput { + + return func() AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_UpdateUsageMetadataInput_.Create_UpdateUsageMetadataInput_(aws_cryptography_materialProviders_UpdateUsageMetadataInput_identifier_ToDafny(nativeInput.Identifier), aws_cryptography_materialProviders_UpdateUsageMetadataInput_bytesUsed_ToDafny(nativeInput.BytesUsed)) + }() + +} + +func DecryptMaterialsInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsInput) AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput { + + return func() AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptMaterialsInput_.Create_DecryptMaterialsInput_(aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_ToDafny(nativeInput.AlgorithmSuiteId), aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_ToDafny(nativeInput.CommitmentPolicy), aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_ToDafny(nativeInput.EncryptedDataKeys), aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_ToDafny(nativeInput.ReproducedEncryptionContext)) + }() + +} + +func DecryptMaterialsOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsOutput) AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput { + + return func() AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptMaterialsOutput_.Create_DecryptMaterialsOutput_(aws_cryptography_materialProviders_DecryptMaterialsOutput_decryptionMaterials_ToDafny(nativeOutput.DecryptionMaterials)) + }() + +} + +func CryptographicMaterialsManager_ToDafny(nativeResource awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager) AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager { + val, ok := nativeResource.(*CryptographicMaterialsManager) + if ok { + return val.Impl + } + return CryptographicMaterialsManager{&CryptographicMaterialsManagerNativeWrapper{Impl: nativeResource}}.Impl + +} + +func GetEncryptionMaterialsInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsInput) AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + + return func() AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetEncryptionMaterialsInput_.Create_GetEncryptionMaterialsInput_(aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_ToDafny(nativeInput.EncryptionContext), aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_ToDafny(nativeInput.CommitmentPolicy), aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_ToDafny(nativeInput.AlgorithmSuiteId), aws_cryptography_materialProviders_GetEncryptionMaterialsInput_maxPlaintextLength_ToDafny(nativeInput.MaxPlaintextLength), aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(nativeInput.RequiredEncryptionContextKeys)) + }() + +} + +func GetEncryptionMaterialsOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsOutput) AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput { + + return func() AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_GetEncryptionMaterialsOutput_.Create_GetEncryptionMaterialsOutput_(aws_cryptography_materialProviders_GetEncryptionMaterialsOutput_encryptionMaterials_ToDafny(nativeOutput.EncryptionMaterials)) + }() + +} + +func OnDecryptInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptInput) AwsCryptographyMaterialProvidersTypes.OnDecryptInput { + + return func() AwsCryptographyMaterialProvidersTypes.OnDecryptInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptInput_.Create_OnDecryptInput_(aws_cryptography_materialProviders_OnDecryptInput_materials_ToDafny(nativeInput.Materials), aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_ToDafny(nativeInput.EncryptedDataKeys)) + }() + +} + +func OnDecryptOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptOutput) AwsCryptographyMaterialProvidersTypes.OnDecryptOutput { + + return func() AwsCryptographyMaterialProvidersTypes.OnDecryptOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(aws_cryptography_materialProviders_OnDecryptOutput_materials_ToDafny(nativeOutput.Materials)) + }() + +} + +func Keyring_ToDafny(nativeResource awscryptographymaterialproviderssmithygeneratedtypes.IKeyring) AwsCryptographyMaterialProvidersTypes.IKeyring { + val, ok := nativeResource.(*Keyring) + if ok { + return val.Impl + } + return Keyring{&KeyringNativeWrapper{Impl: nativeResource}}.Impl + +} + +func OnEncryptInput_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptInput) AwsCryptographyMaterialProvidersTypes.OnEncryptInput { + + return func() AwsCryptographyMaterialProvidersTypes.OnEncryptInput { + + return AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptInput_.Create_OnEncryptInput_(aws_cryptography_materialProviders_OnEncryptInput_materials_ToDafny(nativeInput.Materials)) + }() + +} + +func OnEncryptOutput_ToDafny(nativeOutput awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptOutput) AwsCryptographyMaterialProvidersTypes.OnEncryptOutput { + + return func() AwsCryptographyMaterialProvidersTypes.OnEncryptOutput { + + return AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(aws_cryptography_materialProviders_OnEncryptOutput_materials_ToDafny(nativeOutput.Materials)) + }() + +} + +func AwsCryptographicMaterialProvidersException_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(aws_cryptography_materialProviders_AwsCryptographicMaterialProvidersException_message_ToDafny(nativeInput.Message)) + }() + +} + +func EntryAlreadyExists_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryAlreadyExists_(aws_cryptography_materialProviders_EntryAlreadyExists_message_ToDafny(nativeInput.Message)) + }() + +} + +func EntryDoesNotExist_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_EntryDoesNotExist_(aws_cryptography_materialProviders_EntryDoesNotExist_message_ToDafny(nativeInput.Message)) + }() + +} + +func InFlightTTLExceeded_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InFlightTTLExceeded_(aws_cryptography_materialProviders_InFlightTTLExceeded_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidAlgorithmSuiteInfo_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfo_(aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfo_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidAlgorithmSuiteInfoOnDecrypt_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfoOnDecrypt_(aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnDecrypt_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidAlgorithmSuiteInfoOnEncrypt_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidAlgorithmSuiteInfoOnEncrypt_(aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnEncrypt_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidDecryptionMaterials_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterials_(aws_cryptography_materialProviders_InvalidDecryptionMaterials_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidDecryptionMaterialsTransition_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidDecryptionMaterialsTransition_(aws_cryptography_materialProviders_InvalidDecryptionMaterialsTransition_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidEncryptionMaterials_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterials_(aws_cryptography_materialProviders_InvalidEncryptionMaterials_message_ToDafny(nativeInput.Message)) + }() + +} + +func InvalidEncryptionMaterialsTransition_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition) AwsCryptographyMaterialProvidersTypes.Error { + return func() AwsCryptographyMaterialProvidersTypes.Error { + + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_InvalidEncryptionMaterialsTransition_(aws_cryptography_materialProviders_InvalidEncryptionMaterialsTransition_message_ToDafny(nativeInput.Message)) + }() + +} + +func CollectionOfErrors_Input_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors) AwsCryptographyMaterialProvidersTypes.Error { + var e []interface{} + for _, i2 := range nativeInput.ListOfErrors { + e = append(e, Error_ToDafny(i2)) + } + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) +} +func OpaqueError_Input_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError) AwsCryptographyMaterialProvidersTypes.Error { + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) +} + +func Error_ToDafny(err error) AwsCryptographyMaterialProvidersTypes.Error { + switch err.(type) { + // Service Errors + case awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException: + return AwsCryptographicMaterialProvidersException_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException)) + + case awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists: + return EntryAlreadyExists_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists)) + + case awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist: + return EntryDoesNotExist_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded: + return InFlightTTLExceeded_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo: + return InvalidAlgorithmSuiteInfo_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt: + return InvalidAlgorithmSuiteInfoOnDecrypt_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt: + return InvalidAlgorithmSuiteInfoOnEncrypt_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials: + return InvalidDecryptionMaterials_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition: + return InvalidDecryptionMaterialsTransition_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials: + return InvalidEncryptionMaterials_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials)) + + case awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition: + return InvalidEncryptionMaterialsTransition_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition)) + + //DependentErrors + case awscryptographyprimitivessmithygeneratedtypes.AwsCryptographicPrimitivesBaseException: + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(awscryptographyprimitivessmithygenerated.Error_ToDafny(err)) + + case awscryptographykeystoresmithygeneratedtypes.KeyStoreBaseException: + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyKeyStore_(awscryptographykeystoresmithygenerated.Error_ToDafny(err)) + + case *smithy.OperationError: + if err.(*smithy.OperationError).Service() == "DynamoDB" { + DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err) + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError) + } + if err.(*smithy.OperationError).Service() == "KMS" { + KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err) + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError) + } + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_Opaque_(err) + + case smithy.APIError: + DynamoDBError := comamazonawsdynamodbsmithygenerated.Error_ToDafny(err) + if !DynamoDBError.Is_OpaqueWithText() { + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsDynamodb_(DynamoDBError) + } + KMSError := comamazonawskmssmithygenerated.Error_ToDafny(err) + if !KMSError.Is_OpaqueWithText() { + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(KMSError) + } + return AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_Opaque_(err) + + //Unmodelled Errors + case awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors: + return CollectionOfErrors_Input_ToDafny(err.(awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors)) + + default: + error, ok := err.(awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError) + if !ok { + panic("Error is not an OpaqueError") + } + return OpaqueError_Input_ToDafny(error) + } +} + +func MaterialProvidersConfig_ToDafny(nativeInput awscryptographymaterialproviderssmithygeneratedtypes.MaterialProvidersConfig) AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig { + return func() AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig { + + return AwsCryptographyMaterialProvidersTypes.Companion_MaterialProvidersConfig_.Create_MaterialProvidersConfig_() + }() + +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_kmsClient_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_discoveryFilter_ToDafny(input *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DiscoveryFilter_.Create_DiscoveryFilter_(aws_cryptography_materialProviders_DiscoveryFilter_accountIds_ToDafny(input.AccountIds), aws_cryptography_materialProviders_DiscoveryFilter_partition_ToDafny(input.Partition))) + }() +} + +func aws_cryptography_materialProviders_DiscoveryFilter_accountIds_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_AccountIdList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_AccountIdList_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_DiscoveryFilter_partition_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_regions_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_RegionList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_RegionList_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_discoveryFilter_ToDafny(input *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DiscoveryFilter_.Create_DiscoveryFilter_(aws_cryptography_materialProviders_DiscoveryFilter_accountIds_ToDafny(input.AccountIds), aws_cryptography_materialProviders_DiscoveryFilter_partition_ToDafny(input.Partition))) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurations) AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations { + return func() AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery: + var inputToConversion = aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_KmsEcdhStaticConfigurations_{}.Create_KmsPublicKeyDiscovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput)) + case *awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey: + var inputToConversion = aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_KmsEcdhStaticConfigurations_{}.Create_KmsPrivateKeyToStaticPublicKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.KmsPublicKeyDiscoveryInput) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_KmsPublicKeyDiscoveryInput_.Create_KmsPublicKeyDiscoveryInput_(aws_cryptography_materialProviders_KmsPublicKeyDiscoveryInput_recipientKmsIdentifier_ToDafny(input.RecipientKmsIdentifier))) + }() +} + +func aws_cryptography_materialProviders_KmsPublicKeyDiscoveryInput_recipientKmsIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.KmsPrivateKeyToStaticPublicKeyInput) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_KmsPrivateKeyToStaticPublicKeyInput_.Create_KmsPrivateKeyToStaticPublicKeyInput_(aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderKmsIdentifier_ToDafny(input.SenderKmsIdentifier), aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderPublicKey_ToDafny(input.SenderPublicKey), aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input.RecipientPublicKey))) + }() +} + +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderKmsIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderPublicKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_curveSpec_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec) AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + return func() AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDHCurveSpec_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_kmsClient_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_branchKeyId_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_keyStore_ToDafny(input *awscryptographykeystoresmithygenerated.Client) AwsCryptographyKeyStoreTypes.IKeyStoreClient { + return input.DafnyClient +} + +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_ttlSeconds_ToDafny(input int64) int64 { + return func() int64 { + + return input + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CacheType) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault: + var inputToConversion = aws_cryptography_materialProviders_CacheType_Default_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_Default_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DefaultCache))) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo: + var inputToConversion = aws_cryptography_materialProviders_CacheType_No_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_No_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.NoCache))) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded: + var inputToConversion = aws_cryptography_materialProviders_CacheType_SingleThreaded_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_SingleThreaded_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.SingleThreadedCache))) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded: + var inputToConversion = aws_cryptography_materialProviders_CacheType_MultiThreaded_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_MultiThreaded_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.MultiThreadedCache))) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking: + var inputToConversion = aws_cryptography_materialProviders_CacheType_StormTracking_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_StormTracking_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.StormTrackingCache))) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared: + var inputToConversion = func() Wrappers.Option { + if (input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared).Value) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(CryptographicMaterialsCache_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared).Value)) + }() + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_Shared_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache))) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_CacheType_Default_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DefaultCache) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DefaultCache_.Create_DefaultCache_(aws_cryptography_materialProviders_DefaultCache_entryCapacity_ToDafny(input.EntryCapacity))) + }() +} + +func aws_cryptography_materialProviders_DefaultCache_entryCapacity_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_CacheType_No_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.NoCache) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_NoCache_.Create_NoCache_()) + }() +} + +func aws_cryptography_materialProviders_CacheType_SingleThreaded_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.SingleThreadedCache) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_SingleThreadedCache_.Create_SingleThreadedCache_(aws_cryptography_materialProviders_SingleThreadedCache_entryCapacity_ToDafny(input.EntryCapacity), aws_cryptography_materialProviders_SingleThreadedCache_entryPruningTailSize_ToDafny(input.EntryPruningTailSize))) + }() +} + +func aws_cryptography_materialProviders_SingleThreadedCache_entryCapacity_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_SingleThreadedCache_entryPruningTailSize_ToDafny(input *int32) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_CacheType_MultiThreaded_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.MultiThreadedCache) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_MultiThreadedCache_.Create_MultiThreadedCache_(aws_cryptography_materialProviders_MultiThreadedCache_entryCapacity_ToDafny(input.EntryCapacity), aws_cryptography_materialProviders_MultiThreadedCache_entryPruningTailSize_ToDafny(input.EntryPruningTailSize))) + }() +} + +func aws_cryptography_materialProviders_MultiThreadedCache_entryCapacity_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_MultiThreadedCache_entryPruningTailSize_ToDafny(input *int32) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_CacheType_StormTracking_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.StormTrackingCache) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_StormTrackingCache_.Create_StormTrackingCache_(aws_cryptography_materialProviders_StormTrackingCache_entryCapacity_ToDafny(input.EntryCapacity), aws_cryptography_materialProviders_StormTrackingCache_entryPruningTailSize_ToDafny(input.EntryPruningTailSize), aws_cryptography_materialProviders_StormTrackingCache_gracePeriod_ToDafny(input.GracePeriod), aws_cryptography_materialProviders_StormTrackingCache_graceInterval_ToDafny(input.GraceInterval), aws_cryptography_materialProviders_StormTrackingCache_fanOut_ToDafny(input.FanOut), aws_cryptography_materialProviders_StormTrackingCache_inFlightTTL_ToDafny(input.InFlightTTL), aws_cryptography_materialProviders_StormTrackingCache_sleepMilli_ToDafny(input.SleepMilli), aws_cryptography_materialProviders_StormTrackingCache_timeUnits_ToDafny(input.TimeUnits))) + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_entryCapacity_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_entryPruningTailSize_ToDafny(input *int32) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_gracePeriod_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_graceInterval_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_fanOut_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_inFlightTTL_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_sleepMilli_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_StormTrackingCache_timeUnits_ToDafny(input *awscryptographymaterialproviderssmithygeneratedtypes.TimeUnits) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == *input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_TimeUnits_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyMaterialProvidersTypes.TimeUnits)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_partitionId_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsKeyId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsClient_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_kmsClient_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_discoveryFilter_ToDafny(input *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DiscoveryFilter_.Create_DiscoveryFilter_(aws_cryptography_materialProviders_DiscoveryFilter_accountIds_ToDafny(input.AccountIds), aws_cryptography_materialProviders_DiscoveryFilter_partition_ToDafny(input.Partition))) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_region_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_regions_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_RegionList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_discoveryFilter_ToDafny(input *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DiscoveryFilter_.Create_DiscoveryFilter_(aws_cryptography_materialProviders_DiscoveryFilter_accountIds_ToDafny(input.AccountIds), aws_cryptography_materialProviders_DiscoveryFilter_partition_ToDafny(input.Partition))) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsKeyId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsClient_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_generator_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_kmsKeyIds_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_KmsKeyIdList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_KmsKeyIdList_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_generator_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_kmsKeyIds_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_KmsKeyIdList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_publicKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsKeyId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_encryptionAlgorithm_ToDafny(input kmstypes.EncryptionAlgorithmSpec) ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + return func() ComAmazonawsKmsTypes.EncryptionAlgorithmSpec { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(ComAmazonawsKmsTypes.CompanionStruct_EncryptionAlgorithmSpec_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(ComAmazonawsKmsTypes.EncryptionAlgorithmSpec) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsClient_ToDafny(input *kms.Client) Wrappers.Option { + return func() Wrappers.Option { + if (input) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(&KMSwrapped.Shim{Client: input}) + }() +} + +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_grantTokens_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_GrantTokenList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CacheType) AwsCryptographyMaterialProvidersTypes.CacheType { + return func() AwsCryptographyMaterialProvidersTypes.CacheType { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault: + var inputToConversion = aws_cryptography_materialProviders_CacheType_Default_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_Default_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DefaultCache)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo: + var inputToConversion = aws_cryptography_materialProviders_CacheType_No_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_No_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.NoCache)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded: + var inputToConversion = aws_cryptography_materialProviders_CacheType_SingleThreaded_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_SingleThreaded_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.SingleThreadedCache)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded: + var inputToConversion = aws_cryptography_materialProviders_CacheType_MultiThreaded_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_MultiThreaded_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.MultiThreadedCache)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking: + var inputToConversion = aws_cryptography_materialProviders_CacheType_StormTracking_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_StormTracking_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.StormTrackingCache)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared: + var inputToConversion = func() Wrappers.Option { + if (input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared).Value) == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(CryptographicMaterialsCache_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared).Value)) + }() + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CacheType_{}.Create_Shared_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_CreateMultiKeyringInput_childKeyrings_ToDafny(input []awscryptographymaterialproviderssmithygeneratedtypes.IKeyring) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := Keyring_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyNamespace_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingAlg_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AesWrappingAlg) AwsCryptographyMaterialProvidersTypes.AesWrappingAlg { + return func() AwsCryptographyMaterialProvidersTypes.AesWrappingAlg { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_AesWrappingAlg_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyMaterialProvidersTypes.AesWrappingAlg) + }() +} + +func aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurations) AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations { + return func() AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberPublicKeyDiscovery: + var inputToConversion = aws_cryptography_materialProviders_RawEcdhStaticConfigurations_PublicKeyDiscovery_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberPublicKeyDiscovery).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_RawEcdhStaticConfigurations_{}.Create_PublicKeyDiscovery_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput)) + case *awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey: + var inputToConversion = aws_cryptography_materialProviders_RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_RawEcdhStaticConfigurations_{}.Create_RawPrivateKeyToStaticPublicKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput)) + case *awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey: + var inputToConversion = aws_cryptography_materialProviders_RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_RawEcdhStaticConfigurations_{}.Create_EphemeralPrivateKeyToStaticPublicKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.EphemeralPrivateKeyToStaticPublicKeyInput)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_PublicKeyDiscovery_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.PublicKeyDiscoveryInput) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_PublicKeyDiscoveryInput_.Create_PublicKeyDiscoveryInput_(aws_cryptography_materialProviders_PublicKeyDiscoveryInput_recipientStaticPrivateKey_ToDafny(input.RecipientStaticPrivateKey))) + }() +} + +func aws_cryptography_materialProviders_PublicKeyDiscoveryInput_recipientStaticPrivateKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.RawPrivateKeyToStaticPublicKeyInput) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_RawPrivateKeyToStaticPublicKeyInput_.Create_RawPrivateKeyToStaticPublicKeyInput_(aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_senderStaticPrivateKey_ToDafny(input.SenderStaticPrivateKey), aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input.RecipientPublicKey))) + }() +} + +func aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_senderStaticPrivateKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EphemeralPrivateKeyToStaticPublicKeyInput) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_EphemeralPrivateKeyToStaticPublicKeyInput_.Create_EphemeralPrivateKeyToStaticPublicKeyInput_(aws_cryptography_materialProviders_EphemeralPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input.RecipientPublicKey))) + }() +} + +func aws_cryptography_materialProviders_EphemeralPrivateKeyToStaticPublicKeyInput_recipientPublicKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_curveSpec_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec) AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + return func() AwsCryptographyPrimitivesTypes.ECDHCurveSpec { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDHCurveSpec_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec) + }() +} + +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyNamespace_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyName_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_paddingScheme_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.PaddingScheme) AwsCryptographyMaterialProvidersTypes.PaddingScheme { + return func() AwsCryptographyMaterialProvidersTypes.PaddingScheme { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_PaddingScheme_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyMaterialProvidersTypes.PaddingScheme) + }() +} + +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_publicKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_privateKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + + return AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_ToDafny(input.Id), aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_ToDafny(input.BinaryId), aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_ToDafny(input.MessageVersion), aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_ToDafny(input.Encrypt), aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_ToDafny(input.Kdf), aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_ToDafny(input.Commitment), aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_ToDafny(input.Signature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_ToDafny(input.SymmetricSignature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_ToDafny(input.EdkWrapping)) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId) Wrappers.Option { + return func() Wrappers.Option { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_ESDKAlgorithmSuiteId_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DBEAlgorithmSuiteId) Wrappers.Option { + return func() Wrappers.Option { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_DBEAlgorithmSuiteId_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.Encrypt) AwsCryptographyMaterialProvidersTypes.Encrypt { + return func() AwsCryptographyMaterialProvidersTypes.Encrypt { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM: + var inputToConversion = aws_cryptography_materialProviders_Encrypt_AES_GCM_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Encrypt_{}.Create_AES__GCM_(inputToConversion.UnwrapOr(nil).(AwsCryptographyPrimitivesTypes.AES__GCM)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_Encrypt_AES_GCM_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.AES_GCM) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyPrimitivesTypes.Companion_AES__GCM_.Create_AES__GCM_(aws_cryptography_primitives_AES_GCM_keyLength_ToDafny(input.KeyLength), aws_cryptography_primitives_AES_GCM_tagLength_ToDafny(input.TagLength), aws_cryptography_primitives_AES_GCM_ivLength_ToDafny(input.IvLength))) + }() +} + +func aws_cryptography_primitives_AES_GCM_keyLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_primitives_AES_GCM_tagLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_primitives_AES_GCM_ivLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm) AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_HKDF_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.HKDF)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_IDENTITY_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IDENTITY)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.HKDF) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_HKDF_.Create_HKDF_(aws_cryptography_materialProviders_HKDF_hmac_ToDafny(input.Hmac), aws_cryptography_materialProviders_HKDF_saltLength_ToDafny(input.SaltLength), aws_cryptography_materialProviders_HKDF_inputKeyLength_ToDafny(input.InputKeyLength), aws_cryptography_materialProviders_HKDF_outputKeyLength_ToDafny(input.OutputKeyLength))) + }() +} + +func aws_cryptography_materialProviders_HKDF_hmac_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm) AwsCryptographyPrimitivesTypes.DigestAlgorithm { + return func() AwsCryptographyPrimitivesTypes.DigestAlgorithm { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_DigestAlgorithm_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyPrimitivesTypes.DigestAlgorithm) + }() +} + +func aws_cryptography_materialProviders_HKDF_saltLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_HKDF_inputKeyLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_HKDF_outputKeyLength_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.IDENTITY) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_IDENTITY_.Create_IDENTITY_()) + }() +} + +func aws_cryptography_materialProviders_DerivationAlgorithm_None_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.None) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm) AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_HKDF_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.HKDF)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_IDENTITY_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IDENTITY)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithm) AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberECDSA: + var inputToConversion = aws_cryptography_materialProviders_SignatureAlgorithm_ECDSA_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberECDSA).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_SignatureAlgorithm_{}.Create_ECDSA_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ECDSA)) + case *awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_SignatureAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_SignatureAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_SignatureAlgorithm_ECDSA_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.ECDSA) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_ECDSA_.Create_ECDSA_(aws_cryptography_materialProviders_ECDSA_curve_ToDafny(input.Curve))) + }() +} + +func aws_cryptography_materialProviders_ECDSA_curve_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.ECDSASignatureAlgorithm) AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm { + return func() AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDSASignatureAlgorithm_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return enum.(AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm) + }() +} + +func aws_cryptography_materialProviders_SignatureAlgorithm_None_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.None) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithm) AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberHMAC: + var inputToConversion = aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_HMAC_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberHMAC).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_SymmetricSignatureAlgorithm_{}.Create_HMAC_(inputToConversion.UnwrapOr(nil).(AwsCryptographyPrimitivesTypes.DigestAlgorithm)) + case *awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_SymmetricSignatureAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_HMAC_ToDafny(input awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm) Wrappers.Option { + return func() Wrappers.Option { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_DigestAlgorithm_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyPrimitivesTypes.DigestAlgorithm)) + }() +} + +func aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_None_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.None) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_None_.Create_None_()) + }() +} + +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithm) AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING: + var inputToConversion = aws_cryptography_materialProviders_EdkWrappingAlgorithm_DIRECT_KEY_WRAPPING_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_EdkWrappingAlgorithm_{}.Create_DIRECT__KEY__WRAPPING_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DIRECT__KEY__WRAPPING)) + case *awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberIntermediateKeyWrapping: + var inputToConversion = aws_cryptography_materialProviders_EdkWrappingAlgorithm_IntermediateKeyWrapping_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberIntermediateKeyWrapping).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_EdkWrappingAlgorithm_{}.Create_IntermediateKeyWrapping_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_EdkWrappingAlgorithm_DIRECT_KEY_WRAPPING_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DIRECT_KEY_WRAPPING) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DIRECT__KEY__WRAPPING_.Create_DIRECT__KEY__WRAPPING_()) + }() +} + +func aws_cryptography_materialProviders_EdkWrappingAlgorithm_IntermediateKeyWrapping_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.IntermediateKeyWrapping) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_IntermediateKeyWrapping_.Create_IntermediateKeyWrapping_(aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_ToDafny(input.KeyEncryptionKeyKdf), aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_ToDafny(input.MacKeyKdf), aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_ToDafny(input.PdkEncryptAlgorithm))) + }() +} + +func aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm) AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_HKDF_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.HKDF)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_IDENTITY_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IDENTITY)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm) AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + return func() AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_HKDF_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.HKDF)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_IDENTITY_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IDENTITY)) + case *awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone: + var inputToConversion = aws_cryptography_materialProviders_DerivationAlgorithm_None_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_DerivationAlgorithm_{}.Create_None_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.None)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.Encrypt) AwsCryptographyMaterialProvidersTypes.Encrypt { + return func() AwsCryptographyMaterialProvidersTypes.Encrypt { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM: + var inputToConversion = aws_cryptography_materialProviders_Encrypt_AES_GCM_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Encrypt_{}.Create_AES__GCM_(inputToConversion.UnwrapOr(nil).(AwsCryptographyPrimitivesTypes.AES__GCM)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo { + + return AwsCryptographyMaterialProvidersTypes.Companion_AlgorithmSuiteInfo_.Create_AlgorithmSuiteInfo_(aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_ToDafny(input.Id), aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_ToDafny(input.BinaryId), aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_ToDafny(input.MessageVersion), aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_ToDafny(input.Encrypt), aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_ToDafny(input.Kdf), aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_ToDafny(input.Commitment), aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_ToDafny(input.Signature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_ToDafny(input.SymmetricSignature), aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_ToDafny(input.EdkWrapping)) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptedDataKeyList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_EncryptedDataKeyList_member_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey) AwsCryptographyMaterialProvidersTypes.EncryptedDataKey { + return func() AwsCryptographyMaterialProvidersTypes.EncryptedDataKey { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_(aws_cryptography_materialProviders_EncryptedDataKey_keyProviderId_ToDafny(input.KeyProviderId), aws_cryptography_materialProviders_EncryptedDataKey_keyProviderInfo_ToDafny(input.KeyProviderInfo), aws_cryptography_materialProviders_EncryptedDataKey_ciphertext_ToDafny(input.Ciphertext)) + }() +} + +func aws_cryptography_materialProviders_EncryptedDataKey_keyProviderId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_materialProviders_EncryptedDataKey_keyProviderInfo_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_EncryptedDataKey_ciphertext_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input [][]byte) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_SymmetricSigningKeyList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_SymmetricSigningKeyList_member_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func Aws_cryptography_materialProviders_GetAlgorithmSuiteInfoInput_binaryId_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(input []string) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_signingKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_verificationKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy) AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + return func() AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_CommitmentPolicy_ESDK_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.ESDKCommitmentPolicy) Wrappers.Option { + return func() Wrappers.Option { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_ESDKCommitmentPolicy_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy)) + }() +} + +func aws_cryptography_materialProviders_CommitmentPolicy_DBE_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DBECommitmentPolicy) Wrappers.Option { + return func() Wrappers.Option { + + var index int + for _, enumVal := range input.Values() { + index++ + if enumVal == input { + break + } + } + var enum interface{} + for allEnums, i := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_DBECommitmentPolicy_{}.AllSingletonConstructors()), 0; i < index; i++ { + var ok bool + enum, ok = allEnums() + if !ok { + break + } + } + return Wrappers.Companion_Option_.Create_Some_(enum.(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy)) + }() +} + +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy) AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + return func() AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_start_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey)) + }() +} + +func aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_stop_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey)) + }() +} + +func aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_start_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys)) + }() +} + +func aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_stop_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys)) + }() +} + +func aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_GetBranchKeyIdOutput_branchKeyId_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_GetClientInput_region_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func Aws_cryptography_materialProviders_GetClientOutput_client_ToDafny(input *kms.Client) ComAmazonawsKmsTypes.IKMSClient { + return &KMSwrapped.Shim{Client: input} +} + +func aws_cryptography_materialProviders_DeleteCacheEntryInput_identifier_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryInput_identifier_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryInput_bytesUsed_ToDafny(input *int64) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryOutput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.Materials) AwsCryptographyMaterialProvidersTypes.Materials { + return func() AwsCryptographyMaterialProvidersTypes.Materials { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption: + var inputToConversion = aws_cryptography_materialProviders_Materials_Encryption_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_Encryption_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption: + var inputToConversion = aws_cryptography_materialProviders_Materials_Decryption_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_Decryption_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey: + var inputToConversion = aws_cryptography_materialProviders_Materials_BranchKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_BranchKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.BranchKeyMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey: + var inputToConversion = aws_cryptography_materialProviders_Materials_BeaconKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_BeaconKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_Materials_Encryption_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys))) + }() +} + +func aws_cryptography_materialProviders_Materials_Decryption_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey))) + }() +} + +func aws_cryptography_materialProviders_Materials_BranchKey_ToDafny(input awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyKeyStoreTypes.Companion_BranchKeyMaterials_.Create_BranchKeyMaterials_(aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_ToDafny(input.BranchKeyIdentifier), aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_ToDafny(input.BranchKeyVersion), aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_keyStore_BranchKeyMaterials_branchKey_ToDafny(input.BranchKey))) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_EncryptionContext_key_ToDafny(key), aws_cryptography_keyStore_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_keyStore_EncryptionContext_key_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_EncryptionContext_value_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOf(func() []interface{} { + utf8.ValidString(input) + b := []byte(input) + f := make([]interface{}, len(b)) + for i, v := range b { + f[i] = v + } + return f + }()...) + }() +} + +func aws_cryptography_keyStore_BranchKeyMaterials_branchKey_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_Materials_BeaconKey_ToDafny(input awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials) Wrappers.Option { + return func() Wrappers.Option { + + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyKeyStoreTypes.Companion_BeaconKeyMaterials_.Create_BeaconKeyMaterials_(aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_ToDafny(input.BeaconKeyIdentifier), aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_ToDafny(input.BeaconKey), aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_ToDafny(input.HmacKeys))) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_EncryptionContext_key_ToDafny(key), aws_cryptography_keyStore_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_ToDafny(input []byte) Wrappers.Option { + return func() Wrappers.Option { + var v []interface{} + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + for _, e := range input { + v = append(v, e) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(v...)) + }() +} + +func aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_ToDafny(input map[string][]byte) Wrappers.Option { + return func() Wrappers.Option { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_keyStore_HmacKeyMap_key_ToDafny(key), aws_cryptography_keyStore_HmacKeyMap_value_ToDafny(val)) + } + return Wrappers.Companion_Option_.Create_Some_(fieldValue.ToMap()) + }() +} + +func aws_cryptography_keyStore_HmacKeyMap_key_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_keyStore_HmacKeyMap_value_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryOutput_creationTime_ToDafny(input int64) int64 { + return func() int64 { + + return input + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryOutput_expiryTime_ToDafny(input int64) int64 { + return func() int64 { + + return input + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryOutput_messagesUsed_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_GetCacheEntryOutput_bytesUsed_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_identifier_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.Materials) AwsCryptographyMaterialProvidersTypes.Materials { + return func() AwsCryptographyMaterialProvidersTypes.Materials { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption: + var inputToConversion = aws_cryptography_materialProviders_Materials_Encryption_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_Encryption_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption: + var inputToConversion = aws_cryptography_materialProviders_Materials_Decryption_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_Decryption_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey: + var inputToConversion = aws_cryptography_materialProviders_Materials_BranchKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_BranchKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.BranchKeyMaterials)) + case *awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey: + var inputToConversion = aws_cryptography_materialProviders_Materials_BeaconKey_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_Materials_{}.Create_BeaconKey_(inputToConversion.UnwrapOr(nil).(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_creationTime_ToDafny(input int64) int64 { + return func() int64 { + + return input + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_expiryTime_ToDafny(input int64) int64 { + return func() int64 { + + return input + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_messagesUsed_ToDafny(input *int32) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_PutCacheEntryInput_bytesUsed_ToDafny(input *int32) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_UpdateUsageMetadataInput_identifier_ToDafny(input []byte) dafny.Sequence { + return func() dafny.Sequence { + var v []interface{} + if input == nil { + return nil + } + for _, e := range input { + v = append(v, e) + } + return dafny.SeqOf(v...) + }() +} + +func aws_cryptography_materialProviders_UpdateUsageMetadataInput_bytesUsed_ToDafny(input int32) int32 { + return func() int32 { + + return input + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + return func() AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId)) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy) AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + return func() AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_ToDafny(input []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptedDataKeyList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_ToDafny(input map[string]string) Wrappers.Option { + return func() Wrappers.Option { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return Wrappers.Companion_Option_.Create_Some_(fieldValue.ToMap()) + }() +} + +func aws_cryptography_materialProviders_DecryptMaterialsOutput_decryptionMaterials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey)) + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_ToDafny(input map[string]string) dafny.Map { + return func() dafny.Map { + fieldValue := dafny.NewMapBuilder() + for key, val := range input { + fieldValue.Add(aws_cryptography_materialProviders_EncryptionContext_key_ToDafny(key), aws_cryptography_materialProviders_EncryptionContext_value_ToDafny(val)) + } + return fieldValue.ToMap() + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy) AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + return func() AwsCryptographyMaterialProvidersTypes.CommitmentPolicy { + + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy)) + case *awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_CommitmentPolicy_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE).Value) + return AwsCryptographyMaterialProvidersTypes.CompanionStruct_CommitmentPolicy_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy)) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + switch input.(type) { + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_ESDK_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId))) + case *awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE: + var inputToConversion = aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_ToDafny(input.(*awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE).Value) + return Wrappers.Companion_Option_.Create_Some_(AwsCryptographyMaterialProvidersTypes.CompanionStruct_AlgorithmSuiteId_{}.Create_DBE_(inputToConversion.UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId))) + + default: + panic("Unhandled union type") + } + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_maxPlaintextLength_ToDafny(input *int64) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(*input) + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_ToDafny(input []string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptionContextKeys_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOf(fieldValue...)) + }() +} + +func aws_cryptography_materialProviders_GetEncryptionMaterialsOutput_encryptionMaterials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys)) + }() +} + +func aws_cryptography_materialProviders_OnDecryptInput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey)) + }() +} + +func aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_ToDafny(input []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey) dafny.Sequence { + return func() dafny.Sequence { + + var fieldValue []interface{} = make([]interface{}, 0) + for _, val := range input { + element := aws_cryptography_materialProviders_EncryptedDataKeyList_member_ToDafny(val) + fieldValue = append(fieldValue, element) + } + return dafny.SeqOf(fieldValue...) + }() +} + +func aws_cryptography_materialProviders_OnDecryptOutput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials) AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_DecryptionMaterials_.Create_DecryptionMaterials_(aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_ToDafny(input.VerificationKey), aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_ToDafny(input.SymmetricSigningKey)) + }() +} + +func aws_cryptography_materialProviders_OnEncryptInput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys)) + }() +} + +func aws_cryptography_materialProviders_OnEncryptOutput_materials_ToDafny(input awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials) AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + return func() AwsCryptographyMaterialProvidersTypes.EncryptionMaterials { + + return AwsCryptographyMaterialProvidersTypes.Companion_EncryptionMaterials_.Create_EncryptionMaterials_(aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_ToDafny(input.AlgorithmSuite), aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_ToDafny(input.EncryptionContext), aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_ToDafny(input.EncryptedDataKeys), aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_ToDafny(input.RequiredEncryptionContextKeys), aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_ToDafny(input.PlaintextDataKey), aws_cryptography_materialProviders_EncryptionMaterials_signingKey_ToDafny(input.SigningKey), aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_ToDafny(input.SymmetricSigningKeys)) + }() +} + +func aws_cryptography_materialProviders_AwsCryptographicMaterialProvidersException_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_EntryAlreadyExists_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_EntryDoesNotExist_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InFlightTTLExceeded_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfo_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnDecrypt_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnEncrypt_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidDecryptionMaterials_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidDecryptionMaterialsTransition_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidEncryptionMaterials_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func aws_cryptography_materialProviders_InvalidEncryptionMaterialsTransition_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_native.go b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_native.go new file mode 100644 index 000000000..c4a936e30 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygenerated/to_native.go @@ -0,0 +1,3607 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygenerated + +import ( + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/comamazonawsdynamodbsmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/KMSwrapped" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/comamazonawskmssmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/awscryptographyprimitivessmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/awscryptographyprimitivessmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" + "github.com/aws/aws-sdk-go-v2/service/kms" + kmstypes "github.com/aws/aws-sdk-go-v2/service/kms/types" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" +) + +func CreateAwsKmsDiscoveryKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryKeyringInput{KmsClient: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient()), + DiscoveryFilter: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_discoveryFilter_FromDafny(dafnyInput.Dtor_discoveryFilter().UnwrapOr(nil)), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsDiscoveryMultiKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsDiscoveryMultiKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryMultiKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsDiscoveryMultiKeyringInput{Regions: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_regions_FromDafny(dafnyInput.Dtor_regions()), + DiscoveryFilter: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_discoveryFilter_FromDafny(dafnyInput.Dtor_discoveryFilter().UnwrapOr(nil)), + ClientSupplier: func() awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier { + if dafnyInput.Dtor_clientSupplier().UnwrapOr(nil) == nil { + return nil + } + return ClientSupplier_FromDafny(dafnyInput.Dtor_clientSupplier().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IClientSupplier)) + }(), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsEcdhKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsEcdhKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsEcdhKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsEcdhKeyringInput{KeyAgreementScheme: aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_FromDafny(dafnyInput.Dtor_KeyAgreementScheme()), + CurveSpec: aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_curveSpec_FromDafny(dafnyInput.Dtor_curveSpec()), + KmsClient: aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient()), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsHierarchicalKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsHierarchicalKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsHierarchicalKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsHierarchicalKeyringInput{BranchKeyId: aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_branchKeyId_FromDafny(dafnyInput.Dtor_branchKeyId().UnwrapOr(nil)), + BranchKeyIdSupplier: func() awscryptographymaterialproviderssmithygeneratedtypes.IBranchKeyIdSupplier { + if dafnyInput.Dtor_branchKeyIdSupplier().UnwrapOr(nil) == nil { + return nil + } + return BranchKeyIdSupplier_FromDafny(dafnyInput.Dtor_branchKeyIdSupplier().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier)) + }(), + KeyStore: aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_keyStore_FromDafny(dafnyInput.Dtor_keyStore()), + TtlSeconds: aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_ttlSeconds_FromDafny(dafnyInput.Dtor_ttlSeconds()), + Cache: aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_FromDafny(dafnyInput.Dtor_cache().UnwrapOr(nil)), + PartitionId: aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_partitionId_FromDafny(dafnyInput.Dtor_partitionId().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsKeyringInput{KmsKeyId: aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsKeyId_FromDafny(dafnyInput.Dtor_kmsKeyId()), + KmsClient: aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient()), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsMrkDiscoveryKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryKeyringInput{KmsClient: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient()), + DiscoveryFilter: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_discoveryFilter_FromDafny(dafnyInput.Dtor_discoveryFilter().UnwrapOr(nil)), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + Region: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_region_FromDafny(dafnyInput.Dtor_region()), + } + +} + +func CreateAwsKmsMrkDiscoveryMultiKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkDiscoveryMultiKeyringInput{Regions: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_regions_FromDafny(dafnyInput.Dtor_regions()), + DiscoveryFilter: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_discoveryFilter_FromDafny(dafnyInput.Dtor_discoveryFilter().UnwrapOr(nil)), + ClientSupplier: func() awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier { + if dafnyInput.Dtor_clientSupplier().UnwrapOr(nil) == nil { + return nil + } + return ClientSupplier_FromDafny(dafnyInput.Dtor_clientSupplier().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IClientSupplier)) + }(), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsMrkKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkKeyringInput{KmsKeyId: aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsKeyId_FromDafny(dafnyInput.Dtor_kmsKeyId()), + KmsClient: aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient()), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsMrkMultiKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMrkMultiKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkMultiKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMrkMultiKeyringInput{Generator: aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_generator_FromDafny(dafnyInput.Dtor_generator().UnwrapOr(nil)), + KmsKeyIds: aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_kmsKeyIds_FromDafny(dafnyInput.Dtor_kmsKeyIds().UnwrapOr(nil)), + ClientSupplier: func() awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier { + if dafnyInput.Dtor_clientSupplier().UnwrapOr(nil) == nil { + return nil + } + return ClientSupplier_FromDafny(dafnyInput.Dtor_clientSupplier().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IClientSupplier)) + }(), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsMultiKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsMultiKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMultiKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsMultiKeyringInput{Generator: aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_generator_FromDafny(dafnyInput.Dtor_generator().UnwrapOr(nil)), + KmsKeyIds: aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_kmsKeyIds_FromDafny(dafnyInput.Dtor_kmsKeyIds().UnwrapOr(nil)), + ClientSupplier: func() awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier { + if dafnyInput.Dtor_clientSupplier().UnwrapOr(nil) == nil { + return nil + } + return ClientSupplier_FromDafny(dafnyInput.Dtor_clientSupplier().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IClientSupplier)) + }(), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateAwsKmsRsaKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateAwsKmsRsaKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsRsaKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateAwsKmsRsaKeyringInput{PublicKey: aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_publicKey_FromDafny(dafnyInput.Dtor_publicKey().UnwrapOr(nil)), + KmsKeyId: aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsKeyId_FromDafny(dafnyInput.Dtor_kmsKeyId()), + EncryptionAlgorithm: aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_encryptionAlgorithm_FromDafny(dafnyInput.Dtor_encryptionAlgorithm()), + KmsClient: aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsClient_FromDafny(dafnyInput.Dtor_kmsClient().UnwrapOr(nil)), + GrantTokens: aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_grantTokens_FromDafny(dafnyInput.Dtor_grantTokens().UnwrapOr(nil)), + } + +} + +func CreateCryptographicMaterialsCacheInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateCryptographicMaterialsCacheInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateCryptographicMaterialsCacheInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateCryptographicMaterialsCacheInput{Cache: aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_FromDafny(dafnyInput.Dtor_cache())} + +} + +func CreateDefaultClientSupplierInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateDefaultClientSupplierInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultClientSupplierInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultClientSupplierInput{} + +} + +func CreateDefaultCryptographicMaterialsManagerInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateDefaultCryptographicMaterialsManagerInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultCryptographicMaterialsManagerInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateDefaultCryptographicMaterialsManagerInput{Keyring: Keyring_FromDafny(dafnyInput.Dtor_keyring())} + +} + +func CreateMultiKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateMultiKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateMultiKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateMultiKeyringInput{Generator: func() awscryptographymaterialproviderssmithygeneratedtypes.IKeyring { + if dafnyInput.Dtor_generator().UnwrapOr(nil) == nil { + return nil + } + return Keyring_FromDafny(dafnyInput.Dtor_generator().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IKeyring)) + }(), + ChildKeyrings: aws_cryptography_materialProviders_CreateMultiKeyringInput_childKeyrings_FromDafny(dafnyInput.Dtor_childKeyrings()), + } + +} + +func CreateRawAesKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateRawAesKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateRawAesKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateRawAesKeyringInput{KeyNamespace: aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyNamespace_FromDafny(dafnyInput.Dtor_keyNamespace()), + KeyName: aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyName_FromDafny(dafnyInput.Dtor_keyName()), + WrappingKey: aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingKey_FromDafny(dafnyInput.Dtor_wrappingKey()), + WrappingAlg: aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingAlg_FromDafny(dafnyInput.Dtor_wrappingAlg()), + } + +} + +func CreateRawEcdhKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateRawEcdhKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateRawEcdhKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateRawEcdhKeyringInput{KeyAgreementScheme: aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_FromDafny(dafnyInput.Dtor_KeyAgreementScheme()), + CurveSpec: aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_curveSpec_FromDafny(dafnyInput.Dtor_curveSpec()), + } + +} + +func CreateRawRsaKeyringInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateRawRsaKeyringInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateRawRsaKeyringInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateRawRsaKeyringInput{KeyNamespace: aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyNamespace_FromDafny(dafnyInput.Dtor_keyNamespace()), + KeyName: aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyName_FromDafny(dafnyInput.Dtor_keyName()), + PaddingScheme: aws_cryptography_materialProviders_CreateRawRsaKeyringInput_paddingScheme_FromDafny(dafnyInput.Dtor_paddingScheme()), + PublicKey: aws_cryptography_materialProviders_CreateRawRsaKeyringInput_publicKey_FromDafny(dafnyInput.Dtor_publicKey().UnwrapOr(nil)), + PrivateKey: aws_cryptography_materialProviders_CreateRawRsaKeyringInput_privateKey_FromDafny(dafnyInput.Dtor_privateKey().UnwrapOr(nil)), + } + +} + +func CreateRequiredEncryptionContextCMMInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.CreateRequiredEncryptionContextCMMInput) awscryptographymaterialproviderssmithygeneratedtypes.CreateRequiredEncryptionContextCMMInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.CreateRequiredEncryptionContextCMMInput{UnderlyingCMM: func() awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager { + if dafnyInput.Dtor_underlyingCMM().UnwrapOr(nil) == nil { + return nil + } + return CryptographicMaterialsManager_FromDafny(dafnyInput.Dtor_underlyingCMM().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager)) + }(), + Keyring: func() awscryptographymaterialproviderssmithygeneratedtypes.IKeyring { + if dafnyInput.Dtor_keyring().UnwrapOr(nil) == nil { + return nil + } + return Keyring_FromDafny(dafnyInput.Dtor_keyring().UnwrapOr(nil).(AwsCryptographyMaterialProvidersTypes.IKeyring)) + }(), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys()), + } + +} + +func DecryptionMaterials_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(dafnyInput.Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(dafnyInput.Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(dafnyInput.Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(dafnyInput.Dtor_symmetricSigningKey().UnwrapOr(nil)), + } + +} + +func EncryptionMaterials_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.EncryptionMaterials) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(dafnyInput.Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(dafnyInput.Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(dafnyInput.Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(dafnyInput.Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(dafnyInput.Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } + +} + +func GetAlgorithmSuiteInfoInput_FromDafny(dafnyInput dafny.Sequence) awscryptographymaterialproviderssmithygeneratedtypes.GetAlgorithmSuiteInfoInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetAlgorithmSuiteInfoInput{BinaryId: Aws_cryptography_materialProviders_GetAlgorithmSuiteInfoInput_binaryId_FromDafny(dafnyInput)} + +} + +func AlgorithmSuiteInfo_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo { + + return awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo{Id: aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_FromDafny(dafnyOutput.Dtor_id()), + BinaryId: aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_FromDafny(dafnyOutput.Dtor_binaryId()), + MessageVersion: aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_FromDafny(dafnyOutput.Dtor_messageVersion()), + Encrypt: aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_FromDafny(dafnyOutput.Dtor_encrypt()), + Kdf: aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_FromDafny(dafnyOutput.Dtor_kdf()), + Commitment: aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_FromDafny(dafnyOutput.Dtor_commitment()), + Signature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_FromDafny(dafnyOutput.Dtor_signature()), + SymmetricSignature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_FromDafny(dafnyOutput.Dtor_symmetricSignature()), + EdkWrapping: aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_FromDafny(dafnyOutput.Dtor_edkWrapping()), + } + +} + +func InitializeDecryptionMaterialsInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.InitializeDecryptionMaterialsInput) awscryptographymaterialproviderssmithygeneratedtypes.InitializeDecryptionMaterialsInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.InitializeDecryptionMaterialsInput{AlgorithmSuiteId: aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_FromDafny(dafnyInput.Dtor_algorithmSuiteId()), + EncryptionContext: aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys()), + } + +} + +func InitializeEncryptionMaterialsInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.InitializeEncryptionMaterialsInput) awscryptographymaterialproviderssmithygeneratedtypes.InitializeEncryptionMaterialsInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.InitializeEncryptionMaterialsInput{AlgorithmSuiteId: aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_FromDafny(dafnyInput.Dtor_algorithmSuiteId()), + EncryptionContext: aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys()), + SigningKey: aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_signingKey_FromDafny(dafnyInput.Dtor_signingKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_verificationKey_FromDafny(dafnyInput.Dtor_verificationKey().UnwrapOr(nil)), + } + +} + +func ValidateCommitmentPolicyOnDecryptInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnDecryptInput) awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnDecryptInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnDecryptInput{Algorithm: aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_FromDafny(dafnyInput.Dtor_algorithm()), + CommitmentPolicy: aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_FromDafny(dafnyInput.Dtor_commitmentPolicy()), + } + +} + +func ValidateCommitmentPolicyOnEncryptInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.ValidateCommitmentPolicyOnEncryptInput) awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnEncryptInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.ValidateCommitmentPolicyOnEncryptInput{Algorithm: aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_FromDafny(dafnyInput.Dtor_algorithm()), + CommitmentPolicy: aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_FromDafny(dafnyInput.Dtor_commitmentPolicy()), + } + +} + +func ValidDecryptionMaterialsTransitionInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.ValidDecryptionMaterialsTransitionInput) awscryptographymaterialproviderssmithygeneratedtypes.ValidDecryptionMaterialsTransitionInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.ValidDecryptionMaterialsTransitionInput{Start: aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_start_FromDafny(dafnyInput.Dtor_start()), + Stop: aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_stop_FromDafny(dafnyInput.Dtor_stop()), + } + +} + +func ValidEncryptionMaterialsTransitionInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.ValidEncryptionMaterialsTransitionInput) awscryptographymaterialproviderssmithygeneratedtypes.ValidEncryptionMaterialsTransitionInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.ValidEncryptionMaterialsTransitionInput{Start: aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_start_FromDafny(dafnyInput.Dtor_start()), + Stop: aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_stop_FromDafny(dafnyInput.Dtor_stop()), + } + +} + +func GetBranchKeyIdInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdInput) awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdInput{EncryptionContext: aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext())} + +} + +func GetBranchKeyIdOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.GetBranchKeyIdOutput) awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetBranchKeyIdOutput{BranchKeyId: aws_cryptography_materialProviders_GetBranchKeyIdOutput_branchKeyId_FromDafny(dafnyOutput.Dtor_branchKeyId())} + +} + +func BranchKeyIdSupplier_FromDafny(dafnyResource AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier) awscryptographymaterialproviderssmithygeneratedtypes.IBranchKeyIdSupplier { + val, ok := dafnyResource.(*BranchKeyIdSupplierNativeWrapper) + if ok { + return val.Impl + } + + return &BranchKeyIdSupplier{dafnyResource} +} + +func GetClientInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.GetClientInput) awscryptographymaterialproviderssmithygeneratedtypes.GetClientInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetClientInput{Region: aws_cryptography_materialProviders_GetClientInput_region_FromDafny(dafnyInput.Dtor_region())} + +} + +func ClientSupplier_FromDafny(dafnyResource AwsCryptographyMaterialProvidersTypes.IClientSupplier) awscryptographymaterialproviderssmithygeneratedtypes.IClientSupplier { + val, ok := dafnyResource.(*ClientSupplierNativeWrapper) + if ok { + return val.Impl + } + + return &ClientSupplier{dafnyResource} +} + +func DeleteCacheEntryInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.DeleteCacheEntryInput) awscryptographymaterialproviderssmithygeneratedtypes.DeleteCacheEntryInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.DeleteCacheEntryInput{Identifier: aws_cryptography_materialProviders_DeleteCacheEntryInput_identifier_FromDafny(dafnyInput.Dtor_identifier())} + +} + +func CryptographicMaterialsCache_FromDafny(dafnyResource AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache) awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsCache { + val, ok := dafnyResource.(*CryptographicMaterialsCacheNativeWrapper) + if ok { + return val.Impl + } + + return &CryptographicMaterialsCache{dafnyResource} +} + +func GetCacheEntryInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.GetCacheEntryInput) awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryInput{Identifier: aws_cryptography_materialProviders_GetCacheEntryInput_identifier_FromDafny(dafnyInput.Dtor_identifier()), + BytesUsed: aws_cryptography_materialProviders_GetCacheEntryInput_bytesUsed_FromDafny(dafnyInput.Dtor_bytesUsed().UnwrapOr(nil)), + } + +} + +func GetCacheEntryOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.GetCacheEntryOutput) awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetCacheEntryOutput{Materials: aws_cryptography_materialProviders_GetCacheEntryOutput_materials_FromDafny(dafnyOutput.Dtor_materials()), + CreationTime: aws_cryptography_materialProviders_GetCacheEntryOutput_creationTime_FromDafny(dafnyOutput.Dtor_creationTime()), + ExpiryTime: aws_cryptography_materialProviders_GetCacheEntryOutput_expiryTime_FromDafny(dafnyOutput.Dtor_expiryTime()), + MessagesUsed: aws_cryptography_materialProviders_GetCacheEntryOutput_messagesUsed_FromDafny(dafnyOutput.Dtor_messagesUsed()), + BytesUsed: aws_cryptography_materialProviders_GetCacheEntryOutput_bytesUsed_FromDafny(dafnyOutput.Dtor_bytesUsed()), + } + +} + +func PutCacheEntryInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.PutCacheEntryInput) awscryptographymaterialproviderssmithygeneratedtypes.PutCacheEntryInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.PutCacheEntryInput{Identifier: aws_cryptography_materialProviders_PutCacheEntryInput_identifier_FromDafny(dafnyInput.Dtor_identifier()), + Materials: aws_cryptography_materialProviders_PutCacheEntryInput_materials_FromDafny(dafnyInput.Dtor_materials()), + CreationTime: aws_cryptography_materialProviders_PutCacheEntryInput_creationTime_FromDafny(dafnyInput.Dtor_creationTime()), + ExpiryTime: aws_cryptography_materialProviders_PutCacheEntryInput_expiryTime_FromDafny(dafnyInput.Dtor_expiryTime()), + MessagesUsed: aws_cryptography_materialProviders_PutCacheEntryInput_messagesUsed_FromDafny(dafnyInput.Dtor_messagesUsed().UnwrapOr(nil)), + BytesUsed: aws_cryptography_materialProviders_PutCacheEntryInput_bytesUsed_FromDafny(dafnyInput.Dtor_bytesUsed().UnwrapOr(nil)), + } + +} + +func UpdateUsageMetadataInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.UpdateUsageMetadataInput) awscryptographymaterialproviderssmithygeneratedtypes.UpdateUsageMetadataInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.UpdateUsageMetadataInput{Identifier: aws_cryptography_materialProviders_UpdateUsageMetadataInput_identifier_FromDafny(dafnyInput.Dtor_identifier()), + BytesUsed: aws_cryptography_materialProviders_UpdateUsageMetadataInput_bytesUsed_FromDafny(dafnyInput.Dtor_bytesUsed()), + } + +} + +func DecryptMaterialsInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.DecryptMaterialsInput) awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsInput{AlgorithmSuiteId: aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_FromDafny(dafnyInput.Dtor_algorithmSuiteId()), + CommitmentPolicy: aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_FromDafny(dafnyInput.Dtor_commitmentPolicy()), + EncryptedDataKeys: aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_FromDafny(dafnyInput.Dtor_encryptedDataKeys()), + EncryptionContext: aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + ReproducedEncryptionContext: aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_FromDafny(dafnyInput.Dtor_reproducedEncryptionContext().UnwrapOr(nil)), + } + +} + +func DecryptMaterialsOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.DecryptMaterialsOutput) awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptMaterialsOutput{DecryptionMaterials: aws_cryptography_materialProviders_DecryptMaterialsOutput_decryptionMaterials_FromDafny(dafnyOutput.Dtor_decryptionMaterials())} + +} + +func CryptographicMaterialsManager_FromDafny(dafnyResource AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsManager) awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager { + val, ok := dafnyResource.(*CryptographicMaterialsManagerNativeWrapper) + if ok { + return val.Impl + } + + return &CryptographicMaterialsManager{dafnyResource} +} + +func GetEncryptionMaterialsInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsInput) awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsInput{EncryptionContext: aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_FromDafny(dafnyInput.Dtor_encryptionContext()), + CommitmentPolicy: aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_FromDafny(dafnyInput.Dtor_commitmentPolicy()), + AlgorithmSuiteId: aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_FromDafny(dafnyInput.Dtor_algorithmSuiteId().UnwrapOr(nil)), + MaxPlaintextLength: aws_cryptography_materialProviders_GetEncryptionMaterialsInput_maxPlaintextLength_FromDafny(dafnyInput.Dtor_maxPlaintextLength().UnwrapOr(nil)), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(dafnyInput.Dtor_requiredEncryptionContextKeys().UnwrapOr(nil)), + } + +} + +func GetEncryptionMaterialsOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.GetEncryptionMaterialsOutput) awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.GetEncryptionMaterialsOutput{EncryptionMaterials: aws_cryptography_materialProviders_GetEncryptionMaterialsOutput_encryptionMaterials_FromDafny(dafnyOutput.Dtor_encryptionMaterials())} + +} + +func OnDecryptInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.OnDecryptInput) awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptInput{Materials: aws_cryptography_materialProviders_OnDecryptInput_materials_FromDafny(dafnyInput.Dtor_materials()), + EncryptedDataKeys: aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_FromDafny(dafnyInput.Dtor_encryptedDataKeys()), + } + +} + +func OnDecryptOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.OnDecryptOutput) awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.OnDecryptOutput{Materials: aws_cryptography_materialProviders_OnDecryptOutput_materials_FromDafny(dafnyOutput.Dtor_materials())} + +} + +func Keyring_FromDafny(dafnyResource AwsCryptographyMaterialProvidersTypes.IKeyring) awscryptographymaterialproviderssmithygeneratedtypes.IKeyring { + val, ok := dafnyResource.(*KeyringNativeWrapper) + if ok { + return val.Impl + } + + return &Keyring{dafnyResource} +} + +func OnEncryptInput_FromDafny(dafnyInput AwsCryptographyMaterialProvidersTypes.OnEncryptInput) awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptInput { + + return awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptInput{Materials: aws_cryptography_materialProviders_OnEncryptInput_materials_FromDafny(dafnyInput.Dtor_materials())} + +} + +func OnEncryptOutput_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.OnEncryptOutput) awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptOutput { + + return awscryptographymaterialproviderssmithygeneratedtypes.OnEncryptOutput{Materials: aws_cryptography_materialProviders_OnEncryptOutput_materials_FromDafny(dafnyOutput.Dtor_materials())} + +} + +func AwsCryptographicMaterialProvidersException_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException { + return awscryptographymaterialproviderssmithygeneratedtypes.AwsCryptographicMaterialProvidersException{Message: aws_cryptography_materialProviders_AwsCryptographicMaterialProvidersException_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func EntryAlreadyExists_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists { + return awscryptographymaterialproviderssmithygeneratedtypes.EntryAlreadyExists{Message: aws_cryptography_materialProviders_EntryAlreadyExists_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func EntryDoesNotExist_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist { + return awscryptographymaterialproviderssmithygeneratedtypes.EntryDoesNotExist{Message: aws_cryptography_materialProviders_EntryDoesNotExist_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InFlightTTLExceeded_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded { + return awscryptographymaterialproviderssmithygeneratedtypes.InFlightTTLExceeded{Message: aws_cryptography_materialProviders_InFlightTTLExceeded_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidAlgorithmSuiteInfo_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfo{Message: aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfo_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidAlgorithmSuiteInfoOnDecrypt_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnDecrypt{Message: aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnDecrypt_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidAlgorithmSuiteInfoOnEncrypt_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidAlgorithmSuiteInfoOnEncrypt{Message: aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnEncrypt_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidDecryptionMaterials_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterials{Message: aws_cryptography_materialProviders_InvalidDecryptionMaterials_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidDecryptionMaterialsTransition_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidDecryptionMaterialsTransition{Message: aws_cryptography_materialProviders_InvalidDecryptionMaterialsTransition_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidEncryptionMaterials_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterials{Message: aws_cryptography_materialProviders_InvalidEncryptionMaterials_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func InvalidEncryptionMaterialsTransition_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition { + return awscryptographymaterialproviderssmithygeneratedtypes.InvalidEncryptionMaterialsTransition{Message: aws_cryptography_materialProviders_InvalidEncryptionMaterialsTransition_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func CollectionOfErrors_Output_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors { + listOfErrors := dafnyOutput.Dtor_list() + message := dafnyOutput.Dtor_message() + t := awscryptographymaterialproviderssmithygeneratedtypes.CollectionOfErrors{} + for i := dafny.Iterate(listOfErrors); ; { + val, ok := i() + if !ok { + break + } + err := val.(AwsCryptographyMaterialProvidersTypes.Error) + t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) + + } + t.Message = func() string { + var s string + for i := dafny.Iterate(message); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() + return t +} +func OpaqueError_Output_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.Error) awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError { + return awscryptographymaterialproviderssmithygeneratedtypes.OpaqueError{ + ErrObject: dafnyOutput.Dtor_obj(), + } +} + +func Error_FromDafny(err AwsCryptographyMaterialProvidersTypes.Error) error { + // Service Errors + if err.Is_AwsCryptographicMaterialProvidersException() { + return AwsCryptographicMaterialProvidersException_FromDafny(err) + } + + if err.Is_EntryAlreadyExists() { + return EntryAlreadyExists_FromDafny(err) + } + + if err.Is_EntryDoesNotExist() { + return EntryDoesNotExist_FromDafny(err) + } + + if err.Is_InFlightTTLExceeded() { + return InFlightTTLExceeded_FromDafny(err) + } + + if err.Is_InvalidAlgorithmSuiteInfo() { + return InvalidAlgorithmSuiteInfo_FromDafny(err) + } + + if err.Is_InvalidAlgorithmSuiteInfoOnDecrypt() { + return InvalidAlgorithmSuiteInfoOnDecrypt_FromDafny(err) + } + + if err.Is_InvalidAlgorithmSuiteInfoOnEncrypt() { + return InvalidAlgorithmSuiteInfoOnEncrypt_FromDafny(err) + } + + if err.Is_InvalidDecryptionMaterials() { + return InvalidDecryptionMaterials_FromDafny(err) + } + + if err.Is_InvalidDecryptionMaterialsTransition() { + return InvalidDecryptionMaterialsTransition_FromDafny(err) + } + + if err.Is_InvalidEncryptionMaterials() { + return InvalidEncryptionMaterials_FromDafny(err) + } + + if err.Is_InvalidEncryptionMaterialsTransition() { + return InvalidEncryptionMaterialsTransition_FromDafny(err) + } + + //DependentErrors + if err.Is_AwsCryptographyPrimitives() { + return awscryptographyprimitivessmithygenerated.Error_FromDafny(err.Dtor_AwsCryptographyPrimitives()) + } + + if err.Is_ComAmazonawsDynamodb() { + return comamazonawsdynamodbsmithygenerated.Error_FromDafny(err.Dtor_ComAmazonawsDynamodb()) + } + + if err.Is_ComAmazonawsKms() { + return comamazonawskmssmithygenerated.Error_FromDafny(err.Dtor_ComAmazonawsKms()) + } + + if err.Is_AwsCryptographyKeyStore() { + return awscryptographykeystoresmithygenerated.Error_FromDafny(err.Dtor_AwsCryptographyKeyStore()) + } + + //Unmodelled Errors + if err.Is_CollectionOfErrors() { + return CollectionOfErrors_Output_FromDafny(err) + } + + return OpaqueError_Output_FromDafny(err) +} + +func MaterialProvidersConfig_FromDafny(dafnyOutput AwsCryptographyMaterialProvidersTypes.MaterialProvidersConfig) awscryptographymaterialproviderssmithygeneratedtypes.MaterialProvidersConfig { + return awscryptographymaterialproviderssmithygeneratedtypes.MaterialProvidersConfig{} + +} + +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_discoveryFilter_FromDafny(input interface{}) *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter { + if input == nil { + return nil + } + return &awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter{AccountIds: aws_cryptography_materialProviders_DiscoveryFilter_accountIds_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_accountIds()), + Partition: aws_cryptography_materialProviders_DiscoveryFilter_partition_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_partition()), + } +} +func aws_cryptography_materialProviders_DiscoveryFilter_accountIds_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_AccountIdList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_AccountIdList_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_DiscoveryFilter_partition_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_regions_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_RegionList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_RegionList_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_discoveryFilter_FromDafny(input interface{}) *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter { + if input == nil { + return nil + } + return &awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter{AccountIds: aws_cryptography_materialProviders_DiscoveryFilter_accountIds_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_accountIds()), + Partition: aws_cryptography_materialProviders_DiscoveryFilter_partition_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_partition()), + } +} +func aws_cryptography_materialProviders_CreateAwsKmsDiscoveryMultiKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurations { + var union awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurations + + if (input.(AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations)).Is_KmsPublicKeyDiscovery() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery{ + Value: (aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations)).Dtor_KmsPublicKeyDiscovery())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations)).Is_KmsPrivateKeyToStaticPublicKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey{ + Value: (aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.KmsEcdhStaticConfigurations)).Dtor_KmsPrivateKeyToStaticPublicKey())), + } + } + + return union + +} +func aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.KmsPublicKeyDiscoveryInput { + return awscryptographymaterialproviderssmithygeneratedtypes.KmsPublicKeyDiscoveryInput{RecipientKmsIdentifier: aws_cryptography_materialProviders_KmsPublicKeyDiscoveryInput_recipientKmsIdentifier_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.KmsPublicKeyDiscoveryInput).Dtor_recipientKmsIdentifier())} +} +func aws_cryptography_materialProviders_KmsPublicKeyDiscoveryInput_recipientKmsIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.KmsPrivateKeyToStaticPublicKeyInput { + return awscryptographymaterialproviderssmithygeneratedtypes.KmsPrivateKeyToStaticPublicKeyInput{SenderKmsIdentifier: aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderKmsIdentifier_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput).Dtor_senderKmsIdentifier()), + SenderPublicKey: aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderPublicKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput).Dtor_senderPublicKey().UnwrapOr(nil)), + RecipientPublicKey: aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.KmsPrivateKeyToStaticPublicKeyInput).Dtor_recipientPublicKey()), + } +} +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderKmsIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_senderPublicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_KmsPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_curveSpec_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec { + return func() awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec { + var u awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec + inputEnum := input.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDHCurveSpec_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_branchKeyId_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_keyStore_FromDafny(input interface{}) *awscryptographykeystoresmithygenerated.Client { + value, ok := input.(AwsCryptographyKeyStoreTypes.IKeyStoreClient) + if !ok { + panic("invalid type found.") + } + return &awscryptographykeystoresmithygenerated.Client{value} + +} +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_ttlSeconds_FromDafny(input interface{}) int64 { + return func() int64 { + var b = input.(int64) + return b + }() + +} +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CacheType { + var union awscryptographymaterialproviderssmithygeneratedtypes.CacheType + if input == nil { + return nil + } + + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_Default() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault{ + Value: (aws_cryptography_materialProviders_CacheType_Default_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_Default())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_No() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo{ + Value: (aws_cryptography_materialProviders_CacheType_No_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_No())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_SingleThreaded() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded{ + Value: (aws_cryptography_materialProviders_CacheType_SingleThreaded_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_SingleThreaded())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_MultiThreaded() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded{ + Value: (aws_cryptography_materialProviders_CacheType_MultiThreaded_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_MultiThreaded())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_StormTracking() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking{ + Value: (aws_cryptography_materialProviders_CacheType_StormTracking_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_StormTracking())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_Shared() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared{ + Value: (CryptographicMaterialsCache_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_Shared().(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache))), + } + } + + return union + +} +func aws_cryptography_materialProviders_CacheType_Default_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DefaultCache { + return awscryptographymaterialproviderssmithygeneratedtypes.DefaultCache{EntryCapacity: aws_cryptography_materialProviders_DefaultCache_entryCapacity_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DefaultCache).Dtor_entryCapacity())} +} +func aws_cryptography_materialProviders_DefaultCache_entryCapacity_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_CacheType_No_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.NoCache { + return awscryptographymaterialproviderssmithygeneratedtypes.NoCache{} +} +func aws_cryptography_materialProviders_CacheType_SingleThreaded_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.SingleThreadedCache { + return awscryptographymaterialproviderssmithygeneratedtypes.SingleThreadedCache{EntryCapacity: aws_cryptography_materialProviders_SingleThreadedCache_entryCapacity_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.SingleThreadedCache).Dtor_entryCapacity()), + EntryPruningTailSize: aws_cryptography_materialProviders_SingleThreadedCache_entryPruningTailSize_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.SingleThreadedCache).Dtor_entryPruningTailSize().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_SingleThreadedCache_entryCapacity_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_SingleThreadedCache_entryPruningTailSize_FromDafny(input interface{}) *int32 { + return func() *int32 { + var b int32 + if input == nil { + return nil + } + b = input.(int32) + return &b + }() +} +func aws_cryptography_materialProviders_CacheType_MultiThreaded_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.MultiThreadedCache { + return awscryptographymaterialproviderssmithygeneratedtypes.MultiThreadedCache{EntryCapacity: aws_cryptography_materialProviders_MultiThreadedCache_entryCapacity_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.MultiThreadedCache).Dtor_entryCapacity()), + EntryPruningTailSize: aws_cryptography_materialProviders_MultiThreadedCache_entryPruningTailSize_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.MultiThreadedCache).Dtor_entryPruningTailSize().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_MultiThreadedCache_entryCapacity_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_MultiThreadedCache_entryPruningTailSize_FromDafny(input interface{}) *int32 { + return func() *int32 { + var b int32 + if input == nil { + return nil + } + b = input.(int32) + return &b + }() +} +func aws_cryptography_materialProviders_CacheType_StormTracking_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.StormTrackingCache { + return awscryptographymaterialproviderssmithygeneratedtypes.StormTrackingCache{EntryCapacity: aws_cryptography_materialProviders_StormTrackingCache_entryCapacity_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_entryCapacity()), + EntryPruningTailSize: aws_cryptography_materialProviders_StormTrackingCache_entryPruningTailSize_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_entryPruningTailSize().UnwrapOr(nil)), + GracePeriod: aws_cryptography_materialProviders_StormTrackingCache_gracePeriod_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_gracePeriod()), + GraceInterval: aws_cryptography_materialProviders_StormTrackingCache_graceInterval_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_graceInterval()), + FanOut: aws_cryptography_materialProviders_StormTrackingCache_fanOut_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_fanOut()), + InFlightTTL: aws_cryptography_materialProviders_StormTrackingCache_inFlightTTL_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_inFlightTTL()), + SleepMilli: aws_cryptography_materialProviders_StormTrackingCache_sleepMilli_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_sleepMilli()), + TimeUnits: aws_cryptography_materialProviders_StormTrackingCache_timeUnits_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.StormTrackingCache).Dtor_timeUnits().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_StormTrackingCache_entryCapacity_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_entryPruningTailSize_FromDafny(input interface{}) *int32 { + return func() *int32 { + var b int32 + if input == nil { + return nil + } + b = input.(int32) + return &b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_gracePeriod_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_graceInterval_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_fanOut_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_inFlightTTL_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_sleepMilli_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_StormTrackingCache_timeUnits_FromDafny(input interface{}) *awscryptographymaterialproviderssmithygeneratedtypes.TimeUnits { + return func() *awscryptographymaterialproviderssmithygeneratedtypes.TimeUnits { + var u awscryptographymaterialproviderssmithygeneratedtypes.TimeUnits + if input == nil { + return nil + } + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.TimeUnits) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_TimeUnits_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.TimeUnits).Equals(inputEnum) { + break + } + } + } + + return &u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_partitionId_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsKeyId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_discoveryFilter_FromDafny(input interface{}) *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter { + if input == nil { + return nil + } + return &awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter{AccountIds: aws_cryptography_materialProviders_DiscoveryFilter_accountIds_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_accountIds()), + Partition: aws_cryptography_materialProviders_DiscoveryFilter_partition_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_partition()), + } +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryKeyringInput_region_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_regions_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_RegionList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_discoveryFilter_FromDafny(input interface{}) *awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter { + if input == nil { + return nil + } + return &awscryptographymaterialproviderssmithygeneratedtypes.DiscoveryFilter{AccountIds: aws_cryptography_materialProviders_DiscoveryFilter_accountIds_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_accountIds()), + Partition: aws_cryptography_materialProviders_DiscoveryFilter_partition_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DiscoveryFilter).Dtor_partition()), + } +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkDiscoveryMultiKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsKeyId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_generator_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_kmsKeyIds_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_KmsKeyIdList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_KmsKeyIdList_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsMrkMultiKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_generator_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_kmsKeyIds_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_KmsKeyIdList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsMultiKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_publicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsKeyId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_encryptionAlgorithm_FromDafny(input interface{}) kmstypes.EncryptionAlgorithmSpec { + return func() kmstypes.EncryptionAlgorithmSpec { + var u kmstypes.EncryptionAlgorithmSpec + inputEnum := input.(ComAmazonawsKmsTypes.EncryptionAlgorithmSpec) + index := -1 + for allEnums := dafny.Iterate(ComAmazonawsKmsTypes.CompanionStruct_EncryptionAlgorithmSpec_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(ComAmazonawsKmsTypes.EncryptionAlgorithmSpec).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_kmsClient_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_CreateAwsKmsRsaKeyringInput_grantTokens_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_GrantTokenList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CacheType { + var union awscryptographymaterialproviderssmithygeneratedtypes.CacheType + + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_Default() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberDefault{ + Value: (aws_cryptography_materialProviders_CacheType_Default_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_Default())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_No() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberNo{ + Value: (aws_cryptography_materialProviders_CacheType_No_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_No())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_SingleThreaded() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberSingleThreaded{ + Value: (aws_cryptography_materialProviders_CacheType_SingleThreaded_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_SingleThreaded())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_MultiThreaded() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberMultiThreaded{ + Value: (aws_cryptography_materialProviders_CacheType_MultiThreaded_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_MultiThreaded())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_StormTracking() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberStormTracking{ + Value: (aws_cryptography_materialProviders_CacheType_StormTracking_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_StormTracking())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Is_Shared() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.CacheTypeMemberShared{ + Value: (CryptographicMaterialsCache_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.CacheType)).Dtor_Shared().(AwsCryptographyMaterialProvidersTypes.ICryptographicMaterialsCache))), + } + } + + return union + +} +func aws_cryptography_materialProviders_CreateMultiKeyringInput_childKeyrings_FromDafny(input interface{}) []awscryptographymaterialproviderssmithygeneratedtypes.IKeyring { + fieldValue := make([]awscryptographymaterialproviderssmithygeneratedtypes.IKeyring, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, Keyring_FromDafny(val.(AwsCryptographyMaterialProvidersTypes.IKeyring))) + } + return fieldValue +} +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyNamespace_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_keyName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawAesKeyringInput_wrappingAlg_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AesWrappingAlg { + return func() awscryptographymaterialproviderssmithygeneratedtypes.AesWrappingAlg { + var u awscryptographymaterialproviderssmithygeneratedtypes.AesWrappingAlg + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.AesWrappingAlg) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_AesWrappingAlg_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.AesWrappingAlg).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurations { + var union awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurations + + if (input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Is_PublicKeyDiscovery() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberPublicKeyDiscovery{ + Value: (aws_cryptography_materialProviders_RawEcdhStaticConfigurations_PublicKeyDiscovery_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Dtor_PublicKeyDiscovery())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Is_RawPrivateKeyToStaticPublicKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey{ + Value: (aws_cryptography_materialProviders_RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Dtor_RawPrivateKeyToStaticPublicKey())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Is_EphemeralPrivateKeyToStaticPublicKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey{ + Value: (aws_cryptography_materialProviders_RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.RawEcdhStaticConfigurations)).Dtor_EphemeralPrivateKeyToStaticPublicKey())), + } + } + + return union + +} +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_PublicKeyDiscovery_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.PublicKeyDiscoveryInput { + return awscryptographymaterialproviderssmithygeneratedtypes.PublicKeyDiscoveryInput{RecipientStaticPrivateKey: aws_cryptography_materialProviders_PublicKeyDiscoveryInput_recipientStaticPrivateKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.PublicKeyDiscoveryInput).Dtor_recipientStaticPrivateKey())} +} +func aws_cryptography_materialProviders_PublicKeyDiscoveryInput_recipientStaticPrivateKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_RawPrivateKeyToStaticPublicKey_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.RawPrivateKeyToStaticPublicKeyInput { + return awscryptographymaterialproviderssmithygeneratedtypes.RawPrivateKeyToStaticPublicKeyInput{SenderStaticPrivateKey: aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_senderStaticPrivateKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput).Dtor_senderStaticPrivateKey()), + RecipientPublicKey: aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.RawPrivateKeyToStaticPublicKeyInput).Dtor_recipientPublicKey()), + } +} +func aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_senderStaticPrivateKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_RawPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_RawEcdhStaticConfigurations_EphemeralPrivateKeyToStaticPublicKey_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EphemeralPrivateKeyToStaticPublicKeyInput { + return awscryptographymaterialproviderssmithygeneratedtypes.EphemeralPrivateKeyToStaticPublicKeyInput{RecipientPublicKey: aws_cryptography_materialProviders_EphemeralPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EphemeralPrivateKeyToStaticPublicKeyInput).Dtor_recipientPublicKey())} +} +func aws_cryptography_materialProviders_EphemeralPrivateKeyToStaticPublicKeyInput_recipientPublicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_curveSpec_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec { + return func() awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec { + var u awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec + inputEnum := input.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDHCurveSpec_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyPrimitivesTypes.ECDHCurveSpec).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyNamespace_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_keyName_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_paddingScheme_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.PaddingScheme { + return func() awscryptographymaterialproviderssmithygeneratedtypes.PaddingScheme { + var u awscryptographymaterialproviderssmithygeneratedtypes.PaddingScheme + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.PaddingScheme) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_PaddingScheme_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.PaddingScheme).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_publicKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRawRsaKeyringInput_privateKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo { + return awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo{Id: aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_id()), + BinaryId: aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_binaryId()), + MessageVersion: aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_messageVersion()), + Encrypt: aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_encrypt()), + Kdf: aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_kdf()), + Commitment: aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_commitment()), + Signature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_signature()), + SymmetricSignature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_symmetricSignature()), + EdkWrapping: aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_edkWrapping()), + } +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId { + return func() awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId { + var u awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_ESDKAlgorithmSuiteId_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.ESDKAlgorithmSuiteId).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DBEAlgorithmSuiteId { + return func() awscryptographymaterialproviderssmithygeneratedtypes.DBEAlgorithmSuiteId { + var u awscryptographymaterialproviderssmithygeneratedtypes.DBEAlgorithmSuiteId + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_DBEAlgorithmSuiteId_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.DBEAlgorithmSuiteId).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.Encrypt { + var union awscryptographymaterialproviderssmithygeneratedtypes.Encrypt + + if (input.(AwsCryptographyMaterialProvidersTypes.Encrypt)).Is_AES__GCM() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM{ + Value: (aws_cryptography_materialProviders_Encrypt_AES_GCM_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Encrypt)).Dtor_AES__GCM())), + } + } + + return union + +} +func aws_cryptography_materialProviders_Encrypt_AES_GCM_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.AES_GCM { + return awscryptographyprimitivessmithygeneratedtypes.AES_GCM{KeyLength: aws_cryptography_primitives_AES_GCM_keyLength_FromDafny(input.(AwsCryptographyPrimitivesTypes.AES__GCM).Dtor_keyLength()), + TagLength: aws_cryptography_primitives_AES_GCM_tagLength_FromDafny(input.(AwsCryptographyPrimitivesTypes.AES__GCM).Dtor_tagLength()), + IvLength: aws_cryptography_primitives_AES_GCM_ivLength_FromDafny(input.(AwsCryptographyPrimitivesTypes.AES__GCM).Dtor_ivLength()), + } +} +func aws_cryptography_primitives_AES_GCM_keyLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_primitives_AES_GCM_tagLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_primitives_AES_GCM_ivLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_HKDF() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_HKDF())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_IDENTITY() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_IDENTITY())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.HKDF { + return awscryptographymaterialproviderssmithygeneratedtypes.HKDF{Hmac: aws_cryptography_materialProviders_HKDF_hmac_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.HKDF).Dtor_hmac()), + SaltLength: aws_cryptography_materialProviders_HKDF_saltLength_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.HKDF).Dtor_saltLength()), + InputKeyLength: aws_cryptography_materialProviders_HKDF_inputKeyLength_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.HKDF).Dtor_inputKeyLength()), + OutputKeyLength: aws_cryptography_materialProviders_HKDF_outputKeyLength_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.HKDF).Dtor_outputKeyLength()), + } +} +func aws_cryptography_materialProviders_HKDF_hmac_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm { + return func() awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm { + var u awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm + inputEnum := input.(AwsCryptographyPrimitivesTypes.DigestAlgorithm) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_DigestAlgorithm_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyPrimitivesTypes.DigestAlgorithm).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_HKDF_saltLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_HKDF_inputKeyLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_HKDF_outputKeyLength_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.IDENTITY { + return awscryptographymaterialproviderssmithygeneratedtypes.IDENTITY{} +} +func aws_cryptography_materialProviders_DerivationAlgorithm_None_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.None { + return awscryptographymaterialproviderssmithygeneratedtypes.None{} +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_HKDF() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_HKDF())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_IDENTITY() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_IDENTITY())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm)).Is_ECDSA() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberECDSA{ + Value: (aws_cryptography_materialProviders_SignatureAlgorithm_ECDSA_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm)).Dtor_ECDSA())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.SignatureAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_SignatureAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.SignatureAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_SignatureAlgorithm_ECDSA_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.ECDSA { + return awscryptographymaterialproviderssmithygeneratedtypes.ECDSA{Curve: aws_cryptography_materialProviders_ECDSA_curve_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.ECDSA).Dtor_curve())} +} +func aws_cryptography_materialProviders_ECDSA_curve_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.ECDSASignatureAlgorithm { + return func() awscryptographyprimitivessmithygeneratedtypes.ECDSASignatureAlgorithm { + var u awscryptographyprimitivessmithygeneratedtypes.ECDSASignatureAlgorithm + inputEnum := input.(AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_ECDSASignatureAlgorithm_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyPrimitivesTypes.ECDSASignatureAlgorithm).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_SignatureAlgorithm_None_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.None { + return awscryptographymaterialproviderssmithygeneratedtypes.None{} +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm)).Is_HMAC() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm)).Dtor_HMAC()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberHMAC{ + Value: (aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_HMAC_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.SymmetricSignatureAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.SymmetricSignatureAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_HMAC_FromDafny(input interface{}) awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm { + return func() awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm { + var u awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm + inputEnum := input.(AwsCryptographyPrimitivesTypes.DigestAlgorithm) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyPrimitivesTypes.CompanionStruct_DigestAlgorithm_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyPrimitivesTypes.DigestAlgorithm).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_SymmetricSignatureAlgorithm_None_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.None { + return awscryptographymaterialproviderssmithygeneratedtypes.None{} +} +func aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm)).Is_DIRECT__KEY__WRAPPING() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING{ + Value: (aws_cryptography_materialProviders_EdkWrappingAlgorithm_DIRECT_KEY_WRAPPING_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm)).Dtor_DIRECT__KEY__WRAPPING())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm)).Is_IntermediateKeyWrapping() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.EdkWrappingAlgorithmMemberIntermediateKeyWrapping{ + Value: (aws_cryptography_materialProviders_EdkWrappingAlgorithm_IntermediateKeyWrapping_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.EdkWrappingAlgorithm)).Dtor_IntermediateKeyWrapping())), + } + } + + return union + +} +func aws_cryptography_materialProviders_EdkWrappingAlgorithm_DIRECT_KEY_WRAPPING_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DIRECT_KEY_WRAPPING { + return awscryptographymaterialproviderssmithygeneratedtypes.DIRECT_KEY_WRAPPING{} +} +func aws_cryptography_materialProviders_EdkWrappingAlgorithm_IntermediateKeyWrapping_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.IntermediateKeyWrapping { + return awscryptographymaterialproviderssmithygeneratedtypes.IntermediateKeyWrapping{KeyEncryptionKeyKdf: aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping).Dtor_keyEncryptionKeyKdf()), + MacKeyKdf: aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping).Dtor_macKeyKdf()), + PdkEncryptAlgorithm: aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.IntermediateKeyWrapping).Dtor_pdkEncryptAlgorithm()), + } +} +func aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_HKDF() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_HKDF())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_IDENTITY() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_IDENTITY())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm { + var union awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithm + + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_HKDF() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberHKDF{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_HKDF_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_HKDF())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_IDENTITY() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberIDENTITY{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_IDENTITY_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_IDENTITY())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Is_None() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.DerivationAlgorithmMemberNone{ + Value: (aws_cryptography_materialProviders_DerivationAlgorithm_None_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.DerivationAlgorithm)).Dtor_None())), + } + } + + return union + +} +func aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.Encrypt { + var union awscryptographymaterialproviderssmithygeneratedtypes.Encrypt + + if (input.(AwsCryptographyMaterialProvidersTypes.Encrypt)).Is_AES__GCM() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.EncryptMemberAES_GCM{ + Value: (aws_cryptography_materialProviders_Encrypt_AES_GCM_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Encrypt)).Dtor_AES__GCM())), + } + } + + return union + +} +func aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_EncryptionContext_key_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_materialProviders_EncryptionContext_value_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo { + return awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteInfo{Id: aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_id()), + BinaryId: aws_cryptography_materialProviders_AlgorithmSuiteInfo_binaryId_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_binaryId()), + MessageVersion: aws_cryptography_materialProviders_AlgorithmSuiteInfo_messageVersion_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_messageVersion()), + Encrypt: aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_encrypt()), + Kdf: aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_kdf()), + Commitment: aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_commitment()), + Signature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_signature()), + SymmetricSignature: aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_symmetricSignature()), + EdkWrapping: aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo).Dtor_edkWrapping()), + } +} +func aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input interface{}) []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey { + fieldValue := make([]awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptedDataKeyList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_EncryptedDataKeyList_member_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey{KeyProviderId: aws_cryptography_materialProviders_EncryptedDataKey_keyProviderId_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptedDataKey).Dtor_keyProviderId()), + KeyProviderInfo: aws_cryptography_materialProviders_EncryptedDataKey_keyProviderInfo_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptedDataKey).Dtor_keyProviderInfo()), + Ciphertext: aws_cryptography_materialProviders_EncryptedDataKey_ciphertext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptedDataKey).Dtor_ciphertext()), + } +} +func aws_cryptography_materialProviders_EncryptedDataKey_keyProviderId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_materialProviders_EncryptedDataKey_keyProviderInfo_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_EncryptedDataKey_ciphertext_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input interface{}) [][]byte { + if input == nil { + return nil + } + fieldValue := make([][]byte, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_SymmetricSigningKeyList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_SymmetricSigningKeyList_member_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func Aws_cryptography_materialProviders_GetAlgorithmSuiteInfoInput_binaryId_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_signingKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_verificationKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy { + var union awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy + + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_CommitmentPolicy_ESDK_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.ESDKCommitmentPolicy { + return func() awscryptographymaterialproviderssmithygeneratedtypes.ESDKCommitmentPolicy { + var u awscryptographymaterialproviderssmithygeneratedtypes.ESDKCommitmentPolicy + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_ESDKCommitmentPolicy_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.ESDKCommitmentPolicy).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_CommitmentPolicy_DBE_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DBECommitmentPolicy { + return func() awscryptographymaterialproviderssmithygeneratedtypes.DBECommitmentPolicy { + var u awscryptographymaterialproviderssmithygeneratedtypes.DBECommitmentPolicy + inputEnum := input.(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy) + index := -1 + for allEnums := dafny.Iterate(AwsCryptographyMaterialProvidersTypes.CompanionStruct_DBECommitmentPolicy_{}.AllSingletonConstructors()); ; { + enum, ok := allEnums() + if ok { + index++ + if enum.(AwsCryptographyMaterialProvidersTypes.DBECommitmentPolicy).Equals(inputEnum) { + break + } + } + } + + return u.Values()[index] + }() +} +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy { + var union awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy + + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_start_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_ValidDecryptionMaterialsTransitionInput_stop_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_start_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_ValidEncryptionMaterialsTransitionInput_stop_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_GetBranchKeyIdOutput_branchKeyId_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_GetClientInput_region_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func Aws_cryptography_materialProviders_GetClientOutput_client_FromDafny(input interface{}) *kms.Client { + shim, ok := input.(*KMSwrapped.Shim) + if !ok { + panic("Not able to convert client to native") + } + return shim.Client + +} +func aws_cryptography_materialProviders_DeleteCacheEntryInput_identifier_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_GetCacheEntryInput_identifier_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_GetCacheEntryInput_bytesUsed_FromDafny(input interface{}) *int64 { + return func() *int64 { + var b int64 + if input == nil { + return nil + } + b = input.(int64) + return &b + }() +} +func aws_cryptography_materialProviders_GetCacheEntryOutput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.Materials { + var union awscryptographymaterialproviderssmithygeneratedtypes.Materials + + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_Encryption() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption{ + Value: (aws_cryptography_materialProviders_Materials_Encryption_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_Encryption())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_Decryption() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption{ + Value: (aws_cryptography_materialProviders_Materials_Decryption_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_Decryption())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_BranchKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey{ + Value: (aws_cryptography_materialProviders_Materials_BranchKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_BranchKey())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_BeaconKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey{ + Value: (aws_cryptography_materialProviders_Materials_BeaconKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_BeaconKey())), + } + } + + return union + +} +func aws_cryptography_materialProviders_Materials_Encryption_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_Materials_Decryption_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_Materials_BranchKey_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials { + return awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials{BranchKeyIdentifier: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyIdentifier()), + BranchKeyVersion: aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKeyVersion()), + EncryptionContext: aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_encryptionContext()), + BranchKey: aws_cryptography_keyStore_BranchKeyMaterials_branchKey_FromDafny(input.(AwsCryptographyKeyStoreTypes.BranchKeyMaterials).Dtor_branchKey()), + } +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKeyVersion_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_BranchKeyMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_EncryptionContext_key_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_EncryptionContext_value_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + // UTF bytes should be always converted from bytes to string in go + // Otherwise go treats the string as a unicode codepoint + + var valUint, _ = val.(uint8) + var byteSlice = []byte{valUint} + s = s + string(byteSlice) + + } + } + }() +} +func aws_cryptography_keyStore_BranchKeyMaterials_branchKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_Materials_BeaconKey_FromDafny(input interface{}) awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials { + return awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials{BeaconKeyIdentifier: aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_beaconKeyIdentifier()), + EncryptionContext: aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_encryptionContext()), + BeaconKey: aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_beaconKey().UnwrapOr(nil)), + HmacKeys: aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_FromDafny(input.(AwsCryptographyKeyStoreTypes.BeaconKeyMaterials).Dtor_hmacKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKeyIdentifier_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_BeaconKeyMaterials_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_BeaconKeyMaterials_beaconKey_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_keyStore_BeaconKeyMaterials_hmacKeys_FromDafny(input interface{}) map[string][]byte { + var m map[string][]byte = make(map[string][]byte) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_keyStore_HmacKeyMap_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_keyStore_HmacKeyMap_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_keyStore_HmacKeyMap_key_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_keyStore_HmacKeyMap_value_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_GetCacheEntryOutput_creationTime_FromDafny(input interface{}) int64 { + return func() int64 { + var b = input.(int64) + return b + }() + +} +func aws_cryptography_materialProviders_GetCacheEntryOutput_expiryTime_FromDafny(input interface{}) int64 { + return func() int64 { + var b = input.(int64) + return b + }() + +} +func aws_cryptography_materialProviders_GetCacheEntryOutput_messagesUsed_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_GetCacheEntryOutput_bytesUsed_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_PutCacheEntryInput_identifier_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_PutCacheEntryInput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.Materials { + var union awscryptographymaterialproviderssmithygeneratedtypes.Materials + + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_Encryption() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberEncryption{ + Value: (aws_cryptography_materialProviders_Materials_Encryption_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_Encryption())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_Decryption() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberDecryption{ + Value: (aws_cryptography_materialProviders_Materials_Decryption_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_Decryption())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_BranchKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBranchKey{ + Value: (aws_cryptography_materialProviders_Materials_BranchKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_BranchKey())), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.Materials)).Is_BeaconKey() { + + union = &awscryptographymaterialproviderssmithygeneratedtypes.MaterialsMemberBeaconKey{ + Value: (aws_cryptography_materialProviders_Materials_BeaconKey_FromDafny((input.(AwsCryptographyMaterialProvidersTypes.Materials)).Dtor_BeaconKey())), + } + } + + return union + +} +func aws_cryptography_materialProviders_PutCacheEntryInput_creationTime_FromDafny(input interface{}) int64 { + return func() int64 { + var b = input.(int64) + return b + }() + +} +func aws_cryptography_materialProviders_PutCacheEntryInput_expiryTime_FromDafny(input interface{}) int64 { + return func() int64 { + var b = input.(int64) + return b + }() + +} +func aws_cryptography_materialProviders_PutCacheEntryInput_messagesUsed_FromDafny(input interface{}) *int32 { + return func() *int32 { + var b int32 + if input == nil { + return nil + } + b = input.(int32) + return &b + }() +} +func aws_cryptography_materialProviders_PutCacheEntryInput_bytesUsed_FromDafny(input interface{}) *int32 { + return func() *int32 { + var b int32 + if input == nil { + return nil + } + b = input.(int32) + return &b + }() +} +func aws_cryptography_materialProviders_UpdateUsageMetadataInput_identifier_FromDafny(input interface{}) []byte { + return func() []byte { + var b []byte + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return b + } else { + b = append(b, val.(byte)) + } + } + }() +} +func aws_cryptography_materialProviders_UpdateUsageMetadataInput_bytesUsed_FromDafny(input interface{}) int32 { + return func() int32 { + var b = input.(int32) + return b + }() +} +func aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy { + var union awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy + + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_FromDafny(input interface{}) []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey { + fieldValue := make([]awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptedDataKeyList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_DecryptMaterialsOutput_decryptionMaterials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_FromDafny(input interface{}) map[string]string { + var m map[string]string = make(map[string]string) + if input == nil { + return nil + } + for i := dafny.Iterate(input.(dafny.Map).Items()); ; { + val, ok := i() + if !ok { + break + } + m[aws_cryptography_materialProviders_EncryptionContext_key_FromDafny((*val.(dafny.Tuple).IndexInt(0)))] = aws_cryptography_materialProviders_EncryptionContext_value_FromDafny((*val.(dafny.Tuple).IndexInt(1))) + } + return m + +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy { + var union awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicy + + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberESDK{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.CommitmentPolicy)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.CommitmentPolicyMemberDBE{ + Value: (aws_cryptography_materialProviders_CommitmentPolicy_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId { + var union awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteId + if input == nil { + return nil + } + + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_ESDK() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_ESDK()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberESDK{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_ESDK_FromDafny(dataSource.UnwrapOr(nil))), + } + } + if (input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Is_DBE() { + var dataSource = Wrappers.Companion_Option_.Create_Some_((input.(AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteId)).Dtor_DBE()) + union = &awscryptographymaterialproviderssmithygeneratedtypes.AlgorithmSuiteIdMemberDBE{ + Value: (aws_cryptography_materialProviders_AlgorithmSuiteId_DBE_FromDafny(dataSource.UnwrapOr(nil))), + } + } + + return union + +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_maxPlaintextLength_FromDafny(input interface{}) *int64 { + return func() *int64 { + var b int64 + if input == nil { + return nil + } + b = input.(int64) + return &b + }() +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_FromDafny(input interface{}) []string { + if input == nil { + return nil + } + fieldValue := make([]string, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptionContextKeys_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_GetEncryptionMaterialsOutput_encryptionMaterials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_OnDecryptInput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_FromDafny(input interface{}) []awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey { + fieldValue := make([]awscryptographymaterialproviderssmithygeneratedtypes.EncryptedDataKey, 0) + for i := dafny.Iterate(input.(dafny.Sequence)); ; { + val, ok := i() + if !ok { + break + } + fieldValue = append(fieldValue, aws_cryptography_materialProviders_EncryptedDataKeyList_member_FromDafny(val)) + } + return fieldValue +} +func aws_cryptography_materialProviders_OnDecryptOutput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.DecryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_DecryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_encryptionContext()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_DecryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + VerificationKey: aws_cryptography_materialProviders_DecryptionMaterials_verificationKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_verificationKey().UnwrapOr(nil)), + SymmetricSigningKey: aws_cryptography_materialProviders_DecryptionMaterials_symmetricSigningKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.DecryptionMaterials).Dtor_symmetricSigningKey().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_OnEncryptInput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_OnEncryptOutput_materials_FromDafny(input interface{}) awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials { + return awscryptographymaterialproviderssmithygeneratedtypes.EncryptionMaterials{AlgorithmSuite: aws_cryptography_materialProviders_EncryptionMaterials_algorithmSuite_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_algorithmSuite()), + EncryptionContext: aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptionContext()), + EncryptedDataKeys: aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_encryptedDataKeys()), + RequiredEncryptionContextKeys: aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_requiredEncryptionContextKeys()), + PlaintextDataKey: aws_cryptography_materialProviders_EncryptionMaterials_plaintextDataKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_plaintextDataKey().UnwrapOr(nil)), + SigningKey: aws_cryptography_materialProviders_EncryptionMaterials_signingKey_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_signingKey().UnwrapOr(nil)), + SymmetricSigningKeys: aws_cryptography_materialProviders_EncryptionMaterials_symmetricSigningKeys_FromDafny(input.(AwsCryptographyMaterialProvidersTypes.EncryptionMaterials).Dtor_symmetricSigningKeys().UnwrapOr(nil)), + } +} +func aws_cryptography_materialProviders_AwsCryptographicMaterialProvidersException_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_EntryAlreadyExists_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_EntryDoesNotExist_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InFlightTTLExceeded_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfo_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnDecrypt_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidAlgorithmSuiteInfoOnEncrypt_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidDecryptionMaterials_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidDecryptionMaterialsTransition_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidEncryptionMaterials_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func aws_cryptography_materialProviders_InvalidEncryptionMaterialsTransition_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/enums.go b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/enums.go new file mode 100644 index 000000000..147df8a84 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/enums.go @@ -0,0 +1,127 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygeneratedtypes + +type AesWrappingAlg string + +const ( + AesWrappingAlgAlgAes128GcmIv12Tag16 AesWrappingAlg = "ALG_AES128_GCM_IV12_TAG16" + AesWrappingAlgAlgAes192GcmIv12Tag16 AesWrappingAlg = "ALG_AES192_GCM_IV12_TAG16" + AesWrappingAlgAlgAes256GcmIv12Tag16 AesWrappingAlg = "ALG_AES256_GCM_IV12_TAG16" +) + +func (AesWrappingAlg) Values() []AesWrappingAlg { + return []AesWrappingAlg{ + "ALG_AES128_GCM_IV12_TAG16", + "ALG_AES192_GCM_IV12_TAG16", + "ALG_AES256_GCM_IV12_TAG16", + } +} + +type DBEAlgorithmSuiteId string + +const ( + DBEAlgorithmSuiteIdAlgAes256GcmHkdfSha512CommitKeySymsigHmacSha384 DBEAlgorithmSuiteId = "0x6700" + DBEAlgorithmSuiteIdAlgAes256GcmHkdfSha512CommitKeyEcdsaP384SymsigHmacSha384 DBEAlgorithmSuiteId = "0x6701" +) + +func (DBEAlgorithmSuiteId) Values() []DBEAlgorithmSuiteId { + return []DBEAlgorithmSuiteId{ + "0x6700", + "0x6701", + } +} + +type ESDKAlgorithmSuiteId string + +const ( + ESDKAlgorithmSuiteIdAlgAes128GcmIv12Tag16NoKdf ESDKAlgorithmSuiteId = "0x0014" + ESDKAlgorithmSuiteIdAlgAes192GcmIv12Tag16NoKdf ESDKAlgorithmSuiteId = "0x0046" + ESDKAlgorithmSuiteIdAlgAes256GcmIv12Tag16NoKdf ESDKAlgorithmSuiteId = "0x0078" + ESDKAlgorithmSuiteIdAlgAes128GcmIv12Tag16HkdfSha256 ESDKAlgorithmSuiteId = "0x0114" + ESDKAlgorithmSuiteIdAlgAes192GcmIv12Tag16HkdfSha256 ESDKAlgorithmSuiteId = "0x0146" + ESDKAlgorithmSuiteIdAlgAes256GcmIv12Tag16HkdfSha256 ESDKAlgorithmSuiteId = "0x0178" + ESDKAlgorithmSuiteIdAlgAes128GcmIv12Tag16HkdfSha256EcdsaP256 ESDKAlgorithmSuiteId = "0x0214" + ESDKAlgorithmSuiteIdAlgAes192GcmIv12Tag16HkdfSha384EcdsaP384 ESDKAlgorithmSuiteId = "0x0346" + ESDKAlgorithmSuiteIdAlgAes256GcmIv12Tag16HkdfSha384EcdsaP384 ESDKAlgorithmSuiteId = "0x0378" + ESDKAlgorithmSuiteIdAlgAes256GcmHkdfSha512CommitKey ESDKAlgorithmSuiteId = "0x0478" + ESDKAlgorithmSuiteIdAlgAes256GcmHkdfSha512CommitKeyEcdsaP384 ESDKAlgorithmSuiteId = "0x0578" +) + +func (ESDKAlgorithmSuiteId) Values() []ESDKAlgorithmSuiteId { + return []ESDKAlgorithmSuiteId{ + "0x0014", + "0x0046", + "0x0078", + "0x0114", + "0x0146", + "0x0178", + "0x0214", + "0x0346", + "0x0378", + "0x0478", + "0x0578", + } +} + +type TimeUnits string + +const ( + TimeUnitsSeconds TimeUnits = "Seconds" + TimeUnitsMilliseconds TimeUnits = "Milliseconds" +) + +func (TimeUnits) Values() []TimeUnits { + return []TimeUnits{ + "Seconds", + "Milliseconds", + } +} + +type PaddingScheme string + +const ( + PaddingSchemePkcs1 PaddingScheme = "PKCS1" + PaddingSchemeOaepSha1Mgf1 PaddingScheme = "OAEP_SHA1_MGF1" + PaddingSchemeOaepSha256Mgf1 PaddingScheme = "OAEP_SHA256_MGF1" + PaddingSchemeOaepSha384Mgf1 PaddingScheme = "OAEP_SHA384_MGF1" + PaddingSchemeOaepSha512Mgf1 PaddingScheme = "OAEP_SHA512_MGF1" +) + +func (PaddingScheme) Values() []PaddingScheme { + return []PaddingScheme{ + "PKCS1", + "OAEP_SHA1_MGF1", + "OAEP_SHA256_MGF1", + "OAEP_SHA384_MGF1", + "OAEP_SHA512_MGF1", + } +} + +type DBECommitmentPolicy string + +const ( + DBECommitmentPolicyRequireEncryptRequireDecrypt DBECommitmentPolicy = "REQUIRE_ENCRYPT_REQUIRE_DECRYPT" +) + +func (DBECommitmentPolicy) Values() []DBECommitmentPolicy { + return []DBECommitmentPolicy{ + "REQUIRE_ENCRYPT_REQUIRE_DECRYPT", + } +} + +type ESDKCommitmentPolicy string + +const ( + ESDKCommitmentPolicyForbidEncryptAllowDecrypt ESDKCommitmentPolicy = "FORBID_ENCRYPT_ALLOW_DECRYPT" + ESDKCommitmentPolicyRequireEncryptAllowDecrypt ESDKCommitmentPolicy = "REQUIRE_ENCRYPT_ALLOW_DECRYPT" + ESDKCommitmentPolicyRequireEncryptRequireDecrypt ESDKCommitmentPolicy = "REQUIRE_ENCRYPT_REQUIRE_DECRYPT" +) + +func (ESDKCommitmentPolicy) Values() []ESDKCommitmentPolicy { + return []ESDKCommitmentPolicy{ + "FORBID_ENCRYPT_ALLOW_DECRYPT", + "REQUIRE_ENCRYPT_ALLOW_DECRYPT", + "REQUIRE_ENCRYPT_REQUIRE_DECRYPT", + } +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/errors.go b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/errors.go new file mode 100644 index 000000000..25535e951 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/errors.go @@ -0,0 +1,117 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygeneratedtypes + +import ( + "fmt" +) + +type AwsCryptographicMaterialProvidersException struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e AwsCryptographicMaterialProvidersException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidDecryptionMaterials struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidDecryptionMaterials) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidEncryptionMaterials struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidEncryptionMaterials) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidAlgorithmSuiteInfo struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidAlgorithmSuiteInfo) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidAlgorithmSuiteInfoOnDecrypt struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidAlgorithmSuiteInfoOnDecrypt) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidAlgorithmSuiteInfoOnEncrypt struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidAlgorithmSuiteInfoOnEncrypt) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidDecryptionMaterialsTransition struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidDecryptionMaterialsTransition) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InvalidEncryptionMaterialsTransition struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InvalidEncryptionMaterialsTransition) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type EntryAlreadyExists struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e EntryAlreadyExists) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type EntryDoesNotExist struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e EntryDoesNotExist) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} + +type InFlightTTLExceeded struct { + AwsCryptographicMaterialProvidersBaseException + Message string + ErrorCodeOverride *string +} + +func (e InFlightTTLExceeded) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/types.go b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/types.go new file mode 100644 index 000000000..cd2046f6d --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/types.go @@ -0,0 +1,2357 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygeneratedtypes + +import ( + "fmt" + "unicode/utf8" + + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygenerated" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographykeystoresmithygeneratedtypes" + "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/awscryptographyprimitivessmithygeneratedtypes" + "github.com/aws/aws-sdk-go-v2/service/kms" + kmstypes "github.com/aws/aws-sdk-go-v2/service/kms/types" +) + +type HKDF struct { + Hmac awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm + + InputKeyLength int32 + + OutputKeyLength int32 + + SaltLength int32 +} + +func (input HKDF) Validate() error { + if input.InputKeyLength < 1 { + return fmt.Errorf("SymmetricKeyLength has a minimum of 1 but has the value of %d.", input.InputKeyLength) + } + if input.InputKeyLength > 32 { + return fmt.Errorf("SymmetricKeyLength has a maximum of 32 but has the value of %d.", input.InputKeyLength) + } + if input.OutputKeyLength < 1 { + return fmt.Errorf("SymmetricKeyLength has a minimum of 1 but has the value of %d.", input.OutputKeyLength) + } + if input.OutputKeyLength > 32 { + return fmt.Errorf("SymmetricKeyLength has a maximum of 32 but has the value of %d.", input.OutputKeyLength) + } + if input.SaltLength < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", input.SaltLength) + } + + return nil +} + +type IDENTITY struct { +} + +func (input IDENTITY) Validate() error { + + return nil +} + +type None struct { +} + +func (input None) Validate() error { + + return nil +} + +type DIRECT_KEY_WRAPPING struct { +} + +func (input DIRECT_KEY_WRAPPING) Validate() error { + + return nil +} + +type IntermediateKeyWrapping struct { + KeyEncryptionKeyKdf DerivationAlgorithm + + MacKeyKdf DerivationAlgorithm + + PdkEncryptAlgorithm Encrypt +} + +func (input IntermediateKeyWrapping) Validate() error { + if input.KeyEncryptionKeyKdf == nil { + return fmt.Errorf("input.KeyEncryptionKeyKdf is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_Validate() != nil { + return input.aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_Validate() + } + if input.MacKeyKdf == nil { + return fmt.Errorf("input.MacKeyKdf is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_Validate() != nil { + return input.aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_Validate() + } + if input.PdkEncryptAlgorithm == nil { + return fmt.Errorf("input.PdkEncryptAlgorithm is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_Validate() != nil { + return input.aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_Validate() + } + + return nil +} + +func (input IntermediateKeyWrapping) aws_cryptography_materialProviders_IntermediateKeyWrapping_keyEncryptionKeyKdf_Validate() error { + if input.KeyEncryptionKeyKdf == nil { + return nil + } + switch unionType := input.KeyEncryptionKeyKdf.(type) { + case *DerivationAlgorithmMemberHKDF: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberIDENTITY: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input IntermediateKeyWrapping) aws_cryptography_materialProviders_IntermediateKeyWrapping_macKeyKdf_Validate() error { + if input.MacKeyKdf == nil { + return nil + } + switch unionType := input.MacKeyKdf.(type) { + case *DerivationAlgorithmMemberHKDF: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberIDENTITY: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input IntermediateKeyWrapping) aws_cryptography_materialProviders_IntermediateKeyWrapping_pdkEncryptAlgorithm_Validate() error { + if input.PdkEncryptAlgorithm == nil { + return nil + } + switch unionType := input.PdkEncryptAlgorithm.(type) { + case *EncryptMemberAES_GCM: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type ECDSA struct { + Curve awscryptographyprimitivessmithygeneratedtypes.ECDSASignatureAlgorithm +} + +func (input ECDSA) Validate() error { + + return nil +} + +type AlgorithmSuiteInfo struct { + BinaryId []byte + + Commitment DerivationAlgorithm + + EdkWrapping EdkWrappingAlgorithm + + Encrypt Encrypt + + Id AlgorithmSuiteId + + Kdf DerivationAlgorithm + + MessageVersion int32 + + Signature SignatureAlgorithm + + SymmetricSignature SymmetricSignatureAlgorithm +} + +func (input AlgorithmSuiteInfo) Validate() error { + if input.Commitment == nil { + return fmt.Errorf("input.Commitment is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_Validate() + } + if input.EdkWrapping == nil { + return fmt.Errorf("input.EdkWrapping is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_Validate() + } + if input.Encrypt == nil { + return fmt.Errorf("input.Encrypt is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_Validate() + } + if input.Id == nil { + return fmt.Errorf("input.Id is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_Validate() + } + if input.Kdf == nil { + return fmt.Errorf("input.Kdf is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_Validate() + } + if input.Signature == nil { + return fmt.Errorf("input.Signature is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_Validate() + } + if input.SymmetricSignature == nil { + return fmt.Errorf("input.SymmetricSignature is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_Validate() != nil { + return input.aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_Validate() + } + + return nil +} + +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_commitment_Validate() error { + if input.Commitment == nil { + return nil + } + switch unionType := input.Commitment.(type) { + case *DerivationAlgorithmMemberHKDF: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberIDENTITY: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_edkWrapping_Validate() error { + if input.EdkWrapping == nil { + return nil + } + switch unionType := input.EdkWrapping.(type) { + case *EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *EdkWrappingAlgorithmMemberIntermediateKeyWrapping: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_encrypt_Validate() error { + if input.Encrypt == nil { + return nil + } + switch unionType := input.Encrypt.(type) { + case *EncryptMemberAES_GCM: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_id_Validate() error { + if input.Id == nil { + return nil + } + switch unionType := input.Id.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_kdf_Validate() error { + if input.Kdf == nil { + return nil + } + switch unionType := input.Kdf.(type) { + case *DerivationAlgorithmMemberHKDF: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberIDENTITY: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *DerivationAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_signature_Validate() error { + if input.Signature == nil { + return nil + } + switch unionType := input.Signature.(type) { + case *SignatureAlgorithmMemberECDSA: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *SignatureAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input AlgorithmSuiteInfo) aws_cryptography_materialProviders_AlgorithmSuiteInfo_symmetricSignature_Validate() error { + if input.SymmetricSignature == nil { + return nil + } + switch unionType := input.SymmetricSignature.(type) { + case *SymmetricSignatureAlgorithmMemberHMAC: + case *SymmetricSignatureAlgorithmMemberNone: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type GetClientInput struct { + Region string +} + +func (input GetClientInput) Validate() error { + + return nil +} + +type KmsClientReference struct { +} + +func (input KmsClientReference) Validate() error { + + return nil +} + +type GetClientOutput struct { + Client *kms.Client +} + +func (input GetClientOutput) Validate() error { + + return nil +} + +type DiscoveryFilter struct { + AccountIds []string + + Partition string +} + +func (input DiscoveryFilter) Validate() error { + if input.AccountIds == nil { + return fmt.Errorf("input.AccountIds is required but has a nil value.") + } + + return nil +} + +type CreateAwsKmsDiscoveryKeyringInput struct { + KmsClient *kms.Client + + DiscoveryFilter *DiscoveryFilter + + GrantTokens []string +} + +func (input CreateAwsKmsDiscoveryKeyringInput) Validate() error { + if input.DiscoveryFilter != nil { + if input.DiscoveryFilter.Validate() != nil { + return input.DiscoveryFilter.Validate() + } + + } + + return nil +} + +type KeyringReference struct { +} + +func (input KeyringReference) Validate() error { + + return nil +} + +type CreateKeyringOutput struct { + Keyring IKeyring +} + +func (input CreateKeyringOutput) Validate() error { + + return nil +} + +type ClientSupplierReference struct { +} + +func (input ClientSupplierReference) Validate() error { + + return nil +} + +type CreateAwsKmsDiscoveryMultiKeyringInput struct { + Regions []string + + ClientSupplier IClientSupplier + + DiscoveryFilter *DiscoveryFilter + + GrantTokens []string +} + +func (input CreateAwsKmsDiscoveryMultiKeyringInput) Validate() error { + if input.Regions == nil { + return fmt.Errorf("input.Regions is required but has a nil value.") + } + if input.DiscoveryFilter != nil { + if input.DiscoveryFilter.Validate() != nil { + return input.DiscoveryFilter.Validate() + } + + } + + return nil +} + +type KmsPrivateKeyToStaticPublicKeyInput struct { + RecipientPublicKey []byte + + SenderKmsIdentifier string + + SenderPublicKey []byte +} + +func (input KmsPrivateKeyToStaticPublicKeyInput) Validate() error { + + return nil +} + +type KmsPublicKeyDiscoveryInput struct { + RecipientKmsIdentifier string +} + +func (input KmsPublicKeyDiscoveryInput) Validate() error { + + return nil +} + +type CreateAwsKmsEcdhKeyringInput struct { + CurveSpec awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec + + KeyAgreementScheme KmsEcdhStaticConfigurations + + KmsClient *kms.Client + + GrantTokens []string +} + +func (input CreateAwsKmsEcdhKeyringInput) Validate() error { + if input.KeyAgreementScheme == nil { + return fmt.Errorf("input.KeyAgreementScheme is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_Validate() != nil { + return input.aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_Validate() + } + + return nil +} + +func (input CreateAwsKmsEcdhKeyringInput) aws_cryptography_materialProviders_CreateAwsKmsEcdhKeyringInput_KeyAgreementScheme_Validate() error { + if input.KeyAgreementScheme == nil { + return nil + } + switch unionType := input.KeyAgreementScheme.(type) { + case *KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type BranchKeyIdSupplierReference struct { +} + +func (input BranchKeyIdSupplierReference) Validate() error { + + return nil +} + +type DefaultCache struct { + EntryCapacity int32 +} + +func (input DefaultCache) Validate() error { + if input.EntryCapacity < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.EntryCapacity) + } + + return nil +} + +type MultiThreadedCache struct { + EntryCapacity int32 + + EntryPruningTailSize *int32 +} + +func (input MultiThreadedCache) Validate() error { + if input.EntryCapacity < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.EntryCapacity) + } + if input.EntryPruningTailSize != nil { + if *input.EntryPruningTailSize < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", *input.EntryPruningTailSize) + } + } + + return nil +} + +type NoCache struct { +} + +func (input NoCache) Validate() error { + + return nil +} + +type CryptographicMaterialsCacheReference struct { +} + +func (input CryptographicMaterialsCacheReference) Validate() error { + + return nil +} + +type SingleThreadedCache struct { + EntryCapacity int32 + + EntryPruningTailSize *int32 +} + +func (input SingleThreadedCache) Validate() error { + if input.EntryCapacity < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.EntryCapacity) + } + if input.EntryPruningTailSize != nil { + if *input.EntryPruningTailSize < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", *input.EntryPruningTailSize) + } + } + + return nil +} + +type StormTrackingCache struct { + EntryCapacity int32 + + FanOut int32 + + GraceInterval int32 + + GracePeriod int32 + + InFlightTTL int32 + + SleepMilli int32 + + EntryPruningTailSize *int32 + + TimeUnits *TimeUnits +} + +func (input StormTrackingCache) Validate() error { + if input.EntryCapacity < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.EntryCapacity) + } + if input.FanOut < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.FanOut) + } + if input.GraceInterval < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.GraceInterval) + } + if input.GracePeriod < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.GracePeriod) + } + if input.InFlightTTL < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.InFlightTTL) + } + if input.SleepMilli < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", input.SleepMilli) + } + if input.EntryPruningTailSize != nil { + if *input.EntryPruningTailSize < 1 { + return fmt.Errorf("CountingNumber has a minimum of 1 but has the value of %d.", *input.EntryPruningTailSize) + } + } + + return nil +} + +type KeyStoreReference struct { +} + +func (input KeyStoreReference) Validate() error { + + return nil +} + +type CreateAwsKmsHierarchicalKeyringInput struct { + KeyStore *awscryptographykeystoresmithygenerated.Client + + TtlSeconds int64 + + BranchKeyId *string + + BranchKeyIdSupplier IBranchKeyIdSupplier + + Cache CacheType + + PartitionId *string +} + +func (input CreateAwsKmsHierarchicalKeyringInput) Validate() error { + if input.TtlSeconds < 0 { + return fmt.Errorf("PositiveLong has a minimum of 0 but has the value of %d.", input.TtlSeconds) + } + if input.aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_Validate() != nil { + return input.aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_Validate() + } + + return nil +} + +func (input CreateAwsKmsHierarchicalKeyringInput) aws_cryptography_materialProviders_CreateAwsKmsHierarchicalKeyringInput_cache_Validate() error { + if input.Cache == nil { + return nil + } + switch unionType := input.Cache.(type) { + case *CacheTypeMemberDefault: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberNo: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberSingleThreaded: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberMultiThreaded: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberStormTracking: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberShared: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type CreateAwsKmsKeyringInput struct { + KmsClient *kms.Client + + KmsKeyId string + + GrantTokens []string +} + +func (input CreateAwsKmsKeyringInput) Validate() error { + + return nil +} + +type CreateAwsKmsMrkDiscoveryKeyringInput struct { + KmsClient *kms.Client + + Region string + + DiscoveryFilter *DiscoveryFilter + + GrantTokens []string +} + +func (input CreateAwsKmsMrkDiscoveryKeyringInput) Validate() error { + if input.DiscoveryFilter != nil { + if input.DiscoveryFilter.Validate() != nil { + return input.DiscoveryFilter.Validate() + } + + } + + return nil +} + +type CreateAwsKmsMrkDiscoveryMultiKeyringInput struct { + Regions []string + + ClientSupplier IClientSupplier + + DiscoveryFilter *DiscoveryFilter + + GrantTokens []string +} + +func (input CreateAwsKmsMrkDiscoveryMultiKeyringInput) Validate() error { + if input.Regions == nil { + return fmt.Errorf("input.Regions is required but has a nil value.") + } + if input.DiscoveryFilter != nil { + if input.DiscoveryFilter.Validate() != nil { + return input.DiscoveryFilter.Validate() + } + + } + + return nil +} + +type CreateAwsKmsMrkKeyringInput struct { + KmsClient *kms.Client + + KmsKeyId string + + GrantTokens []string +} + +func (input CreateAwsKmsMrkKeyringInput) Validate() error { + + return nil +} + +type CreateAwsKmsMrkMultiKeyringInput struct { + ClientSupplier IClientSupplier + + Generator *string + + GrantTokens []string + + KmsKeyIds []string +} + +func (input CreateAwsKmsMrkMultiKeyringInput) Validate() error { + + return nil +} + +type CreateAwsKmsMultiKeyringInput struct { + ClientSupplier IClientSupplier + + Generator *string + + GrantTokens []string + + KmsKeyIds []string +} + +func (input CreateAwsKmsMultiKeyringInput) Validate() error { + + return nil +} + +type CreateAwsKmsRsaKeyringInput struct { + EncryptionAlgorithm kmstypes.EncryptionAlgorithmSpec + + KmsKeyId string + + GrantTokens []string + + KmsClient *kms.Client + + PublicKey []byte +} + +func (input CreateAwsKmsRsaKeyringInput) Validate() error { + + return nil +} + +type CreateCryptographicMaterialsCacheInput struct { + Cache CacheType +} + +func (input CreateCryptographicMaterialsCacheInput) Validate() error { + if input.Cache == nil { + return fmt.Errorf("input.Cache is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_Validate() != nil { + return input.aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_Validate() + } + + return nil +} + +func (input CreateCryptographicMaterialsCacheInput) aws_cryptography_materialProviders_CreateCryptographicMaterialsCacheInput_cache_Validate() error { + if input.Cache == nil { + return nil + } + switch unionType := input.Cache.(type) { + case *CacheTypeMemberDefault: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberNo: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberSingleThreaded: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberMultiThreaded: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberStormTracking: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *CacheTypeMemberShared: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type CreateCryptographicMaterialsCacheOutput struct { + MaterialsCache ICryptographicMaterialsCache +} + +func (input CreateCryptographicMaterialsCacheOutput) Validate() error { + + return nil +} + +type CreateDefaultClientSupplierInput struct { +} + +func (input CreateDefaultClientSupplierInput) Validate() error { + + return nil +} + +type CreateDefaultClientSupplierOutput struct { + Client IClientSupplier +} + +func (input CreateDefaultClientSupplierOutput) Validate() error { + + return nil +} + +type CryptographicMaterialsManagerReference struct { +} + +func (input CryptographicMaterialsManagerReference) Validate() error { + + return nil +} + +type CreateCryptographicMaterialsManagerOutput struct { + MaterialsManager ICryptographicMaterialsManager +} + +func (input CreateCryptographicMaterialsManagerOutput) Validate() error { + + return nil +} + +type CreateDefaultCryptographicMaterialsManagerInput struct { + Keyring IKeyring +} + +func (input CreateDefaultCryptographicMaterialsManagerInput) Validate() error { + + return nil +} + +type CreateMultiKeyringInput struct { + ChildKeyrings []IKeyring + + Generator IKeyring +} + +func (input CreateMultiKeyringInput) Validate() error { + if input.ChildKeyrings == nil { + return fmt.Errorf("input.ChildKeyrings is required but has a nil value.") + } + + return nil +} + +type CreateRawAesKeyringInput struct { + KeyName string + + KeyNamespace string + + WrappingAlg AesWrappingAlg + + WrappingKey []byte +} + +func (input CreateRawAesKeyringInput) Validate() error { + + return nil +} + +type EphemeralPrivateKeyToStaticPublicKeyInput struct { + RecipientPublicKey []byte +} + +func (input EphemeralPrivateKeyToStaticPublicKeyInput) Validate() error { + + return nil +} + +type PublicKeyDiscoveryInput struct { + RecipientStaticPrivateKey []byte +} + +func (input PublicKeyDiscoveryInput) Validate() error { + + return nil +} + +type RawPrivateKeyToStaticPublicKeyInput struct { + RecipientPublicKey []byte + + SenderStaticPrivateKey []byte +} + +func (input RawPrivateKeyToStaticPublicKeyInput) Validate() error { + + return nil +} + +type CreateRawEcdhKeyringInput struct { + CurveSpec awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec + + KeyAgreementScheme RawEcdhStaticConfigurations +} + +func (input CreateRawEcdhKeyringInput) Validate() error { + if input.KeyAgreementScheme == nil { + return fmt.Errorf("input.KeyAgreementScheme is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_Validate() != nil { + return input.aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_Validate() + } + + return nil +} + +func (input CreateRawEcdhKeyringInput) aws_cryptography_materialProviders_CreateRawEcdhKeyringInput_KeyAgreementScheme_Validate() error { + if input.KeyAgreementScheme == nil { + return nil + } + switch unionType := input.KeyAgreementScheme.(type) { + case *RawEcdhStaticConfigurationsMemberPublicKeyDiscovery: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type CreateRawRsaKeyringInput struct { + KeyName string + + KeyNamespace string + + PaddingScheme PaddingScheme + + PrivateKey []byte + + PublicKey []byte +} + +func (input CreateRawRsaKeyringInput) Validate() error { + + return nil +} + +type CreateRequiredEncryptionContextCMMInput struct { + RequiredEncryptionContextKeys []string + + Keyring IKeyring + + UnderlyingCMM ICryptographicMaterialsManager +} + +func (input CreateRequiredEncryptionContextCMMInput) Validate() error { + if input.RequiredEncryptionContextKeys == nil { + return fmt.Errorf("input.RequiredEncryptionContextKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input CreateRequiredEncryptionContextCMMInput) aws_cryptography_materialProviders_CreateRequiredEncryptionContextCMMInput_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type CreateRequiredEncryptionContextCMMOutput struct { + MaterialsManager ICryptographicMaterialsManager +} + +func (input CreateRequiredEncryptionContextCMMOutput) Validate() error { + + return nil +} + +type EncryptedDataKey struct { + Ciphertext []byte + + KeyProviderId string + + KeyProviderInfo []byte +} + +func (input EncryptedDataKey) Validate() error { + if !utf8.ValidString(input.KeyProviderId) { + return fmt.Errorf("Invalid UTF bytes %s ", input.KeyProviderId) + } + + return nil +} + +type DecryptMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + + CommitmentPolicy CommitmentPolicy + + EncryptedDataKeys []EncryptedDataKey + + EncryptionContext map[string]string + + ReproducedEncryptionContext map[string]string +} + +func (input DecryptMaterialsInput) Validate() error { + if input.AlgorithmSuiteId == nil { + return fmt.Errorf("input.AlgorithmSuiteId is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_Validate() + } + if input.CommitmentPolicy == nil { + return fmt.Errorf("input.CommitmentPolicy is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_Validate() + } + if input.EncryptedDataKeys == nil { + return fmt.Errorf("input.EncryptedDataKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_Validate() + } + if input.aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_Validate() + } + + return nil +} + +func (input DecryptMaterialsInput) aws_cryptography_materialProviders_DecryptMaterialsInput_algorithmSuiteId_Validate() error { + if input.AlgorithmSuiteId == nil { + return nil + } + switch unionType := input.AlgorithmSuiteId.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input DecryptMaterialsInput) aws_cryptography_materialProviders_DecryptMaterialsInput_commitmentPolicy_Validate() error { + if input.CommitmentPolicy == nil { + return nil + } + switch unionType := input.CommitmentPolicy.(type) { + case *CommitmentPolicyMemberESDK: + case *CommitmentPolicyMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input DecryptMaterialsInput) aws_cryptography_materialProviders_DecryptMaterialsInput_encryptedDataKeys_Validate() error { + for _, item := range input.EncryptedDataKeys { + if item.Validate() != nil { + return item.Validate() + } + } + + return nil +} +func (input DecryptMaterialsInput) aws_cryptography_materialProviders_DecryptMaterialsInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input DecryptMaterialsInput) aws_cryptography_materialProviders_DecryptMaterialsInput_reproducedEncryptionContext_Validate() error { + for key, value := range input.ReproducedEncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} + +type DecryptionMaterials struct { + AlgorithmSuite AlgorithmSuiteInfo + + EncryptionContext map[string]string + + RequiredEncryptionContextKeys []string + + PlaintextDataKey []byte + + SymmetricSigningKey []byte + + VerificationKey []byte +} + +func (input DecryptionMaterials) Validate() error { + if input.AlgorithmSuite.Validate() != nil { + return input.AlgorithmSuite.Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_Validate() + } + if input.RequiredEncryptionContextKeys == nil { + return fmt.Errorf("input.RequiredEncryptionContextKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input DecryptionMaterials) aws_cryptography_materialProviders_DecryptionMaterials_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input DecryptionMaterials) aws_cryptography_materialProviders_DecryptionMaterials_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type DecryptMaterialsOutput struct { + DecryptionMaterials DecryptionMaterials +} + +func (input DecryptMaterialsOutput) Validate() error { + if input.DecryptionMaterials.Validate() != nil { + return input.DecryptionMaterials.Validate() + } + + return nil +} + +type GetEncryptionMaterialsInput struct { + CommitmentPolicy CommitmentPolicy + + EncryptionContext map[string]string + + AlgorithmSuiteId AlgorithmSuiteId + + MaxPlaintextLength *int64 + + RequiredEncryptionContextKeys []string +} + +func (input GetEncryptionMaterialsInput) Validate() error { + if input.CommitmentPolicy == nil { + return fmt.Errorf("input.CommitmentPolicy is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_Validate() != nil { + return input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_Validate() + } + if input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_Validate() != nil { + return input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_Validate() + } + if input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input GetEncryptionMaterialsInput) aws_cryptography_materialProviders_GetEncryptionMaterialsInput_commitmentPolicy_Validate() error { + if input.CommitmentPolicy == nil { + return nil + } + switch unionType := input.CommitmentPolicy.(type) { + case *CommitmentPolicyMemberESDK: + case *CommitmentPolicyMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input GetEncryptionMaterialsInput) aws_cryptography_materialProviders_GetEncryptionMaterialsInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input GetEncryptionMaterialsInput) aws_cryptography_materialProviders_GetEncryptionMaterialsInput_algorithmSuiteId_Validate() error { + if input.AlgorithmSuiteId == nil { + return nil + } + switch unionType := input.AlgorithmSuiteId.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input GetEncryptionMaterialsInput) aws_cryptography_materialProviders_GetEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type EncryptionMaterials struct { + AlgorithmSuite AlgorithmSuiteInfo + + EncryptedDataKeys []EncryptedDataKey + + EncryptionContext map[string]string + + RequiredEncryptionContextKeys []string + + PlaintextDataKey []byte + + SigningKey []byte + + SymmetricSigningKeys [][]byte +} + +func (input EncryptionMaterials) Validate() error { + if input.AlgorithmSuite.Validate() != nil { + return input.AlgorithmSuite.Validate() + } + if input.EncryptedDataKeys == nil { + return fmt.Errorf("input.EncryptedDataKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_Validate() + } + if input.RequiredEncryptionContextKeys == nil { + return fmt.Errorf("input.RequiredEncryptionContextKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input EncryptionMaterials) aws_cryptography_materialProviders_EncryptionMaterials_encryptedDataKeys_Validate() error { + for _, item := range input.EncryptedDataKeys { + if item.Validate() != nil { + return item.Validate() + } + } + + return nil +} +func (input EncryptionMaterials) aws_cryptography_materialProviders_EncryptionMaterials_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input EncryptionMaterials) aws_cryptography_materialProviders_EncryptionMaterials_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type GetEncryptionMaterialsOutput struct { + EncryptionMaterials EncryptionMaterials +} + +func (input GetEncryptionMaterialsOutput) Validate() error { + if input.EncryptionMaterials.Validate() != nil { + return input.EncryptionMaterials.Validate() + } + + return nil +} + +type GetAlgorithmSuiteInfoInput struct { + BinaryId []byte +} + +func (input GetAlgorithmSuiteInfoInput) Validate() error { + + return nil +} + +type InitializeDecryptionMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + + EncryptionContext map[string]string + + RequiredEncryptionContextKeys []string +} + +func (input InitializeDecryptionMaterialsInput) Validate() error { + if input.AlgorithmSuiteId == nil { + return fmt.Errorf("input.AlgorithmSuiteId is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_Validate() + } + if input.RequiredEncryptionContextKeys == nil { + return fmt.Errorf("input.RequiredEncryptionContextKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input InitializeDecryptionMaterialsInput) aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_algorithmSuiteId_Validate() error { + if input.AlgorithmSuiteId == nil { + return nil + } + switch unionType := input.AlgorithmSuiteId.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input InitializeDecryptionMaterialsInput) aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input InitializeDecryptionMaterialsInput) aws_cryptography_materialProviders_InitializeDecryptionMaterialsInput_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type InitializeEncryptionMaterialsInput struct { + AlgorithmSuiteId AlgorithmSuiteId + + EncryptionContext map[string]string + + RequiredEncryptionContextKeys []string + + SigningKey []byte + + VerificationKey []byte +} + +func (input InitializeEncryptionMaterialsInput) Validate() error { + if input.AlgorithmSuiteId == nil { + return fmt.Errorf("input.AlgorithmSuiteId is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_Validate() + } + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_Validate() + } + if input.RequiredEncryptionContextKeys == nil { + return fmt.Errorf("input.RequiredEncryptionContextKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() + } + + return nil +} + +func (input InitializeEncryptionMaterialsInput) aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_algorithmSuiteId_Validate() error { + if input.AlgorithmSuiteId == nil { + return nil + } + switch unionType := input.AlgorithmSuiteId.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input InitializeEncryptionMaterialsInput) aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} +func (input InitializeEncryptionMaterialsInput) aws_cryptography_materialProviders_InitializeEncryptionMaterialsInput_requiredEncryptionContextKeys_Validate() error { + for _, item := range input.RequiredEncryptionContextKeys { + if !utf8.ValidString(item) { + return fmt.Errorf("Invalid UTF bytes %s ", item) + } + } + + return nil +} + +type OnDecryptInput struct { + EncryptedDataKeys []EncryptedDataKey + + Materials DecryptionMaterials +} + +func (input OnDecryptInput) Validate() error { + if input.EncryptedDataKeys == nil { + return fmt.Errorf("input.EncryptedDataKeys is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_Validate() != nil { + return input.aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_Validate() + } + if input.Materials.Validate() != nil { + return input.Materials.Validate() + } + + return nil +} + +func (input OnDecryptInput) aws_cryptography_materialProviders_OnDecryptInput_encryptedDataKeys_Validate() error { + for _, item := range input.EncryptedDataKeys { + if item.Validate() != nil { + return item.Validate() + } + } + + return nil +} + +type OnDecryptOutput struct { + Materials DecryptionMaterials +} + +func (input OnDecryptOutput) Validate() error { + if input.Materials.Validate() != nil { + return input.Materials.Validate() + } + + return nil +} + +type OnEncryptInput struct { + Materials EncryptionMaterials +} + +func (input OnEncryptInput) Validate() error { + if input.Materials.Validate() != nil { + return input.Materials.Validate() + } + + return nil +} + +type OnEncryptOutput struct { + Materials EncryptionMaterials +} + +func (input OnEncryptOutput) Validate() error { + if input.Materials.Validate() != nil { + return input.Materials.Validate() + } + + return nil +} + +type ValidateCommitmentPolicyOnDecryptInput struct { + Algorithm AlgorithmSuiteId + + CommitmentPolicy CommitmentPolicy +} + +func (input ValidateCommitmentPolicyOnDecryptInput) Validate() error { + if input.Algorithm == nil { + return fmt.Errorf("input.Algorithm is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_Validate() != nil { + return input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_Validate() + } + if input.CommitmentPolicy == nil { + return fmt.Errorf("input.CommitmentPolicy is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_Validate() != nil { + return input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_Validate() + } + + return nil +} + +func (input ValidateCommitmentPolicyOnDecryptInput) aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_algorithm_Validate() error { + if input.Algorithm == nil { + return nil + } + switch unionType := input.Algorithm.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input ValidateCommitmentPolicyOnDecryptInput) aws_cryptography_materialProviders_ValidateCommitmentPolicyOnDecryptInput_commitmentPolicy_Validate() error { + if input.CommitmentPolicy == nil { + return nil + } + switch unionType := input.CommitmentPolicy.(type) { + case *CommitmentPolicyMemberESDK: + case *CommitmentPolicyMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type ValidateCommitmentPolicyOnEncryptInput struct { + Algorithm AlgorithmSuiteId + + CommitmentPolicy CommitmentPolicy +} + +func (input ValidateCommitmentPolicyOnEncryptInput) Validate() error { + if input.Algorithm == nil { + return fmt.Errorf("input.Algorithm is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_Validate() != nil { + return input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_Validate() + } + if input.CommitmentPolicy == nil { + return fmt.Errorf("input.CommitmentPolicy is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_Validate() != nil { + return input.aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_Validate() + } + + return nil +} + +func (input ValidateCommitmentPolicyOnEncryptInput) aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_algorithm_Validate() error { + if input.Algorithm == nil { + return nil + } + switch unionType := input.Algorithm.(type) { + case *AlgorithmSuiteIdMemberESDK: + case *AlgorithmSuiteIdMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} +func (input ValidateCommitmentPolicyOnEncryptInput) aws_cryptography_materialProviders_ValidateCommitmentPolicyOnEncryptInput_commitmentPolicy_Validate() error { + if input.CommitmentPolicy == nil { + return nil + } + switch unionType := input.CommitmentPolicy.(type) { + case *CommitmentPolicyMemberESDK: + case *CommitmentPolicyMemberDBE: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type ValidDecryptionMaterialsTransitionInput struct { + Start DecryptionMaterials + + Stop DecryptionMaterials +} + +func (input ValidDecryptionMaterialsTransitionInput) Validate() error { + if input.Start.Validate() != nil { + return input.Start.Validate() + } + if input.Stop.Validate() != nil { + return input.Stop.Validate() + } + + return nil +} + +type ValidEncryptionMaterialsTransitionInput struct { + Start EncryptionMaterials + + Stop EncryptionMaterials +} + +func (input ValidEncryptionMaterialsTransitionInput) Validate() error { + if input.Start.Validate() != nil { + return input.Start.Validate() + } + if input.Stop.Validate() != nil { + return input.Stop.Validate() + } + + return nil +} + +type GetBranchKeyIdInput struct { + EncryptionContext map[string]string +} + +func (input GetBranchKeyIdInput) Validate() error { + if input.EncryptionContext == nil { + return fmt.Errorf("input.EncryptionContext is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_Validate() != nil { + return input.aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_Validate() + } + + return nil +} + +func (input GetBranchKeyIdInput) aws_cryptography_materialProviders_GetBranchKeyIdInput_encryptionContext_Validate() error { + for key, value := range input.EncryptionContext { + if !utf8.ValidString(key) { + return fmt.Errorf("Invalid UTF bytes %s ", key) + } + if !utf8.ValidString(value) { + return fmt.Errorf("Invalid UTF bytes %s ", value) + } + } + + return nil +} + +type GetBranchKeyIdOutput struct { + BranchKeyId string +} + +func (input GetBranchKeyIdOutput) Validate() error { + + return nil +} + +type DeleteCacheEntryInput struct { + Identifier []byte +} + +func (input DeleteCacheEntryInput) Validate() error { + + return nil +} + +type GetCacheEntryInput struct { + Identifier []byte + + BytesUsed *int64 +} + +func (input GetCacheEntryInput) Validate() error { + + return nil +} + +type GetCacheEntryOutput struct { + BytesUsed int32 + + CreationTime int64 + + ExpiryTime int64 + + Materials Materials + + MessagesUsed int32 +} + +func (input GetCacheEntryOutput) Validate() error { + if input.BytesUsed < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", input.BytesUsed) + } + if input.CreationTime < 0 { + return fmt.Errorf("PositiveLong has a minimum of 0 but has the value of %d.", input.CreationTime) + } + if input.ExpiryTime < 0 { + return fmt.Errorf("PositiveLong has a minimum of 0 but has the value of %d.", input.ExpiryTime) + } + if input.Materials == nil { + return fmt.Errorf("input.Materials is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_GetCacheEntryOutput_materials_Validate() != nil { + return input.aws_cryptography_materialProviders_GetCacheEntryOutput_materials_Validate() + } + if input.MessagesUsed < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", input.MessagesUsed) + } + + return nil +} + +func (input GetCacheEntryOutput) aws_cryptography_materialProviders_GetCacheEntryOutput_materials_Validate() error { + if input.Materials == nil { + return nil + } + switch unionType := input.Materials.(type) { + case *MaterialsMemberEncryption: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberDecryption: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberBranchKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberBeaconKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type PutCacheEntryInput struct { + CreationTime int64 + + ExpiryTime int64 + + Identifier []byte + + Materials Materials + + BytesUsed *int32 + + MessagesUsed *int32 +} + +func (input PutCacheEntryInput) Validate() error { + if input.CreationTime < 0 { + return fmt.Errorf("PositiveLong has a minimum of 0 but has the value of %d.", input.CreationTime) + } + if input.ExpiryTime < 0 { + return fmt.Errorf("PositiveLong has a minimum of 0 but has the value of %d.", input.ExpiryTime) + } + if input.Materials == nil { + return fmt.Errorf("input.Materials is required but has a nil value.") + } + if input.aws_cryptography_materialProviders_PutCacheEntryInput_materials_Validate() != nil { + return input.aws_cryptography_materialProviders_PutCacheEntryInput_materials_Validate() + } + if input.BytesUsed != nil { + if *input.BytesUsed < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", *input.BytesUsed) + } + } + if input.MessagesUsed != nil { + if *input.MessagesUsed < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", *input.MessagesUsed) + } + } + + return nil +} + +func (input PutCacheEntryInput) aws_cryptography_materialProviders_PutCacheEntryInput_materials_Validate() error { + if input.Materials == nil { + return nil + } + switch unionType := input.Materials.(type) { + case *MaterialsMemberEncryption: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberDecryption: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberBranchKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + case *MaterialsMemberBeaconKey: + if unionType.Value.Validate() != nil { + return unionType.Value.Validate() + } + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type UpdateUsageMetadataInput struct { + BytesUsed int32 + + Identifier []byte +} + +func (input UpdateUsageMetadataInput) Validate() error { + if input.BytesUsed < 0 { + return fmt.Errorf("PositiveInteger has a minimum of 0 but has the value of %d.", input.BytesUsed) + } + + return nil +} + +type DdbClientReference struct { +} + +func (input DdbClientReference) Validate() error { + + return nil +} + +type MaterialProvidersConfig struct { +} + +func (input MaterialProvidersConfig) Validate() error { + + return nil +} + +// AlgorithmSuiteIdMemberDBE +// AlgorithmSuiteIdMemberESDK +type AlgorithmSuiteId interface { + isAlgorithmSuiteId() +} + +type AlgorithmSuiteIdMemberDBE struct { + Value DBEAlgorithmSuiteId +} + +func (*AlgorithmSuiteIdMemberDBE) isAlgorithmSuiteId() {} + +type AlgorithmSuiteIdMemberESDK struct { + Value ESDKAlgorithmSuiteId +} + +func (*AlgorithmSuiteIdMemberESDK) isAlgorithmSuiteId() {} + +// CacheTypeMemberDefault +// CacheTypeMemberMultiThreaded +// CacheTypeMemberNo +// CacheTypeMemberShared +// CacheTypeMemberSingleThreaded +// CacheTypeMemberStormTracking +type CacheType interface { + isCacheType() +} + +type CacheTypeMemberDefault struct { + Value DefaultCache +} + +func (*CacheTypeMemberDefault) isCacheType() {} + +type CacheTypeMemberMultiThreaded struct { + Value MultiThreadedCache +} + +func (*CacheTypeMemberMultiThreaded) isCacheType() {} + +type CacheTypeMemberNo struct { + Value NoCache +} + +func (*CacheTypeMemberNo) isCacheType() {} + +type CacheTypeMemberShared struct { + Value ICryptographicMaterialsCache +} + +func (*CacheTypeMemberShared) isCacheType() {} + +type CacheTypeMemberSingleThreaded struct { + Value SingleThreadedCache +} + +func (*CacheTypeMemberSingleThreaded) isCacheType() {} + +type CacheTypeMemberStormTracking struct { + Value StormTrackingCache +} + +func (*CacheTypeMemberStormTracking) isCacheType() {} + +// CommitmentPolicyMemberDBE +// CommitmentPolicyMemberESDK +type CommitmentPolicy interface { + isCommitmentPolicy() +} + +type CommitmentPolicyMemberDBE struct { + Value DBECommitmentPolicy +} + +func (*CommitmentPolicyMemberDBE) isCommitmentPolicy() {} + +type CommitmentPolicyMemberESDK struct { + Value ESDKCommitmentPolicy +} + +func (*CommitmentPolicyMemberESDK) isCommitmentPolicy() {} + +// DerivationAlgorithmMemberHKDF +// DerivationAlgorithmMemberIDENTITY +// DerivationAlgorithmMemberNone +type DerivationAlgorithm interface { + isDerivationAlgorithm() +} + +type DerivationAlgorithmMemberHKDF struct { + Value HKDF +} + +func (*DerivationAlgorithmMemberHKDF) isDerivationAlgorithm() {} + +type DerivationAlgorithmMemberIDENTITY struct { + Value IDENTITY +} + +func (*DerivationAlgorithmMemberIDENTITY) isDerivationAlgorithm() {} + +type DerivationAlgorithmMemberNone struct { + Value None +} + +func (*DerivationAlgorithmMemberNone) isDerivationAlgorithm() {} + +// EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING +// EdkWrappingAlgorithmMemberIntermediateKeyWrapping +type EdkWrappingAlgorithm interface { + isEdkWrappingAlgorithm() +} + +type EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING struct { + Value DIRECT_KEY_WRAPPING +} + +func (*EdkWrappingAlgorithmMemberDIRECT_KEY_WRAPPING) isEdkWrappingAlgorithm() {} + +type EdkWrappingAlgorithmMemberIntermediateKeyWrapping struct { + Value IntermediateKeyWrapping +} + +func (*EdkWrappingAlgorithmMemberIntermediateKeyWrapping) isEdkWrappingAlgorithm() {} + +// EncryptMemberAES_GCM +type Encrypt interface { + isEncrypt() +} + +type EncryptMemberAES_GCM struct { + Value awscryptographyprimitivessmithygeneratedtypes.AES_GCM +} + +func (*EncryptMemberAES_GCM) isEncrypt() {} + +// KeyAgreementSchemeMemberStaticConfiguration +type KeyAgreementScheme interface { + isKeyAgreementScheme() +} + +type KeyAgreementSchemeMemberStaticConfiguration struct { + Value StaticConfigurations +} + +func (*KeyAgreementSchemeMemberStaticConfiguration) isKeyAgreementScheme() {} + +// KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey +// KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery +type KmsEcdhStaticConfigurations interface { + isKmsEcdhStaticConfigurations() +} + +type KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey struct { + Value KmsPrivateKeyToStaticPublicKeyInput +} + +func (*KmsEcdhStaticConfigurationsMemberKmsPrivateKeyToStaticPublicKey) isKmsEcdhStaticConfigurations() { +} + +type KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery struct { + Value KmsPublicKeyDiscoveryInput +} + +func (*KmsEcdhStaticConfigurationsMemberKmsPublicKeyDiscovery) isKmsEcdhStaticConfigurations() {} + +// MaterialsMemberBeaconKey +// MaterialsMemberBranchKey +// MaterialsMemberDecryption +// MaterialsMemberEncryption +type Materials interface { + isMaterials() +} + +type MaterialsMemberBeaconKey struct { + Value awscryptographykeystoresmithygeneratedtypes.BeaconKeyMaterials +} + +func (*MaterialsMemberBeaconKey) isMaterials() {} + +type MaterialsMemberBranchKey struct { + Value awscryptographykeystoresmithygeneratedtypes.BranchKeyMaterials +} + +func (*MaterialsMemberBranchKey) isMaterials() {} + +type MaterialsMemberDecryption struct { + Value DecryptionMaterials +} + +func (*MaterialsMemberDecryption) isMaterials() {} + +type MaterialsMemberEncryption struct { + Value EncryptionMaterials +} + +func (*MaterialsMemberEncryption) isMaterials() {} + +// RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey +// RawEcdhStaticConfigurationsMemberPublicKeyDiscovery +// RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey +type RawEcdhStaticConfigurations interface { + isRawEcdhStaticConfigurations() +} + +type RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey struct { + Value EphemeralPrivateKeyToStaticPublicKeyInput +} + +func (*RawEcdhStaticConfigurationsMemberEphemeralPrivateKeyToStaticPublicKey) isRawEcdhStaticConfigurations() { +} + +type RawEcdhStaticConfigurationsMemberPublicKeyDiscovery struct { + Value PublicKeyDiscoveryInput +} + +func (*RawEcdhStaticConfigurationsMemberPublicKeyDiscovery) isRawEcdhStaticConfigurations() {} + +type RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey struct { + Value RawPrivateKeyToStaticPublicKeyInput +} + +func (*RawEcdhStaticConfigurationsMemberRawPrivateKeyToStaticPublicKey) isRawEcdhStaticConfigurations() { +} + +// SignatureAlgorithmMemberECDSA +// SignatureAlgorithmMemberNone +type SignatureAlgorithm interface { + isSignatureAlgorithm() +} + +type SignatureAlgorithmMemberECDSA struct { + Value ECDSA +} + +func (*SignatureAlgorithmMemberECDSA) isSignatureAlgorithm() {} + +type SignatureAlgorithmMemberNone struct { + Value None +} + +func (*SignatureAlgorithmMemberNone) isSignatureAlgorithm() {} + +// StaticConfigurationsMemberAWS_KMS_ECDH +// StaticConfigurationsMemberRAW_ECDH +type StaticConfigurations interface { + isStaticConfigurations() +} + +type StaticConfigurationsMemberAWS_KMS_ECDH struct { + Value KmsEcdhStaticConfigurations +} + +func (*StaticConfigurationsMemberAWS_KMS_ECDH) isStaticConfigurations() {} + +type StaticConfigurationsMemberRAW_ECDH struct { + Value RawEcdhStaticConfigurations +} + +func (*StaticConfigurationsMemberRAW_ECDH) isStaticConfigurations() {} + +// SymmetricSignatureAlgorithmMemberHMAC +// SymmetricSignatureAlgorithmMemberNone +type SymmetricSignatureAlgorithm interface { + isSymmetricSignatureAlgorithm() +} + +type SymmetricSignatureAlgorithmMemberHMAC struct { + Value awscryptographyprimitivessmithygeneratedtypes.DigestAlgorithm +} + +func (*SymmetricSignatureAlgorithmMemberHMAC) isSymmetricSignatureAlgorithm() {} + +type SymmetricSignatureAlgorithmMemberNone struct { + Value None +} + +func (*SymmetricSignatureAlgorithmMemberNone) isSymmetricSignatureAlgorithm() {} + +type AwsCryptographicMaterialProvidersBaseException interface { + // This is a dummy method to allow type assertion since Go empty interfaces + // aren't useful for type assertion checks. No concrete class is expected to implement + // this method. This is also not exported. + interfaceBindingMethod() +} + +type IBranchKeyIdSupplier interface { + GetBranchKeyId(GetBranchKeyIdInput) (*GetBranchKeyIdOutput, error) +} + +type IClientSupplier interface { + GetClient(GetClientInput) (kms.Client, error) +} + +type ICryptographicMaterialsCache interface { + PutCacheEntry(PutCacheEntryInput) error + + GetCacheEntry(GetCacheEntryInput) (*GetCacheEntryOutput, error) + + UpdateUsageMetadata(UpdateUsageMetadataInput) error + + DeleteCacheEntry(DeleteCacheEntryInput) error +} + +type ICryptographicMaterialsManager interface { + GetEncryptionMaterials(GetEncryptionMaterialsInput) (*GetEncryptionMaterialsOutput, error) + + DecryptMaterials(DecryptMaterialsInput) (*DecryptMaterialsOutput, error) +} + +type IKeyring interface { + OnEncrypt(OnEncryptInput) (*OnEncryptOutput, error) + + OnDecrypt(OnDecryptInput) (*OnDecryptOutput, error) +} diff --git a/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/unmodelled_errors.go b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/unmodelled_errors.go new file mode 100644 index 000000000..392337831 --- /dev/null +++ b/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes/unmodelled_errors.go @@ -0,0 +1,26 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awscryptographymaterialproviderssmithygeneratedtypes + +import ( + "fmt" +) + +type CollectionOfErrors struct { + AwsCryptographicMaterialProvidersBaseException + ListOfErrors []error + Message string +} + +func (e CollectionOfErrors) Error() string { + return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) +} + +type OpaqueError struct { + AwsCryptographicMaterialProvidersBaseException + ErrObject interface{} +} + +func (e OpaqueError) Error() string { + return fmt.Sprintf("message: %v", e.ErrObject) +} diff --git a/releases/go/mpl/go.mod b/releases/go/mpl/go.mod new file mode 100644 index 000000000..32d4b5930 --- /dev/null +++ b/releases/go/mpl/go.mod @@ -0,0 +1,34 @@ +module github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl + +go 1.23.0 + +require github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1 + +require ( + github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb v0.0.3 + github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.1 + github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives v0.0.1 + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.39.2 + github.com/aws/aws-sdk-go-v2/service/kms v1.36.0 + github.com/aws/smithy-go v1.22.1 + github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2 + +) + +require ( + github.com/aws/aws-sdk-go-v2 v1.32.8 // indirect + github.com/aws/aws-sdk-go-v2/config v1.28.10 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.51 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.8 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.9 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.6 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect +) diff --git a/releases/go/mpl/go.sum b/releases/go/mpl/go.sum new file mode 100644 index 000000000..8d27f4762 --- /dev/null +++ b/releases/go/mpl/go.sum @@ -0,0 +1,56 @@ +github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb v0.0.3 h1:JY/4eTs5ObPqZFk6dDNvoCkomUvKtYGBtFp5rvfIV20= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb v0.0.3/go.mod h1:8mHZUqK00Oga2z7H6Kp8LZGkEBKSWUUT/nkeoIR8GiM= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.1 h1:jvMM4fgVZ116L8VPfdEa3GxJiU7ic/krHCAIyeIcPJY= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms v0.0.1/go.mod h1:6QCmXRQJNf1XId129cnFqpWK9DHamyyqmC7GKxHmcEE= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives v0.0.1 h1:Iy8Va/0Aa43JQkzGKlTjOvBlecTyZCIOg1JqRRyWH9g= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives v0.0.1/go.mod h1:aPCFt/cDDuUlg6aWLSTPW6ZPqivNt3pNzDWCsBFRQtE= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1 h1:GMsJ9YTY+JcaZDlaTDOtiqrOXvR909fjXQtv9ed8Ip4= +github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.1/go.mod h1:m3mzHKiNiSC0LWeWX6ZAxSe6mKbJHgliux1Yu/sjCYI= +github.com/aws/aws-sdk-go-v2 v1.32.8 h1:cZV+NUS/eGxKXMtmyhtYPJ7Z4YLoI/V8bkTdRZfYhGo= +github.com/aws/aws-sdk-go-v2 v1.32.8/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U= +github.com/aws/aws-sdk-go-v2/config v1.28.10 h1:fKODZHfqQu06pCzR69KJ3GuttraRJkhlC8g80RZ0Dfg= +github.com/aws/aws-sdk-go-v2/config v1.28.10/go.mod h1:PvdxRYZ5Um9QMq9PQ0zHHNdtKK+he2NHtFCUFMXWXeg= +github.com/aws/aws-sdk-go-v2/credentials v1.17.51 h1:F/9Sm6Y6k4LqDesZDPJCLxQGXNNHd/ZtJiWd0lCZKRk= +github.com/aws/aws-sdk-go-v2/credentials v1.17.51/go.mod h1:TKbzCHm43AoPyA+iLGGcruXd4AFhF8tOmLex2R9jWNQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.23 h1:IBAoD/1d8A8/1aA8g4MBVtTRHhXRiNAgwdbo/xRM2DI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.23/go.mod h1:vfENuCM7dofkgKpYzuzf1VT1UKkA/YL3qanfBn7HCaA= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 h1:jSJjSBzw8VDIbWv+mmvBSP8ezsztMYJGH+eKqi9AmNs= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27/go.mod h1:/DAhLbFRgwhmvJdOfSm+WwikZrCuUJiA4WgJG0fTNSw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 h1:l+X4K77Dui85pIj5foXDhPlnqcNRG2QUyvca300lXh8= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27/go.mod h1:KvZXSFEXm6x84yE8qffKvT3x8J5clWnVFXphpohhzJ8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.39.2 h1:XcdIh35yg1J8bAiUOLtL/PoPMSGsD72Zanwmim8jEXc= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.39.2/go.mod h1:516U/KQM3zdcahNBjHUZKGWNfNnIYyt7sxLeqOx78b0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.8 h1:h56mLNgpqWIL7RZOIQO634Xr569bXGTlIE83t/a0LSE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.8/go.mod h1:kK04550Xx95KI0sNmwoB7ciS9QkRwt9TojhoTMXyJdo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 h1:cWno7lefSH6Pp+mSznagKCgfDGeZRin66UvYUqAkyeA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8/go.mod h1:tPD+VjU3ABTBoEJ3nctu5Nyg4P4yjqSH5bJGGkY4+XE= +github.com/aws/aws-sdk-go-v2/service/kms v1.36.0 h1:jwWMpQ/1obJRdHaix9k10zWSnSMZGdDTZIDiS5CGzq8= +github.com/aws/aws-sdk-go-v2/service/kms v1.36.0/go.mod h1:OHmlX4+o0XIlJAQGAHPIy0N9yZcYS/vNG+T7geSNcFw= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.9 h1:YqtxripbjWb2QLyzRK9pByfEDvgg95gpC2AyDq4hFE8= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.9/go.mod h1:lV8iQpg6OLOfBnqbGMBKYjilBlf633qwHnBEiMSPoHY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8 h1:6dBT1Lz8fK11m22R+AqfRsFn8320K0T5DTGxxOQBSMw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8/go.mod h1:/kiBvRQXBc6xeJTYzhSdGvJ5vm1tjaDEjH+MSeRJnlY= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.6 h1:VwhTrsTuVn52an4mXx29PqRzs2Dvu921NpGk7y43tAM= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.6/go.mod h1:+8h7PZb3yY5ftmVLD7ocEoE98hdc8PoKS0H3wfx1dlc= +github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro= +github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= +github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2 h1:g/xAj4F7Zt9wXJ6QjfbfocVi/ZYlAFpNddHCFyfzRDg= +github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=