github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl@v0.2.0/RawAESKeyring/RawAESKeyring.go (about)

     1  // Package RawAESKeyring
     2  // Dafny module RawAESKeyring compiled into Go
     3  
     4  package RawAESKeyring
     5  
     6  import (
     7  	os "os"
     8  
     9  	m_ComAmazonawsDynamodbTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/ComAmazonawsDynamodbTypes"
    10  	m_Com_Amazonaws_Dynamodb "github.com/aws/aws-cryptographic-material-providers-library/releases/go/dynamodb/Com_Amazonaws_Dynamodb"
    11  	m_ComAmazonawsKmsTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/ComAmazonawsKmsTypes"
    12  	m_Com_Amazonaws_Kms "github.com/aws/aws-cryptographic-material-providers-library/releases/go/kms/Com_Amazonaws_Kms"
    13  	m_AlgorithmSuites "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AlgorithmSuites"
    14  	m_AwsArnParsing "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsArnParsing"
    15  	m_AwsCryptographyKeyStoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreOperations"
    16  	m_AwsCryptographyKeyStoreTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyKeyStoreTypes"
    17  	m_AwsCryptographyMaterialProvidersTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsCryptographyMaterialProvidersTypes"
    18  	m_AwsKmsDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsDiscoveryKeyring"
    19  	m_AwsKmsEcdhKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsEcdhKeyring"
    20  	m_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring"
    21  	m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring"
    22  	m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique"
    23  	m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring"
    24  	m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring"
    25  	m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt"
    26  	m_AwsKmsRsaKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsRsaKeyring"
    27  	m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils"
    28  	m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants"
    29  	m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext"
    30  	m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants"
    31  	m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable"
    32  	m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys"
    33  	m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations"
    34  	m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring"
    35  	m_EcdhEdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EcdhEdkWrapping"
    36  	m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping"
    37  	m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages"
    38  	m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys"
    39  	m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping"
    40  	m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations"
    41  	m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore"
    42  	m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages"
    43  	m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring"
    44  	m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn"
    45  	m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC"
    46  	m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping"
    47  	m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials"
    48  	m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring"
    49  	m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring"
    50  	m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring"
    51  	m_RawECDHKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/RawECDHKeyring"
    52  	m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker"
    53  	m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC"
    54  	m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring"
    55  	m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure"
    56  	m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC"
    57  	m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives"
    58  	m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations"
    59  	m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes"
    60  	m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest"
    61  	m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF"
    62  	m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr"
    63  	m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random"
    64  	m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF"
    65  	m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC"
    66  	m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions"
    67  	m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64"
    68  	m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas"
    69  	m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts"
    70  	m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals"
    71  	m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear"
    72  	m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod"
    73  	m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO"
    74  	m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare"
    75  	m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions"
    76  	m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals"
    77  	m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt"
    78  	m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings"
    79  	m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm"
    80  	m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_"
    81  	m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals"
    82  	m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear"
    83  	m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul"
    84  	m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals"
    85  	m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear"
    86  	m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power"
    87  	m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations"
    88  	m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq"
    89  	m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort"
    90  	m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting"
    91  	m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary"
    92  	m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop"
    93  	m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence"
    94  	m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String"
    95  	m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt"
    96  	m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams"
    97  	m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8"
    98  	m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings"
    99  	m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_"
   100  	m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm"
   101  	m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm"
   102  	m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers"
   103  	m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_"
   104  	_dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny"
   105  )
   106  
   107  var _ = os.Args
   108  var _ _dafny.Dummy__
   109  var _ m__System.Dummy__
   110  var _ m_Wrappers.Dummy__
   111  var _ m_BoundedInts.Dummy__
   112  var _ m_StandardLibrary_UInt.Dummy__
   113  var _ m_StandardLibrary_Sequence.Dummy__
   114  var _ m_StandardLibrary_String.Dummy__
   115  var _ m_StandardLibrary.Dummy__
   116  var _ m_AwsCryptographyPrimitivesTypes.Dummy__
   117  var _ m_Random.Dummy__
   118  var _ m_Digest.Dummy__
   119  var _ m_WrappedHMAC.Dummy__
   120  var _ m_HKDF.Dummy__
   121  var _ m_WrappedHKDF.Dummy__
   122  var _ m_KdfCtr.Dummy__
   123  var _ m_AwsCryptographyPrimitivesOperations.Dummy__
   124  var _ m_AtomicPrimitives.Dummy__
   125  var _ m_ComAmazonawsDynamodbTypes.Dummy__
   126  var _ m_ComAmazonawsKmsTypes.Dummy__
   127  var _ m_Relations.Dummy__
   128  var _ m_Seq_MergeSort.Dummy__
   129  var _ m__Math.Dummy__
   130  var _ m_Seq.Dummy__
   131  var _ m__Unicode.Dummy__
   132  var _ m_Functions.Dummy__
   133  var _ m_Utf8EncodingForm.Dummy__
   134  var _ m_Utf16EncodingForm.Dummy__
   135  var _ m_UnicodeStrings.Dummy__
   136  var _ m_FileIO.Dummy__
   137  var _ m_GeneralInternals.Dummy__
   138  var _ m_MulInternalsNonlinear.Dummy__
   139  var _ m_MulInternals.Dummy__
   140  var _ m_Mul.Dummy__
   141  var _ m_ModInternalsNonlinear.Dummy__
   142  var _ m_DivInternalsNonlinear.Dummy__
   143  var _ m_ModInternals.Dummy__
   144  var _ m_DivInternals.Dummy__
   145  var _ m_DivMod.Dummy__
   146  var _ m_Power.Dummy__
   147  var _ m_Logarithm.Dummy__
   148  var _ m_StandardLibraryInterop.Dummy__
   149  var _ m_Streams.Dummy__
   150  var _ m_Sorting.Dummy__
   151  var _ m_HexStrings.Dummy__
   152  var _ m_GetOpt.Dummy__
   153  var _ m_FloatCompare.Dummy__
   154  var _ m_Base64.Dummy__
   155  var _ m_Base64Lemmas.Dummy__
   156  var _ m_Actions.Dummy__
   157  var _ m_AwsCryptographyKeyStoreTypes.Dummy__
   158  var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__
   159  var _ m_AwsArnParsing.Dummy__
   160  var _ m_AwsKmsMrkMatchForDecrypt.Dummy__
   161  var _ m_AwsKmsUtils.Dummy__
   162  var _ m_KeyStoreErrorMessages.Dummy__
   163  var _ m_KmsArn.Dummy__
   164  var _ m_Structure.Dummy__
   165  var _ m_KMSKeystoreOperations.Dummy__
   166  var _ m_DDBKeystoreOperations.Dummy__
   167  var _ m_CreateKeys.Dummy__
   168  var _ m_CreateKeyStoreTable.Dummy__
   169  var _ m_GetKeys.Dummy__
   170  var _ m_AwsCryptographyKeyStoreOperations.Dummy__
   171  var _ m_Com_Amazonaws_Kms.Dummy__
   172  var _ m_Com_Amazonaws_Dynamodb.Dummy__
   173  var _ m_KeyStore.Dummy__
   174  var _ m_AlgorithmSuites.Dummy__
   175  var _ m_Materials.Dummy__
   176  var _ m_Keyring.Dummy__
   177  var _ m_MultiKeyring.Dummy__
   178  var _ m_AwsKmsMrkAreUnique.Dummy__
   179  var _ m_Constants.Dummy__
   180  var _ m_MaterialWrapping.Dummy__
   181  var _ m_CanonicalEncryptionContext.Dummy__
   182  var _ m_IntermediateKeyWrapping.Dummy__
   183  var _ m_EdkWrapping.Dummy__
   184  var _ m_ErrorMessages.Dummy__
   185  var _ m_AwsKmsKeyring.Dummy__
   186  var _ m_StrictMultiKeyring.Dummy__
   187  var _ m_AwsKmsDiscoveryKeyring.Dummy__
   188  var _ m_DiscoveryMultiKeyring.Dummy__
   189  var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__
   190  var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__
   191  var _ m_AwsKmsMrkKeyring.Dummy__
   192  var _ m_MrkAwareStrictMultiKeyring.Dummy__
   193  var _ m_LocalCMC.Dummy__
   194  var _ m_SynchronizedLocalCMC.Dummy__
   195  var _ m_StormTracker.Dummy__
   196  var _ m_StormTrackingCMC.Dummy__
   197  var _ m_CacheConstants.Dummy__
   198  var _ m_AwsKmsHierarchicalKeyring.Dummy__
   199  var _ m_AwsKmsRsaKeyring.Dummy__
   200  var _ m_EcdhEdkWrapping.Dummy__
   201  var _ m_RawECDHKeyring.Dummy__
   202  var _ m_AwsKmsEcdhKeyring.Dummy__
   203  
   204  type Dummy__ struct{}
   205  
   206  // Definition of class Default__
   207  type Default__ struct {
   208  	dummy byte
   209  }
   210  
   211  func New_Default___() *Default__ {
   212  	_this := Default__{}
   213  
   214  	return &_this
   215  }
   216  
   217  type CompanionStruct_Default___ struct {
   218  }
   219  
   220  var Companion_Default___ = CompanionStruct_Default___{}
   221  
   222  func (_this *Default__) Equals(other *Default__) bool {
   223  	return _this == other
   224  }
   225  
   226  func (_this *Default__) EqualsGeneric(x interface{}) bool {
   227  	other, ok := x.(*Default__)
   228  	return ok && _this.Equals(other)
   229  }
   230  
   231  func (*Default__) String() string {
   232  	return "RawAESKeyring.Default__"
   233  }
   234  func (_this *Default__) ParentTraits_() []*_dafny.TraitID {
   235  	return [](*_dafny.TraitID){}
   236  }
   237  
   238  var _ _dafny.TraitOffspring = &Default__{}
   239  
   240  func (_static *CompanionStruct_Default___) DeserializeEDKCiphertext(ciphertext _dafny.Sequence, tagLen _dafny.Int) m_AwsCryptographyPrimitivesTypes.AESEncryptOutput {
   241  	var _0_encryptedKeyLength _dafny.Int = (_dafny.IntOfUint32((ciphertext).Cardinality())).Minus(tagLen)
   242  	_ = _0_encryptedKeyLength
   243  	return m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Create_AESEncryptOutput_((ciphertext).Take((_0_encryptedKeyLength).Uint32()), (ciphertext).Drop((_0_encryptedKeyLength).Uint32()))
   244  }
   245  func (_static *CompanionStruct_Default___) SerializeEDKCiphertext(encOutput m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) _dafny.Sequence {
   246  	return _dafny.Companion_Sequence_.Concatenate((encOutput).Dtor_cipherText(), (encOutput).Dtor_authTag())
   247  }
   248  func (_static *CompanionStruct_Default___) AUTH__TAG__LEN__LEN() _dafny.Int {
   249  	return _dafny.IntOfInt64(4)
   250  }
   251  func (_static *CompanionStruct_Default___) IV__LEN__LEN() _dafny.Int {
   252  	return _dafny.IntOfInt64(4)
   253  }
   254  
   255  // End of class Default__
   256  
   257  // Definition of class RawAESKeyring
   258  type RawAESKeyring struct {
   259  	_cryptoPrimitives  *m_AtomicPrimitives.AtomicPrimitivesClient
   260  	_wrappingKey       _dafny.Sequence
   261  	_wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM
   262  	_keyNamespace      _dafny.Sequence
   263  	_keyName           _dafny.Sequence
   264  }
   265  
   266  func New_RawAESKeyring_() *RawAESKeyring {
   267  	_this := RawAESKeyring{}
   268  
   269  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
   270  	_this._wrappingKey = _dafny.EmptySeq
   271  	_this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{}
   272  	_this._keyNamespace = m_UTF8.Companion_ValidUTF8Bytes_.Witness()
   273  	_this._keyName = m_UTF8.Companion_ValidUTF8Bytes_.Witness()
   274  	return &_this
   275  }
   276  
   277  type CompanionStruct_RawAESKeyring_ struct {
   278  }
   279  
   280  var Companion_RawAESKeyring_ = CompanionStruct_RawAESKeyring_{}
   281  
   282  func (_this *RawAESKeyring) Equals(other *RawAESKeyring) bool {
   283  	return _this == other
   284  }
   285  
   286  func (_this *RawAESKeyring) EqualsGeneric(x interface{}) bool {
   287  	other, ok := x.(*RawAESKeyring)
   288  	return ok && _this.Equals(other)
   289  }
   290  
   291  func (*RawAESKeyring) String() string {
   292  	return "RawAESKeyring.RawAESKeyring"
   293  }
   294  
   295  func Type_RawAESKeyring_() _dafny.TypeDescriptor {
   296  	return type_RawAESKeyring_{}
   297  }
   298  
   299  type type_RawAESKeyring_ struct {
   300  }
   301  
   302  func (_this type_RawAESKeyring_) Default() interface{} {
   303  	return (*RawAESKeyring)(nil)
   304  }
   305  
   306  func (_this type_RawAESKeyring_) String() string {
   307  	return "RawAESKeyring.RawAESKeyring"
   308  }
   309  func (_this *RawAESKeyring) ParentTraits_() []*_dafny.TraitID {
   310  	return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_}
   311  }
   312  
   313  var _ m_Keyring.VerifiableInterface = &RawAESKeyring{}
   314  var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &RawAESKeyring{}
   315  var _ _dafny.TraitOffspring = &RawAESKeyring{}
   316  
   317  func (_this *RawAESKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result {
   318  	var _out10 m_Wrappers.Result
   319  	_ = _out10
   320  	_out10 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input)
   321  	return _out10
   322  }
   323  func (_this *RawAESKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result {
   324  	var _out10 m_Wrappers.Result
   325  	_ = _out10
   326  	_out10 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input)
   327  	return _out10
   328  }
   329  func (_this *RawAESKeyring) Ctor__(namespace _dafny.Sequence, name _dafny.Sequence, key _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) {
   330  	{
   331  		(_this)._keyNamespace = namespace
   332  		(_this)._keyName = name
   333  		(_this)._wrappingKey = key
   334  		(_this)._wrappingAlgorithm = wrappingAlgorithm
   335  		(_this)._cryptoPrimitives = cryptoPrimitives
   336  	}
   337  }
   338  func (_this *RawAESKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result {
   339  	{
   340  		var output m_Wrappers.Result = m_Wrappers.Result{}
   341  		_ = output
   342  		var _0_materials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials
   343  		_ = _0_materials
   344  		_0_materials = (input).Dtor_materials()
   345  		var _1_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo
   346  		_ = _1_suite
   347  		_1_suite = (_0_materials).Dtor_algorithmSuite()
   348  		var _2_wrap *AesWrapKeyMaterial
   349  		_ = _2_wrap
   350  		var _nw0 *AesWrapKeyMaterial = New_AesWrapKeyMaterial_()
   351  		_ = _nw0
   352  		_nw0.Ctor__((_this).WrappingKey(), (_this).WrappingAlgorithm(), (_this).CryptoPrimitives())
   353  		_2_wrap = _nw0
   354  		var _3_generateAndWrap *AesGenerateAndWrapKeyMaterial
   355  		_ = _3_generateAndWrap
   356  		var _nw1 *AesGenerateAndWrapKeyMaterial = New_AesGenerateAndWrapKeyMaterial_()
   357  		_ = _nw1
   358  		_nw1.Ctor__(_2_wrap)
   359  		_3_generateAndWrap = _nw1
   360  		var _4_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_AesWrapInfo_.Default()))
   361  		_ = _4_valueOrError0
   362  		var _out0 m_Wrappers.Result
   363  		_ = _out0
   364  		_out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial(_0_materials, _2_wrap, _3_generateAndWrap)
   365  		_4_valueOrError0 = _out0
   366  		if (_4_valueOrError0).IsFailure() {
   367  			output = (_4_valueOrError0).PropagateFailure()
   368  			return output
   369  		}
   370  		var _5_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput
   371  		_ = _5_wrapOutput
   372  		_5_wrapOutput = (_4_valueOrError0).Extract().(m_EdkWrapping.WrapEdkMaterialOutput)
   373  		var _6_symmetricSigningKeyList m_Wrappers.Option
   374  		_ = _6_symmetricSigningKeyList
   375  		if ((_5_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() {
   376  			_6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_5_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence)))
   377  		} else {
   378  			_6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_()
   379  		}
   380  		var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey
   381  		_ = _7_edk
   382  		_7_edk = m_AwsCryptographyMaterialProvidersTypes.Companion_EncryptedDataKey_.Create_EncryptedDataKey_((_this).KeyNamespace(), (_this).SerializeProviderInfo(((_5_wrapOutput).Dtor_wrapInfo().(AesWrapInfo)).Dtor_iv()), (_5_wrapOutput).Dtor_wrappedMaterial())
   383  		if (_5_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() {
   384  			var _8_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{}
   385  			_ = _8_valueOrError1
   386  			_8_valueOrError1 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey(_0_materials, (_5_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList)
   387  			if (_8_valueOrError1).IsFailure() {
   388  				output = (_8_valueOrError1).PropagateFailure()
   389  				return output
   390  			}
   391  			var _9_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials
   392  			_ = _9_result
   393  			_9_result = (_8_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)
   394  			output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_9_result))
   395  			return output
   396  		} else if (_5_wrapOutput).Is_WrapOnlyEdkMaterialOutput() {
   397  			var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{}
   398  			_ = _10_valueOrError2
   399  			_10_valueOrError2 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys(_0_materials, _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList)
   400  			if (_10_valueOrError2).IsFailure() {
   401  				output = (_10_valueOrError2).PropagateFailure()
   402  				return output
   403  			}
   404  			var _11_result m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials
   405  			_ = _11_result
   406  			_11_result = (_10_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)
   407  			output = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_11_result))
   408  			return output
   409  		}
   410  		return output
   411  	}
   412  }
   413  func (_this *RawAESKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result {
   414  	{
   415  		var output m_Wrappers.Result = m_Wrappers.Result{}
   416  		_ = output
   417  		var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   418  		_ = _0_materials
   419  		_0_materials = (input).Dtor_materials()
   420  		var _1_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   421  		_ = _1_valueOrError0
   422  		_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.")))
   423  		if (_1_valueOrError0).IsFailure() {
   424  			output = (_1_valueOrError0).PropagateFailure()
   425  			return output
   426  		}
   427  		var _2_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   428  		_ = _2_valueOrError1
   429  		_2_valueOrError1 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(((input).Dtor_materials()).Dtor_encryptionContext())
   430  		if (_2_valueOrError1).IsFailure() {
   431  			output = (_2_valueOrError1).PropagateFailure()
   432  			return output
   433  		}
   434  		var _3_aad _dafny.Sequence
   435  		_ = _3_aad
   436  		_3_aad = (_2_valueOrError1).Extract().(_dafny.Sequence)
   437  		var _4_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   438  		_ = _4_valueOrError2
   439  		_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")))
   440  		if (_4_valueOrError2).IsFailure() {
   441  			output = (_4_valueOrError2).PropagateFailure()
   442  			return output
   443  		}
   444  		var _5_errors _dafny.Sequence
   445  		_ = _5_errors
   446  		_5_errors = _dafny.SeqOf()
   447  		var _hi0 _dafny.Int = _dafny.IntOfUint32(((input).Dtor_encryptedDataKeys()).Cardinality())
   448  		_ = _hi0
   449  		for _6_i := _dafny.Zero; _6_i.Cmp(_hi0) < 0; _6_i = _6_i.Plus(_dafny.One) {
   450  			if (_this).ShouldDecryptEDK(((input).Dtor_encryptedDataKeys()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)) {
   451  				var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey
   452  				_ = _7_edk
   453  				_7_edk = ((input).Dtor_encryptedDataKeys()).Select((_6_i).Uint32()).(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)
   454  				var _8_iv _dafny.Sequence
   455  				_ = _8_iv
   456  				_8_iv = (_this).GetIvFromProvInfo((_7_edk).Dtor_keyProviderInfo())
   457  				var _9_unwrap *AesUnwrapKeyMaterial
   458  				_ = _9_unwrap
   459  				var _nw0 *AesUnwrapKeyMaterial = New_AesUnwrapKeyMaterial_()
   460  				_ = _nw0
   461  				_nw0.Ctor__((_this).WrappingKey(), (_this).WrappingAlgorithm(), _8_iv, (_this).CryptoPrimitives())
   462  				_9_unwrap = _nw0
   463  				var _10_unwrapOutput m_Wrappers.Result
   464  				_ = _10_unwrapOutput
   465  				var _out0 m_Wrappers.Result
   466  				_ = _out0
   467  				_out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((_7_edk).Dtor_ciphertext(), _0_materials, _9_unwrap)
   468  				_10_unwrapOutput = _out0
   469  				if (_10_unwrapOutput).Is_Success() {
   470  					var _11_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{}
   471  					_ = _11_valueOrError3
   472  					_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())
   473  					if (_11_valueOrError3).IsFailure() {
   474  						output = (_11_valueOrError3).PropagateFailure()
   475  						return output
   476  					}
   477  					var _12_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   478  					_ = _12_result
   479  					_12_result = (_11_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)
   480  					var _13_value m_AwsCryptographyMaterialProvidersTypes.OnDecryptOutput
   481  					_ = _13_value
   482  					_13_value = m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_12_result)
   483  					output = m_Wrappers.Companion_Result_.Create_Success_(_13_value)
   484  					return output
   485  				} else {
   486  					_5_errors = _dafny.Companion_Sequence_.Concatenate(_5_errors, _dafny.SeqOf((_10_unwrapOutput).Dtor_error().(m_AwsCryptographyMaterialProvidersTypes.Error)))
   487  				}
   488  			} else {
   489  				var _14_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString())
   490  				_ = _14_valueOrError4
   491  				_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{} {
   492  					return func(arg121 interface{}) interface{} {
   493  						return coer120(arg121.(_dafny.Sequence))
   494  					}
   495  				}(func(_15_e _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error {
   496  					return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_15_e)
   497  				}))
   498  				if (_14_valueOrError4).IsFailure() {
   499  					output = (_14_valueOrError4).PropagateFailure()
   500  					return output
   501  				}
   502  				var _16_extractedKeyProviderId _dafny.Sequence
   503  				_ = _16_extractedKeyProviderId
   504  				_16_extractedKeyProviderId = (_14_valueOrError4).Extract().(_dafny.Sequence)
   505  				_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))))
   506  			}
   507  		}
   508  		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`.")))
   509  		return output
   510  		return output
   511  	}
   512  }
   513  func (_this *RawAESKeyring) SerializeProviderInfo(iv _dafny.Sequence) _dafny.Sequence {
   514  	{
   515  		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)
   516  	}
   517  }
   518  func (_this *RawAESKeyring) ShouldDecryptEDK(edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) bool {
   519  	{
   520  		return (_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), (_this).KeyNamespace())) && ((_this).ValidProviderInfo((edk).Dtor_keyProviderInfo()))
   521  	}
   522  }
   523  func (_this *RawAESKeyring) ValidProviderInfo(info _dafny.Sequence) bool {
   524  	{
   525  		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)))
   526  	}
   527  }
   528  func (_this *RawAESKeyring) GetIvFromProvInfo(info _dafny.Sequence) _dafny.Sequence {
   529  	{
   530  		return (info).Drop((((_dafny.IntOfUint32(((_this).KeyName()).Cardinality())).Plus(Companion_Default___.AUTH__TAG__LEN__LEN())).Plus(Companion_Default___.IV__LEN__LEN())).Uint32())
   531  	}
   532  }
   533  func (_this *RawAESKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
   534  	{
   535  		return _this._cryptoPrimitives
   536  	}
   537  }
   538  func (_this *RawAESKeyring) WrappingKey() _dafny.Sequence {
   539  	{
   540  		return _this._wrappingKey
   541  	}
   542  }
   543  func (_this *RawAESKeyring) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM {
   544  	{
   545  		return _this._wrappingAlgorithm
   546  	}
   547  }
   548  func (_this *RawAESKeyring) KeyNamespace() _dafny.Sequence {
   549  	{
   550  		return _this._keyNamespace
   551  	}
   552  }
   553  func (_this *RawAESKeyring) KeyName() _dafny.Sequence {
   554  	{
   555  		return _this._keyName
   556  	}
   557  }
   558  
   559  // End of class RawAESKeyring
   560  
   561  // Definition of datatype AesUnwrapInfo
   562  type AesUnwrapInfo struct {
   563  	Data_AesUnwrapInfo_
   564  }
   565  
   566  func (_this AesUnwrapInfo) Get_() Data_AesUnwrapInfo_ {
   567  	return _this.Data_AesUnwrapInfo_
   568  }
   569  
   570  type Data_AesUnwrapInfo_ interface {
   571  	isAesUnwrapInfo()
   572  }
   573  
   574  type CompanionStruct_AesUnwrapInfo_ struct {
   575  }
   576  
   577  var Companion_AesUnwrapInfo_ = CompanionStruct_AesUnwrapInfo_{}
   578  
   579  type AesUnwrapInfo_AesUnwrapInfo struct {
   580  }
   581  
   582  func (AesUnwrapInfo_AesUnwrapInfo) isAesUnwrapInfo() {}
   583  
   584  func (CompanionStruct_AesUnwrapInfo_) Create_AesUnwrapInfo_() AesUnwrapInfo {
   585  	return AesUnwrapInfo{AesUnwrapInfo_AesUnwrapInfo{}}
   586  }
   587  
   588  func (_this AesUnwrapInfo) Is_AesUnwrapInfo() bool {
   589  	_, ok := _this.Get_().(AesUnwrapInfo_AesUnwrapInfo)
   590  	return ok
   591  }
   592  
   593  func (CompanionStruct_AesUnwrapInfo_) Default() AesUnwrapInfo {
   594  	return Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_()
   595  }
   596  
   597  func (_ CompanionStruct_AesUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator {
   598  	i := -1
   599  	return func() (interface{}, bool) {
   600  		i++
   601  		switch i {
   602  		case 0:
   603  			return Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_(), true
   604  		default:
   605  			return AesUnwrapInfo{}, false
   606  		}
   607  	}
   608  }
   609  
   610  func (_this AesUnwrapInfo) String() string {
   611  	switch _this.Get_().(type) {
   612  	case nil:
   613  		return "null"
   614  	case AesUnwrapInfo_AesUnwrapInfo:
   615  		{
   616  			return "RawAESKeyring.AesUnwrapInfo.AesUnwrapInfo"
   617  		}
   618  	default:
   619  		{
   620  			return "<unexpected>"
   621  		}
   622  	}
   623  }
   624  
   625  func (_this AesUnwrapInfo) Equals(other AesUnwrapInfo) bool {
   626  	switch _this.Get_().(type) {
   627  	case AesUnwrapInfo_AesUnwrapInfo:
   628  		{
   629  			_, ok := other.Get_().(AesUnwrapInfo_AesUnwrapInfo)
   630  			return ok
   631  		}
   632  	default:
   633  		{
   634  			return false // unexpected
   635  		}
   636  	}
   637  }
   638  
   639  func (_this AesUnwrapInfo) EqualsGeneric(other interface{}) bool {
   640  	typed, ok := other.(AesUnwrapInfo)
   641  	return ok && _this.Equals(typed)
   642  }
   643  
   644  func Type_AesUnwrapInfo_() _dafny.TypeDescriptor {
   645  	return type_AesUnwrapInfo_{}
   646  }
   647  
   648  type type_AesUnwrapInfo_ struct {
   649  }
   650  
   651  func (_this type_AesUnwrapInfo_) Default() interface{} {
   652  	return Companion_AesUnwrapInfo_.Default()
   653  }
   654  
   655  func (_this type_AesUnwrapInfo_) String() string {
   656  	return "RawAESKeyring.AesUnwrapInfo"
   657  }
   658  func (_this AesUnwrapInfo) ParentTraits_() []*_dafny.TraitID {
   659  	return [](*_dafny.TraitID){}
   660  }
   661  
   662  var _ _dafny.TraitOffspring = AesUnwrapInfo{}
   663  
   664  // End of datatype AesUnwrapInfo
   665  
   666  // Definition of datatype AesWrapInfo
   667  type AesWrapInfo struct {
   668  	Data_AesWrapInfo_
   669  }
   670  
   671  func (_this AesWrapInfo) Get_() Data_AesWrapInfo_ {
   672  	return _this.Data_AesWrapInfo_
   673  }
   674  
   675  type Data_AesWrapInfo_ interface {
   676  	isAesWrapInfo()
   677  }
   678  
   679  type CompanionStruct_AesWrapInfo_ struct {
   680  }
   681  
   682  var Companion_AesWrapInfo_ = CompanionStruct_AesWrapInfo_{}
   683  
   684  type AesWrapInfo_AesWrapInfo struct {
   685  	Iv _dafny.Sequence
   686  }
   687  
   688  func (AesWrapInfo_AesWrapInfo) isAesWrapInfo() {}
   689  
   690  func (CompanionStruct_AesWrapInfo_) Create_AesWrapInfo_(Iv _dafny.Sequence) AesWrapInfo {
   691  	return AesWrapInfo{AesWrapInfo_AesWrapInfo{Iv}}
   692  }
   693  
   694  func (_this AesWrapInfo) Is_AesWrapInfo() bool {
   695  	_, ok := _this.Get_().(AesWrapInfo_AesWrapInfo)
   696  	return ok
   697  }
   698  
   699  func (CompanionStruct_AesWrapInfo_) Default() AesWrapInfo {
   700  	return Companion_AesWrapInfo_.Create_AesWrapInfo_(_dafny.EmptySeq)
   701  }
   702  
   703  func (_this AesWrapInfo) Dtor_iv() _dafny.Sequence {
   704  	return _this.Get_().(AesWrapInfo_AesWrapInfo).Iv
   705  }
   706  
   707  func (_this AesWrapInfo) String() string {
   708  	switch data := _this.Get_().(type) {
   709  	case nil:
   710  		return "null"
   711  	case AesWrapInfo_AesWrapInfo:
   712  		{
   713  			return "RawAESKeyring.AesWrapInfo.AesWrapInfo" + "(" + _dafny.String(data.Iv) + ")"
   714  		}
   715  	default:
   716  		{
   717  			return "<unexpected>"
   718  		}
   719  	}
   720  }
   721  
   722  func (_this AesWrapInfo) Equals(other AesWrapInfo) bool {
   723  	switch data1 := _this.Get_().(type) {
   724  	case AesWrapInfo_AesWrapInfo:
   725  		{
   726  			data2, ok := other.Get_().(AesWrapInfo_AesWrapInfo)
   727  			return ok && data1.Iv.Equals(data2.Iv)
   728  		}
   729  	default:
   730  		{
   731  			return false // unexpected
   732  		}
   733  	}
   734  }
   735  
   736  func (_this AesWrapInfo) EqualsGeneric(other interface{}) bool {
   737  	typed, ok := other.(AesWrapInfo)
   738  	return ok && _this.Equals(typed)
   739  }
   740  
   741  func Type_AesWrapInfo_() _dafny.TypeDescriptor {
   742  	return type_AesWrapInfo_{}
   743  }
   744  
   745  type type_AesWrapInfo_ struct {
   746  }
   747  
   748  func (_this type_AesWrapInfo_) Default() interface{} {
   749  	return Companion_AesWrapInfo_.Default()
   750  }
   751  
   752  func (_this type_AesWrapInfo_) String() string {
   753  	return "RawAESKeyring.AesWrapInfo"
   754  }
   755  func (_this AesWrapInfo) ParentTraits_() []*_dafny.TraitID {
   756  	return [](*_dafny.TraitID){}
   757  }
   758  
   759  var _ _dafny.TraitOffspring = AesWrapInfo{}
   760  
   761  // End of datatype AesWrapInfo
   762  
   763  // Definition of class AesGenerateAndWrapKeyMaterial
   764  type AesGenerateAndWrapKeyMaterial struct {
   765  	_wrap *AesWrapKeyMaterial
   766  }
   767  
   768  func New_AesGenerateAndWrapKeyMaterial_() *AesGenerateAndWrapKeyMaterial {
   769  	_this := AesGenerateAndWrapKeyMaterial{}
   770  
   771  	_this._wrap = (*AesWrapKeyMaterial)(nil)
   772  	return &_this
   773  }
   774  
   775  type CompanionStruct_AesGenerateAndWrapKeyMaterial_ struct {
   776  }
   777  
   778  var Companion_AesGenerateAndWrapKeyMaterial_ = CompanionStruct_AesGenerateAndWrapKeyMaterial_{}
   779  
   780  func (_this *AesGenerateAndWrapKeyMaterial) Equals(other *AesGenerateAndWrapKeyMaterial) bool {
   781  	return _this == other
   782  }
   783  
   784  func (_this *AesGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool {
   785  	other, ok := x.(*AesGenerateAndWrapKeyMaterial)
   786  	return ok && _this.Equals(other)
   787  }
   788  
   789  func (*AesGenerateAndWrapKeyMaterial) String() string {
   790  	return "RawAESKeyring.AesGenerateAndWrapKeyMaterial"
   791  }
   792  
   793  func Type_AesGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor {
   794  	return type_AesGenerateAndWrapKeyMaterial_{}
   795  }
   796  
   797  type type_AesGenerateAndWrapKeyMaterial_ struct {
   798  }
   799  
   800  func (_this type_AesGenerateAndWrapKeyMaterial_) Default() interface{} {
   801  	return (*AesGenerateAndWrapKeyMaterial)(nil)
   802  }
   803  
   804  func (_this type_AesGenerateAndWrapKeyMaterial_) String() string {
   805  	return "RawAESKeyring.AesGenerateAndWrapKeyMaterial"
   806  }
   807  func (_this *AesGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
   808  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
   809  }
   810  
   811  var _ m_MaterialWrapping.GenerateAndWrapMaterial = &AesGenerateAndWrapKeyMaterial{}
   812  var _ m_Actions.ActionWithResult = &AesGenerateAndWrapKeyMaterial{}
   813  var _ m_Actions.Action = &AesGenerateAndWrapKeyMaterial{}
   814  var _ _dafny.TraitOffspring = &AesGenerateAndWrapKeyMaterial{}
   815  
   816  func (_this *AesGenerateAndWrapKeyMaterial) Ctor__(wrap *AesWrapKeyMaterial) {
   817  	{
   818  		(_this)._wrap = wrap
   819  	}
   820  }
   821  func (_this *AesGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} {
   822  	{
   823  		var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput)
   824  		_ = input
   825  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_AesWrapInfo_.Default()))
   826  		_ = res
   827  		var _0_generateBytesResult m_Wrappers.Result
   828  		_ = _0_generateBytesResult
   829  		var _out0 m_Wrappers.Result
   830  		_ = _out0
   831  		_out0 = (((_this).Wrap()).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite())))
   832  		_0_generateBytesResult = _out0
   833  		var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   834  		_ = _1_valueOrError0
   835  		_1_valueOrError0 = (_0_generateBytesResult).MapFailure(func(coer121 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
   836  			return func(arg122 interface{}) interface{} {
   837  				return coer121(arg122.(m_AwsCryptographyPrimitivesTypes.Error))
   838  			}
   839  		}(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
   840  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e)
   841  		}))
   842  		if (_1_valueOrError0).IsFailure() {
   843  			res = (_1_valueOrError0).PropagateFailure()
   844  			return res
   845  		}
   846  		var _3_plaintextMaterial _dafny.Sequence
   847  		_ = _3_plaintextMaterial
   848  		_3_plaintextMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence)
   849  		var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_AesWrapInfo_.Default()))
   850  		_ = _4_valueOrError1
   851  		var _out1 interface{}
   852  		_ = _out1
   853  		_out1 = ((_this).Wrap()).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_3_plaintextMaterial, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext()))
   854  		_4_valueOrError1 = _out1.(m_Wrappers.Result)
   855  		if (_4_valueOrError1).IsFailure() {
   856  			res = (_4_valueOrError1).PropagateFailure()
   857  			return res
   858  		}
   859  		var _5_wrapOutput m_MaterialWrapping.WrapOutput
   860  		_ = _5_wrapOutput
   861  		_5_wrapOutput = (_4_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput)
   862  		res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_3_plaintextMaterial, (_5_wrapOutput).Dtor_wrappedMaterial(), (_5_wrapOutput).Dtor_wrapInfo().(AesWrapInfo)))
   863  		return res
   864  	}
   865  }
   866  func (_this *AesGenerateAndWrapKeyMaterial) Wrap() *AesWrapKeyMaterial {
   867  	{
   868  		return _this._wrap
   869  	}
   870  }
   871  
   872  // End of class AesGenerateAndWrapKeyMaterial
   873  
   874  // Definition of class AesWrapKeyMaterial
   875  type AesWrapKeyMaterial struct {
   876  	_wrappingKey       _dafny.Sequence
   877  	_wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM
   878  	_cryptoPrimitives  *m_AtomicPrimitives.AtomicPrimitivesClient
   879  }
   880  
   881  func New_AesWrapKeyMaterial_() *AesWrapKeyMaterial {
   882  	_this := AesWrapKeyMaterial{}
   883  
   884  	_this._wrappingKey = _dafny.EmptySeq
   885  	_this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{}
   886  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
   887  	return &_this
   888  }
   889  
   890  type CompanionStruct_AesWrapKeyMaterial_ struct {
   891  }
   892  
   893  var Companion_AesWrapKeyMaterial_ = CompanionStruct_AesWrapKeyMaterial_{}
   894  
   895  func (_this *AesWrapKeyMaterial) Equals(other *AesWrapKeyMaterial) bool {
   896  	return _this == other
   897  }
   898  
   899  func (_this *AesWrapKeyMaterial) EqualsGeneric(x interface{}) bool {
   900  	other, ok := x.(*AesWrapKeyMaterial)
   901  	return ok && _this.Equals(other)
   902  }
   903  
   904  func (*AesWrapKeyMaterial) String() string {
   905  	return "RawAESKeyring.AesWrapKeyMaterial"
   906  }
   907  
   908  func Type_AesWrapKeyMaterial_() _dafny.TypeDescriptor {
   909  	return type_AesWrapKeyMaterial_{}
   910  }
   911  
   912  type type_AesWrapKeyMaterial_ struct {
   913  }
   914  
   915  func (_this type_AesWrapKeyMaterial_) Default() interface{} {
   916  	return (*AesWrapKeyMaterial)(nil)
   917  }
   918  
   919  func (_this type_AesWrapKeyMaterial_) String() string {
   920  	return "RawAESKeyring.AesWrapKeyMaterial"
   921  }
   922  func (_this *AesWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
   923  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
   924  }
   925  
   926  var _ m_MaterialWrapping.WrapMaterial = &AesWrapKeyMaterial{}
   927  var _ m_Actions.ActionWithResult = &AesWrapKeyMaterial{}
   928  var _ m_Actions.Action = &AesWrapKeyMaterial{}
   929  var _ _dafny.TraitOffspring = &AesWrapKeyMaterial{}
   930  
   931  func (_this *AesWrapKeyMaterial) Ctor__(wrappingKey _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) {
   932  	{
   933  		(_this)._wrappingKey = wrappingKey
   934  		(_this)._wrappingAlgorithm = wrappingAlgorithm
   935  		(_this)._cryptoPrimitives = cryptoPrimitives
   936  	}
   937  }
   938  func (_this *AesWrapKeyMaterial) Invoke(input interface{}) interface{} {
   939  	{
   940  		var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput)
   941  		_ = input
   942  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_AesWrapInfo_.Default()))
   943  		_ = res
   944  		var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   945  		_ = _0_valueOrError0
   946  		_0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext())
   947  		if (_0_valueOrError0).IsFailure() {
   948  			res = (_0_valueOrError0).PropagateFailure()
   949  			return res
   950  		}
   951  		var _1_aad _dafny.Sequence
   952  		_ = _1_aad
   953  		_1_aad = (_0_valueOrError0).Extract().(_dafny.Sequence)
   954  		var _2_randomIvResult m_Wrappers.Result
   955  		_ = _2_randomIvResult
   956  		var _out0 m_Wrappers.Result
   957  		_ = _out0
   958  		_out0 = ((_this).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(((_this).WrappingAlgorithm()).Dtor_ivLength()))
   959  		_2_randomIvResult = _out0
   960  		var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   961  		_ = _3_valueOrError1
   962  		_3_valueOrError1 = (_2_randomIvResult).MapFailure(func(coer122 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
   963  			return func(arg123 interface{}) interface{} {
   964  				return coer122(arg123.(m_AwsCryptographyPrimitivesTypes.Error))
   965  			}
   966  		}(func(_4_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
   967  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_4_e)
   968  		}))
   969  		if (_3_valueOrError1).IsFailure() {
   970  			res = (_3_valueOrError1).PropagateFailure()
   971  			return res
   972  		}
   973  		var _5_iv _dafny.Sequence
   974  		_ = _5_iv
   975  		_5_iv = (_3_valueOrError1).Extract().(_dafny.Sequence)
   976  		var _6_aesEncryptResult m_Wrappers.Result
   977  		_ = _6_aesEncryptResult
   978  		var _out1 m_Wrappers.Result
   979  		_ = _out1
   980  		_out1 = ((_this).CryptoPrimitives()).AESEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_((_this).WrappingAlgorithm(), _5_iv, (_this).WrappingKey(), (input).Dtor_plaintextMaterial(), _1_aad))
   981  		_6_aesEncryptResult = _out1
   982  		var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default())
   983  		_ = _7_valueOrError2
   984  		_7_valueOrError2 = (_6_aesEncryptResult).MapFailure(func(coer123 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
   985  			return func(arg124 interface{}) interface{} {
   986  				return coer123(arg124.(m_AwsCryptographyPrimitivesTypes.Error))
   987  			}
   988  		}(func(_8_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
   989  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_8_e)
   990  		}))
   991  		if (_7_valueOrError2).IsFailure() {
   992  			res = (_7_valueOrError2).PropagateFailure()
   993  			return res
   994  		}
   995  		var _9_wrappedMaterialResult m_AwsCryptographyPrimitivesTypes.AESEncryptOutput
   996  		_ = _9_wrappedMaterialResult
   997  		_9_wrappedMaterialResult = (_7_valueOrError2).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput)
   998  		var _10_wrappedMaterial _dafny.Sequence
   999  		_ = _10_wrappedMaterial
  1000  		_10_wrappedMaterial = Companion_Default___.SerializeEDKCiphertext(_9_wrappedMaterialResult)
  1001  		res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_10_wrappedMaterial, Companion_AesWrapInfo_.Create_AesWrapInfo_(_5_iv)))
  1002  		return res
  1003  		return res
  1004  	}
  1005  }
  1006  func (_this *AesWrapKeyMaterial) WrappingKey() _dafny.Sequence {
  1007  	{
  1008  		return _this._wrappingKey
  1009  	}
  1010  }
  1011  func (_this *AesWrapKeyMaterial) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM {
  1012  	{
  1013  		return _this._wrappingAlgorithm
  1014  	}
  1015  }
  1016  func (_this *AesWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
  1017  	{
  1018  		return _this._cryptoPrimitives
  1019  	}
  1020  }
  1021  
  1022  // End of class AesWrapKeyMaterial
  1023  
  1024  // Definition of class AesUnwrapKeyMaterial
  1025  type AesUnwrapKeyMaterial struct {
  1026  	_wrappingKey       _dafny.Sequence
  1027  	_iv                _dafny.Sequence
  1028  	_wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM
  1029  	_cryptoPrimitives  *m_AtomicPrimitives.AtomicPrimitivesClient
  1030  }
  1031  
  1032  func New_AesUnwrapKeyMaterial_() *AesUnwrapKeyMaterial {
  1033  	_this := AesUnwrapKeyMaterial{}
  1034  
  1035  	_this._wrappingKey = _dafny.EmptySeq
  1036  	_this._iv = _dafny.EmptySeq
  1037  	_this._wrappingAlgorithm = m_AwsCryptographyPrimitivesTypes.AES__GCM{}
  1038  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
  1039  	return &_this
  1040  }
  1041  
  1042  type CompanionStruct_AesUnwrapKeyMaterial_ struct {
  1043  }
  1044  
  1045  var Companion_AesUnwrapKeyMaterial_ = CompanionStruct_AesUnwrapKeyMaterial_{}
  1046  
  1047  func (_this *AesUnwrapKeyMaterial) Equals(other *AesUnwrapKeyMaterial) bool {
  1048  	return _this == other
  1049  }
  1050  
  1051  func (_this *AesUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool {
  1052  	other, ok := x.(*AesUnwrapKeyMaterial)
  1053  	return ok && _this.Equals(other)
  1054  }
  1055  
  1056  func (*AesUnwrapKeyMaterial) String() string {
  1057  	return "RawAESKeyring.AesUnwrapKeyMaterial"
  1058  }
  1059  
  1060  func Type_AesUnwrapKeyMaterial_() _dafny.TypeDescriptor {
  1061  	return type_AesUnwrapKeyMaterial_{}
  1062  }
  1063  
  1064  type type_AesUnwrapKeyMaterial_ struct {
  1065  }
  1066  
  1067  func (_this type_AesUnwrapKeyMaterial_) Default() interface{} {
  1068  	return (*AesUnwrapKeyMaterial)(nil)
  1069  }
  1070  
  1071  func (_this type_AesUnwrapKeyMaterial_) String() string {
  1072  	return "RawAESKeyring.AesUnwrapKeyMaterial"
  1073  }
  1074  func (_this *AesUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
  1075  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
  1076  }
  1077  
  1078  var _ m_MaterialWrapping.UnwrapMaterial = &AesUnwrapKeyMaterial{}
  1079  var _ m_Actions.ActionWithResult = &AesUnwrapKeyMaterial{}
  1080  var _ m_Actions.Action = &AesUnwrapKeyMaterial{}
  1081  var _ _dafny.TraitOffspring = &AesUnwrapKeyMaterial{}
  1082  
  1083  func (_this *AesUnwrapKeyMaterial) Ctor__(wrappingKey _dafny.Sequence, wrappingAlgorithm m_AwsCryptographyPrimitivesTypes.AES__GCM, iv _dafny.Sequence, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) {
  1084  	{
  1085  		(_this)._wrappingKey = wrappingKey
  1086  		(_this)._iv = iv
  1087  		(_this)._wrappingAlgorithm = wrappingAlgorithm
  1088  		(_this)._cryptoPrimitives = cryptoPrimitives
  1089  	}
  1090  }
  1091  func (_this *AesUnwrapKeyMaterial) Invoke(input interface{}) interface{} {
  1092  	{
  1093  		var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput)
  1094  		_ = input
  1095  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_AesUnwrapInfo_.Default()))
  1096  		_ = res
  1097  		var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
  1098  		_ = _0_valueOrError0
  1099  		_0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD((input).Dtor_encryptionContext())
  1100  		if (_0_valueOrError0).IsFailure() {
  1101  			res = (_0_valueOrError0).PropagateFailure()
  1102  			return res
  1103  		}
  1104  		var _1_aad _dafny.Sequence
  1105  		_ = _1_aad
  1106  		_1_aad = (_0_valueOrError0).Extract().(_dafny.Sequence)
  1107  		var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
  1108  		_ = _2_valueOrError1
  1109  		_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.")))
  1110  		if (_2_valueOrError1).IsFailure() {
  1111  			res = (_2_valueOrError1).PropagateFailure()
  1112  			return res
  1113  		}
  1114  		var _3_encryptionOutput m_AwsCryptographyPrimitivesTypes.AESEncryptOutput
  1115  		_ = _3_encryptionOutput
  1116  		_3_encryptionOutput = Companion_Default___.DeserializeEDKCiphertext((input).Dtor_wrappedMaterial(), _dafny.IntOfInt32(((_this).WrappingAlgorithm()).Dtor_tagLength()))
  1117  		var _4_maybePtKey m_Wrappers.Result
  1118  		_ = _4_maybePtKey
  1119  		var _out0 m_Wrappers.Result
  1120  		_ = _out0
  1121  		_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))
  1122  		_4_maybePtKey = _out0
  1123  		var _5_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
  1124  		_ = _5_valueOrError2
  1125  		_5_valueOrError2 = (_4_maybePtKey).MapFailure(func(coer124 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
  1126  			return func(arg125 interface{}) interface{} {
  1127  				return coer124(arg125.(m_AwsCryptographyPrimitivesTypes.Error))
  1128  			}
  1129  		}(func(_6_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
  1130  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_6_e)
  1131  		}))
  1132  		if (_5_valueOrError2).IsFailure() {
  1133  			res = (_5_valueOrError2).PropagateFailure()
  1134  			return res
  1135  		}
  1136  		var _7_ptKey _dafny.Sequence
  1137  		_ = _7_ptKey
  1138  		_7_ptKey = (_5_valueOrError2).Extract().(_dafny.Sequence)
  1139  		var _8_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
  1140  		_ = _8_valueOrError3
  1141  		_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")))
  1142  		if (_8_valueOrError3).IsFailure() {
  1143  			res = (_8_valueOrError3).PropagateFailure()
  1144  			return res
  1145  		}
  1146  		res = m_Wrappers.Companion_Result_.Create_Success_(m_MaterialWrapping.Companion_UnwrapOutput_.Create_UnwrapOutput_(_7_ptKey, Companion_AesUnwrapInfo_.Create_AesUnwrapInfo_()))
  1147  		return res
  1148  		return res
  1149  	}
  1150  }
  1151  func (_this *AesUnwrapKeyMaterial) WrappingKey() _dafny.Sequence {
  1152  	{
  1153  		return _this._wrappingKey
  1154  	}
  1155  }
  1156  func (_this *AesUnwrapKeyMaterial) Iv() _dafny.Sequence {
  1157  	{
  1158  		return _this._iv
  1159  	}
  1160  }
  1161  func (_this *AesUnwrapKeyMaterial) WrappingAlgorithm() m_AwsCryptographyPrimitivesTypes.AES__GCM {
  1162  	{
  1163  		return _this._wrappingAlgorithm
  1164  	}
  1165  }
  1166  func (_this *AesUnwrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
  1167  	{
  1168  		return _this._cryptoPrimitives
  1169  	}
  1170  }
  1171  
  1172  // End of class AesUnwrapKeyMaterial