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

     1  // Package AwsKmsRsaKeyring
     2  // Dafny module AwsKmsRsaKeyring compiled into Go
     3  
     4  package AwsKmsRsaKeyring
     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_AwsKmsHierarchicalKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsHierarchicalKeyring"
    20  	m_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring"
    21  	m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique"
    22  	m_AwsKmsMrkDiscoveryKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkDiscoveryKeyring"
    23  	m_AwsKmsMrkKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkKeyring"
    24  	m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt"
    25  	m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils"
    26  	m_CacheConstants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CacheConstants"
    27  	m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext"
    28  	m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants"
    29  	m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable"
    30  	m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys"
    31  	m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations"
    32  	m_DiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DiscoveryMultiKeyring"
    33  	m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping"
    34  	m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages"
    35  	m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys"
    36  	m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping"
    37  	m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations"
    38  	m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore"
    39  	m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages"
    40  	m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring"
    41  	m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn"
    42  	m_LocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/LocalCMC"
    43  	m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping"
    44  	m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials"
    45  	m_MrkAwareDiscoveryMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareDiscoveryMultiKeyring"
    46  	m_MrkAwareStrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MrkAwareStrictMultiKeyring"
    47  	m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring"
    48  	m_StormTracker "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTracker"
    49  	m_StormTrackingCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StormTrackingCMC"
    50  	m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring"
    51  	m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure"
    52  	m_SynchronizedLocalCMC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/SynchronizedLocalCMC"
    53  	m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives"
    54  	m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations"
    55  	m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes"
    56  	m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest"
    57  	m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF"
    58  	m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr"
    59  	m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random"
    60  	m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF"
    61  	m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC"
    62  	m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions"
    63  	m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64"
    64  	m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas"
    65  	m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts"
    66  	m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals"
    67  	m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear"
    68  	m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod"
    69  	m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO"
    70  	m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare"
    71  	m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions"
    72  	m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals"
    73  	m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt"
    74  	m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings"
    75  	m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm"
    76  	m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_"
    77  	m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals"
    78  	m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear"
    79  	m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul"
    80  	m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals"
    81  	m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear"
    82  	m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power"
    83  	m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations"
    84  	m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq"
    85  	m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort"
    86  	m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting"
    87  	m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary"
    88  	m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop"
    89  	m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence"
    90  	m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String"
    91  	m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt"
    92  	m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams"
    93  	m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8"
    94  	m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings"
    95  	m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_"
    96  	m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm"
    97  	m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm"
    98  	m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers"
    99  	m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_"
   100  	_dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny"
   101  )
   102  
   103  var _ = os.Args
   104  var _ _dafny.Dummy__
   105  var _ m__System.Dummy__
   106  var _ m_Wrappers.Dummy__
   107  var _ m_BoundedInts.Dummy__
   108  var _ m_StandardLibrary_UInt.Dummy__
   109  var _ m_StandardLibrary_Sequence.Dummy__
   110  var _ m_StandardLibrary_String.Dummy__
   111  var _ m_StandardLibrary.Dummy__
   112  var _ m_AwsCryptographyPrimitivesTypes.Dummy__
   113  var _ m_Random.Dummy__
   114  var _ m_Digest.Dummy__
   115  var _ m_WrappedHMAC.Dummy__
   116  var _ m_HKDF.Dummy__
   117  var _ m_WrappedHKDF.Dummy__
   118  var _ m_KdfCtr.Dummy__
   119  var _ m_AwsCryptographyPrimitivesOperations.Dummy__
   120  var _ m_AtomicPrimitives.Dummy__
   121  var _ m_ComAmazonawsDynamodbTypes.Dummy__
   122  var _ m_ComAmazonawsKmsTypes.Dummy__
   123  var _ m_Relations.Dummy__
   124  var _ m_Seq_MergeSort.Dummy__
   125  var _ m__Math.Dummy__
   126  var _ m_Seq.Dummy__
   127  var _ m__Unicode.Dummy__
   128  var _ m_Functions.Dummy__
   129  var _ m_Utf8EncodingForm.Dummy__
   130  var _ m_Utf16EncodingForm.Dummy__
   131  var _ m_UnicodeStrings.Dummy__
   132  var _ m_FileIO.Dummy__
   133  var _ m_GeneralInternals.Dummy__
   134  var _ m_MulInternalsNonlinear.Dummy__
   135  var _ m_MulInternals.Dummy__
   136  var _ m_Mul.Dummy__
   137  var _ m_ModInternalsNonlinear.Dummy__
   138  var _ m_DivInternalsNonlinear.Dummy__
   139  var _ m_ModInternals.Dummy__
   140  var _ m_DivInternals.Dummy__
   141  var _ m_DivMod.Dummy__
   142  var _ m_Power.Dummy__
   143  var _ m_Logarithm.Dummy__
   144  var _ m_StandardLibraryInterop.Dummy__
   145  var _ m_Streams.Dummy__
   146  var _ m_Sorting.Dummy__
   147  var _ m_HexStrings.Dummy__
   148  var _ m_GetOpt.Dummy__
   149  var _ m_FloatCompare.Dummy__
   150  var _ m_Base64.Dummy__
   151  var _ m_Base64Lemmas.Dummy__
   152  var _ m_Actions.Dummy__
   153  var _ m_AwsCryptographyKeyStoreTypes.Dummy__
   154  var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__
   155  var _ m_AwsArnParsing.Dummy__
   156  var _ m_AwsKmsMrkMatchForDecrypt.Dummy__
   157  var _ m_AwsKmsUtils.Dummy__
   158  var _ m_KeyStoreErrorMessages.Dummy__
   159  var _ m_KmsArn.Dummy__
   160  var _ m_Structure.Dummy__
   161  var _ m_KMSKeystoreOperations.Dummy__
   162  var _ m_DDBKeystoreOperations.Dummy__
   163  var _ m_CreateKeys.Dummy__
   164  var _ m_CreateKeyStoreTable.Dummy__
   165  var _ m_GetKeys.Dummy__
   166  var _ m_AwsCryptographyKeyStoreOperations.Dummy__
   167  var _ m_Com_Amazonaws_Kms.Dummy__
   168  var _ m_Com_Amazonaws_Dynamodb.Dummy__
   169  var _ m_KeyStore.Dummy__
   170  var _ m_AlgorithmSuites.Dummy__
   171  var _ m_Materials.Dummy__
   172  var _ m_Keyring.Dummy__
   173  var _ m_MultiKeyring.Dummy__
   174  var _ m_AwsKmsMrkAreUnique.Dummy__
   175  var _ m_Constants.Dummy__
   176  var _ m_MaterialWrapping.Dummy__
   177  var _ m_CanonicalEncryptionContext.Dummy__
   178  var _ m_IntermediateKeyWrapping.Dummy__
   179  var _ m_EdkWrapping.Dummy__
   180  var _ m_ErrorMessages.Dummy__
   181  var _ m_AwsKmsKeyring.Dummy__
   182  var _ m_StrictMultiKeyring.Dummy__
   183  var _ m_AwsKmsDiscoveryKeyring.Dummy__
   184  var _ m_DiscoveryMultiKeyring.Dummy__
   185  var _ m_AwsKmsMrkDiscoveryKeyring.Dummy__
   186  var _ m_MrkAwareDiscoveryMultiKeyring.Dummy__
   187  var _ m_AwsKmsMrkKeyring.Dummy__
   188  var _ m_MrkAwareStrictMultiKeyring.Dummy__
   189  var _ m_LocalCMC.Dummy__
   190  var _ m_SynchronizedLocalCMC.Dummy__
   191  var _ m_StormTracker.Dummy__
   192  var _ m_StormTrackingCMC.Dummy__
   193  var _ m_CacheConstants.Dummy__
   194  var _ m_AwsKmsHierarchicalKeyring.Dummy__
   195  
   196  type Dummy__ struct{}
   197  
   198  // Definition of class Default__
   199  type Default__ struct {
   200  	dummy byte
   201  }
   202  
   203  func New_Default___() *Default__ {
   204  	_this := Default__{}
   205  
   206  	return &_this
   207  }
   208  
   209  type CompanionStruct_Default___ struct {
   210  }
   211  
   212  var Companion_Default___ = CompanionStruct_Default___{}
   213  
   214  func (_this *Default__) Equals(other *Default__) bool {
   215  	return _this == other
   216  }
   217  
   218  func (_this *Default__) EqualsGeneric(x interface{}) bool {
   219  	other, ok := x.(*Default__)
   220  	return ok && _this.Equals(other)
   221  }
   222  
   223  func (*Default__) String() string {
   224  	return "AwsKmsRsaKeyring.Default__"
   225  }
   226  func (_this *Default__) ParentTraits_() []*_dafny.TraitID {
   227  	return [](*_dafny.TraitID){}
   228  }
   229  
   230  var _ _dafny.TraitOffspring = &Default__{}
   231  
   232  func (_static *CompanionStruct_Default___) EncryptionContextDigest(cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient, encryptionContext _dafny.Map) m_Wrappers.Result {
   233  	var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   234  	_ = output
   235  	var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   236  	_ = _0_valueOrError0
   237  	_0_valueOrError0 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext)
   238  	if (_0_valueOrError0).IsFailure() {
   239  		output = (_0_valueOrError0).PropagateFailure()
   240  		return output
   241  	}
   242  	var _1_canonicalEC _dafny.Sequence
   243  	_ = _1_canonicalEC
   244  	_1_canonicalEC = (_0_valueOrError0).Extract().(_dafny.Sequence)
   245  	var _2_DigestInput m_AwsCryptographyPrimitivesTypes.DigestInput
   246  	_ = _2_DigestInput
   247  	_2_DigestInput = m_AwsCryptographyPrimitivesTypes.Companion_DigestInput_.Create_DigestInput_(m_AwsCryptographyPrimitivesTypes.Companion_DigestAlgorithm_.Create_SHA__384_(), _1_canonicalEC)
   248  	var _3_maybeDigest m_Wrappers.Result
   249  	_ = _3_maybeDigest
   250  	var _out0 m_Wrappers.Result
   251  	_ = _out0
   252  	_out0 = (cryptoPrimitives).Digest(_2_DigestInput)
   253  	_3_maybeDigest = _out0
   254  	var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   255  	_ = _4_valueOrError1
   256  	_4_valueOrError1 = (_3_maybeDigest).MapFailure(func(coer97 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
   257  		return func(arg98 interface{}) interface{} {
   258  			return coer97(arg98.(m_AwsCryptographyPrimitivesTypes.Error))
   259  		}
   260  	}(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
   261  		return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e)
   262  	}))
   263  	if (_4_valueOrError1).IsFailure() {
   264  		output = (_4_valueOrError1).PropagateFailure()
   265  		return output
   266  	}
   267  	var _6_digest _dafny.Sequence
   268  	_ = _6_digest
   269  	_6_digest = (_4_valueOrError1).Extract().(_dafny.Sequence)
   270  	output = m_Wrappers.Companion_Result_.Create_Success_(_6_digest)
   271  	return output
   272  	return output
   273  }
   274  func (_static *CompanionStruct_Default___) MIN__KMS__RSA__KEY__LEN() int32 {
   275  	return int32(2048)
   276  }
   277  
   278  // End of class Default__
   279  
   280  // Definition of class AwsKmsRsaKeyring
   281  type AwsKmsRsaKeyring struct {
   282  	_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient
   283  	_client           m_Wrappers.Option
   284  	_paddingScheme    m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec
   285  	_awsKmsKey        _dafny.Sequence
   286  	_publicKey        m_Wrappers.Option
   287  	_awsKmsArn        m_AwsArnParsing.AwsKmsIdentifier
   288  	_grantTokens      _dafny.Sequence
   289  }
   290  
   291  func New_AwsKmsRsaKeyring_() *AwsKmsRsaKeyring {
   292  	_this := AwsKmsRsaKeyring{}
   293  
   294  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
   295  	_this._client = m_Wrappers.Companion_Option_.Default()
   296  	_this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default()
   297  	_this._awsKmsKey = _dafny.EmptySeq.SetString()
   298  	_this._publicKey = m_Wrappers.Companion_Option_.Default()
   299  	_this._awsKmsArn = m_AwsArnParsing.AwsKmsIdentifier{}
   300  	_this._grantTokens = _dafny.EmptySeq
   301  	return &_this
   302  }
   303  
   304  type CompanionStruct_AwsKmsRsaKeyring_ struct {
   305  }
   306  
   307  var Companion_AwsKmsRsaKeyring_ = CompanionStruct_AwsKmsRsaKeyring_{}
   308  
   309  func (_this *AwsKmsRsaKeyring) Equals(other *AwsKmsRsaKeyring) bool {
   310  	return _this == other
   311  }
   312  
   313  func (_this *AwsKmsRsaKeyring) EqualsGeneric(x interface{}) bool {
   314  	other, ok := x.(*AwsKmsRsaKeyring)
   315  	return ok && _this.Equals(other)
   316  }
   317  
   318  func (*AwsKmsRsaKeyring) String() string {
   319  	return "AwsKmsRsaKeyring.AwsKmsRsaKeyring"
   320  }
   321  
   322  func Type_AwsKmsRsaKeyring_() _dafny.TypeDescriptor {
   323  	return type_AwsKmsRsaKeyring_{}
   324  }
   325  
   326  type type_AwsKmsRsaKeyring_ struct {
   327  }
   328  
   329  func (_this type_AwsKmsRsaKeyring_) Default() interface{} {
   330  	return (*AwsKmsRsaKeyring)(nil)
   331  }
   332  
   333  func (_this type_AwsKmsRsaKeyring_) String() string {
   334  	return "AwsKmsRsaKeyring.AwsKmsRsaKeyring"
   335  }
   336  func (_this *AwsKmsRsaKeyring) ParentTraits_() []*_dafny.TraitID {
   337  	return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_}
   338  }
   339  
   340  var _ m_Keyring.VerifiableInterface = &AwsKmsRsaKeyring{}
   341  var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsRsaKeyring{}
   342  var _ _dafny.TraitOffspring = &AwsKmsRsaKeyring{}
   343  
   344  func (_this *AwsKmsRsaKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result {
   345  	var _out7 m_Wrappers.Result
   346  	_ = _out7
   347  	_out7 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input)
   348  	return _out7
   349  }
   350  func (_this *AwsKmsRsaKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result {
   351  	var _out7 m_Wrappers.Result
   352  	_ = _out7
   353  	_out7 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input)
   354  	return _out7
   355  }
   356  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) {
   357  	{
   358  		var _0_parsedAwsKmsId m_Wrappers.Result
   359  		_ = _0_parsedAwsKmsId
   360  		_0_parsedAwsKmsId = m_AwsArnParsing.Companion_Default___.ParseAwsKmsIdentifier(awsKmsKey)
   361  		(_this)._publicKey = publicKey
   362  		(_this)._awsKmsKey = awsKmsKey
   363  		(_this)._awsKmsArn = (_0_parsedAwsKmsId).Dtor_value().(m_AwsArnParsing.AwsKmsIdentifier)
   364  		(_this)._paddingScheme = paddingScheme
   365  		(_this)._client = client
   366  		(_this)._cryptoPrimitives = cryptoPrimitives
   367  		(_this)._grantTokens = grantTokens
   368  	}
   369  }
   370  func (_this *AwsKmsRsaKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result {
   371  	{
   372  		var res m_Wrappers.Result = m_Wrappers.Result{}
   373  		_ = res
   374  		var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   375  		_ = _0_valueOrError0
   376  		_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")))
   377  		if (_0_valueOrError0).IsFailure() {
   378  			res = (_0_valueOrError0).PropagateFailure()
   379  			return res
   380  		}
   381  		var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   382  		_ = _1_valueOrError1
   383  		_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."))))
   384  		if (_1_valueOrError1).IsFailure() {
   385  			res = (_1_valueOrError1).PropagateFailure()
   386  			return res
   387  		}
   388  		var _2_wrap *KmsRsaWrapKeyMaterial
   389  		_ = _2_wrap
   390  		var _nw0 *KmsRsaWrapKeyMaterial = New_KmsRsaWrapKeyMaterial_()
   391  		_ = _nw0
   392  		_nw0.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives())
   393  		_2_wrap = _nw0
   394  		var _3_generateAndWrap *KmsRsaGenerateAndWrapKeyMaterial
   395  		_ = _3_generateAndWrap
   396  		var _nw1 *KmsRsaGenerateAndWrapKeyMaterial = New_KmsRsaGenerateAndWrapKeyMaterial_()
   397  		_ = _nw1
   398  		_nw1.Ctor__(((_this).PublicKey()).Dtor_value().(_dafny.Sequence), (_this).PaddingScheme(), (_this).CryptoPrimitives())
   399  		_3_generateAndWrap = _nw1
   400  		var _4_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_WrapEdkMaterialOutput_.Default(Companion_KmsRsaWrapInfo_.Default()))
   401  		_ = _4_valueOrError2
   402  		var _out0 m_Wrappers.Result
   403  		_ = _out0
   404  		_out0 = m_EdkWrapping.Companion_Default___.WrapEdkMaterial((input).Dtor_materials(), _2_wrap, _3_generateAndWrap)
   405  		_4_valueOrError2 = _out0
   406  		if (_4_valueOrError2).IsFailure() {
   407  			res = (_4_valueOrError2).PropagateFailure()
   408  			return res
   409  		}
   410  		var _5_wrapOutput m_EdkWrapping.WrapEdkMaterialOutput
   411  		_ = _5_wrapOutput
   412  		_5_wrapOutput = (_4_valueOrError2).Extract().(m_EdkWrapping.WrapEdkMaterialOutput)
   413  		var _6_symmetricSigningKeyList m_Wrappers.Option
   414  		_ = _6_symmetricSigningKeyList
   415  		if ((_5_wrapOutput).Dtor_symmetricSigningKey()).Is_Some() {
   416  			_6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOf(((_5_wrapOutput).Dtor_symmetricSigningKey()).Dtor_value().(_dafny.Sequence)))
   417  		} else {
   418  			_6_symmetricSigningKeyList = m_Wrappers.Companion_Option_.Create_None_()
   419  		}
   420  		var _7_edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey
   421  		_ = _7_edk
   422  		_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())
   423  		var _8_returnMaterials m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials = m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials{}
   424  		_ = _8_returnMaterials
   425  		if (_5_wrapOutput).Is_GenerateAndWrapEdkMaterialOutput() {
   426  			var _9_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{}
   427  			_ = _9_valueOrError3
   428  			_9_valueOrError3 = m_Materials.Companion_Default___.EncryptionMaterialAddDataKey((input).Dtor_materials(), (_5_wrapOutput).Dtor_plaintextDataKey(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList)
   429  			if (_9_valueOrError3).IsFailure() {
   430  				res = (_9_valueOrError3).PropagateFailure()
   431  				return res
   432  			}
   433  			_8_returnMaterials = (_9_valueOrError3).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)
   434  		} else if (_5_wrapOutput).Is_WrapOnlyEdkMaterialOutput() {
   435  			var _10_valueOrError4 m_Wrappers.Result = m_Wrappers.Result{}
   436  			_ = _10_valueOrError4
   437  			_10_valueOrError4 = m_Materials.Companion_Default___.EncryptionMaterialAddEncryptedDataKeys((input).Dtor_materials(), _dafny.SeqOf(_7_edk), _6_symmetricSigningKeyList)
   438  			if (_10_valueOrError4).IsFailure() {
   439  				res = (_10_valueOrError4).PropagateFailure()
   440  				return res
   441  			}
   442  			_8_returnMaterials = (_10_valueOrError4).Extract().(m_AwsCryptographyMaterialProvidersTypes.EncryptionMaterials)
   443  		}
   444  		res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnEncryptOutput_.Create_OnEncryptOutput_(_8_returnMaterials))
   445  		return res
   446  		return res
   447  	}
   448  }
   449  func (_this *AwsKmsRsaKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result {
   450  	{
   451  		var res m_Wrappers.Result = m_Wrappers.Result{}
   452  		_ = res
   453  		var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   454  		_ = _0_valueOrError0
   455  		_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")))
   456  		if (_0_valueOrError0).IsFailure() {
   457  			res = (_0_valueOrError0).PropagateFailure()
   458  			return res
   459  		}
   460  		var _1_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   461  		_ = _1_materials
   462  		_1_materials = (input).Dtor_materials()
   463  		var _2_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   464  		_ = _2_valueOrError1
   465  		_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.")))
   466  		if (_2_valueOrError1).IsFailure() {
   467  			res = (_2_valueOrError1).PropagateFailure()
   468  			return res
   469  		}
   470  		var _3_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   471  		_ = _3_valueOrError2
   472  		_3_valueOrError2 = m_AwsKmsUtils.Companion_Default___.OkForDecrypt((_this).AwsKmsArn(), (_this).AwsKmsKey())
   473  		if (_3_valueOrError2).IsFailure() {
   474  			res = (_3_valueOrError2).PropagateFailure()
   475  			return res
   476  		}
   477  		var _4_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
   478  		_ = _4_valueOrError3
   479  		_4_valueOrError3 = 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."))))
   480  		if (_4_valueOrError3).IsFailure() {
   481  			res = (_4_valueOrError3).PropagateFailure()
   482  			return res
   483  		}
   484  		var _5_filter *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter
   485  		_ = _5_filter
   486  		var _nw0 *m_AwsKmsUtils.OnDecryptMrkAwareEncryptedDataKeyFilter = m_AwsKmsUtils.New_OnDecryptMrkAwareEncryptedDataKeyFilter_()
   487  		_ = _nw0
   488  		_nw0.Ctor__((_this).AwsKmsArn(), m_Constants.Companion_Default___.RSA__PROVIDER__ID())
   489  		_5_filter = _nw0
   490  		var _6_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   491  		_ = _6_valueOrError4
   492  		var _out0 m_Wrappers.Result
   493  		_ = _out0
   494  		_out0 = m_Actions.Companion_Default___.FilterWithResult(_5_filter, (input).Dtor_encryptedDataKeys())
   495  		_6_valueOrError4 = _out0
   496  		if (_6_valueOrError4).IsFailure() {
   497  			res = (_6_valueOrError4).PropagateFailure()
   498  			return res
   499  		}
   500  		var _7_edksToAttempt _dafny.Sequence
   501  		_ = _7_edksToAttempt
   502  		_7_edksToAttempt = (_6_valueOrError4).Extract().(_dafny.Sequence)
   503  		if (_dafny.IntOfUint32((_7_edksToAttempt).Cardinality())).Sign() == 0 {
   504  			var _8_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString())
   505  			_ = _8_valueOrError5
   506  			_8_valueOrError5 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString(""))
   507  			if (_8_valueOrError5).IsFailure() {
   508  				res = (_8_valueOrError5).PropagateFailure()
   509  				return res
   510  			}
   511  			var _9_errorMessage _dafny.Sequence
   512  			_ = _9_errorMessage
   513  			_9_errorMessage = (_8_valueOrError5).Extract().(_dafny.Sequence)
   514  			res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_9_errorMessage))
   515  			return res
   516  		}
   517  		var _10_valueOrError6 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
   518  		_ = _10_valueOrError6
   519  		var _out1 m_Wrappers.Result
   520  		_ = _out1
   521  		_out1 = Companion_Default___.EncryptionContextDigest((_this).CryptoPrimitives(), (_1_materials).Dtor_encryptionContext())
   522  		_10_valueOrError6 = _out1
   523  		if (_10_valueOrError6).IsFailure() {
   524  			res = (_10_valueOrError6).PropagateFailure()
   525  			return res
   526  		}
   527  		var _11_encryptionContextDigest _dafny.Sequence
   528  		_ = _11_encryptionContextDigest
   529  		_11_encryptionContextDigest = (_10_valueOrError6).Extract().(_dafny.Sequence)
   530  		var _12_decryptClosure m_Actions.ActionWithResult
   531  		_ = _12_decryptClosure
   532  		var _nw1 *DecryptSingleAWSRSAEncryptedDataKey = New_DecryptSingleAWSRSAEncryptedDataKey_()
   533  		_ = _nw1
   534  		_nw1.Ctor__(_1_materials, m_ComAmazonawsKmsTypes.Companion_IKMSClient_.CastTo_(((_this).Client()).Dtor_value()), (_this).AwsKmsKey(), (_this).PaddingScheme(), _11_encryptionContextDigest, (_this).GrantTokens())
   535  		_12_decryptClosure = _nw1
   536  		var _13_outcome m_Wrappers.Result
   537  		_ = _13_outcome
   538  		var _out2 m_Wrappers.Result
   539  		_ = _out2
   540  		_out2 = m_Actions.Companion_Default___.ReduceToSuccess(_12_decryptClosure, _7_edksToAttempt)
   541  		_13_outcome = _out2
   542  		var _14_valueOrError7 m_Wrappers.Result = m_Wrappers.Result{}
   543  		_ = _14_valueOrError7
   544  		_14_valueOrError7 = (_13_outcome).MapFailure(func(coer98 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
   545  			return func(arg99 interface{}) interface{} {
   546  				return coer98(arg99.(_dafny.Sequence))
   547  			}
   548  		}(func(_15_errors _dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error {
   549  			return 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`."))
   550  		}))
   551  		if (_14_valueOrError7).IsFailure() {
   552  			res = (_14_valueOrError7).PropagateFailure()
   553  			return res
   554  		}
   555  		var _16_SealedDecryptionMaterials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   556  		_ = _16_SealedDecryptionMaterials
   557  		_16_SealedDecryptionMaterials = (_14_valueOrError7).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)
   558  		res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_16_SealedDecryptionMaterials))
   559  		return res
   560  		return res
   561  	}
   562  }
   563  func (_this *AwsKmsRsaKeyring) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
   564  	{
   565  		return _this._cryptoPrimitives
   566  	}
   567  }
   568  func (_this *AwsKmsRsaKeyring) Client() m_Wrappers.Option {
   569  	{
   570  		return _this._client
   571  	}
   572  }
   573  func (_this *AwsKmsRsaKeyring) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec {
   574  	{
   575  		return _this._paddingScheme
   576  	}
   577  }
   578  func (_this *AwsKmsRsaKeyring) AwsKmsKey() _dafny.Sequence {
   579  	{
   580  		return _this._awsKmsKey
   581  	}
   582  }
   583  func (_this *AwsKmsRsaKeyring) PublicKey() m_Wrappers.Option {
   584  	{
   585  		return _this._publicKey
   586  	}
   587  }
   588  func (_this *AwsKmsRsaKeyring) AwsKmsArn() m_AwsArnParsing.AwsKmsIdentifier {
   589  	{
   590  		return _this._awsKmsArn
   591  	}
   592  }
   593  func (_this *AwsKmsRsaKeyring) GrantTokens() _dafny.Sequence {
   594  	{
   595  		return _this._grantTokens
   596  	}
   597  }
   598  
   599  // End of class AwsKmsRsaKeyring
   600  
   601  // Definition of class DecryptSingleAWSRSAEncryptedDataKey
   602  type DecryptSingleAWSRSAEncryptedDataKey struct {
   603  	_materials               m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   604  	_client                  m_ComAmazonawsKmsTypes.IKMSClient
   605  	_awsKmsKey               _dafny.Sequence
   606  	_paddingScheme           m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec
   607  	_encryptionContextDigest _dafny.Sequence
   608  	_grantTokens             _dafny.Sequence
   609  }
   610  
   611  func New_DecryptSingleAWSRSAEncryptedDataKey_() *DecryptSingleAWSRSAEncryptedDataKey {
   612  	_this := DecryptSingleAWSRSAEncryptedDataKey{}
   613  
   614  	_this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{}
   615  	_this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil)
   616  	_this._awsKmsKey = _dafny.EmptySeq.SetString()
   617  	_this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default()
   618  	_this._encryptionContextDigest = _dafny.EmptySeq
   619  	_this._grantTokens = _dafny.EmptySeq
   620  	return &_this
   621  }
   622  
   623  type CompanionStruct_DecryptSingleAWSRSAEncryptedDataKey_ struct {
   624  }
   625  
   626  var Companion_DecryptSingleAWSRSAEncryptedDataKey_ = CompanionStruct_DecryptSingleAWSRSAEncryptedDataKey_{}
   627  
   628  func (_this *DecryptSingleAWSRSAEncryptedDataKey) Equals(other *DecryptSingleAWSRSAEncryptedDataKey) bool {
   629  	return _this == other
   630  }
   631  
   632  func (_this *DecryptSingleAWSRSAEncryptedDataKey) EqualsGeneric(x interface{}) bool {
   633  	other, ok := x.(*DecryptSingleAWSRSAEncryptedDataKey)
   634  	return ok && _this.Equals(other)
   635  }
   636  
   637  func (*DecryptSingleAWSRSAEncryptedDataKey) String() string {
   638  	return "AwsKmsRsaKeyring.DecryptSingleAWSRSAEncryptedDataKey"
   639  }
   640  
   641  func Type_DecryptSingleAWSRSAEncryptedDataKey_() _dafny.TypeDescriptor {
   642  	return type_DecryptSingleAWSRSAEncryptedDataKey_{}
   643  }
   644  
   645  type type_DecryptSingleAWSRSAEncryptedDataKey_ struct {
   646  }
   647  
   648  func (_this type_DecryptSingleAWSRSAEncryptedDataKey_) Default() interface{} {
   649  	return (*DecryptSingleAWSRSAEncryptedDataKey)(nil)
   650  }
   651  
   652  func (_this type_DecryptSingleAWSRSAEncryptedDataKey_) String() string {
   653  	return "AwsKmsRsaKeyring.DecryptSingleAWSRSAEncryptedDataKey"
   654  }
   655  func (_this *DecryptSingleAWSRSAEncryptedDataKey) ParentTraits_() []*_dafny.TraitID {
   656  	return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
   657  }
   658  
   659  var _ m_Actions.ActionWithResult = &DecryptSingleAWSRSAEncryptedDataKey{}
   660  var _ m_Actions.Action = &DecryptSingleAWSRSAEncryptedDataKey{}
   661  var _ _dafny.TraitOffspring = &DecryptSingleAWSRSAEncryptedDataKey{}
   662  
   663  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) {
   664  	{
   665  		(_this)._materials = materials
   666  		(_this)._client = client
   667  		(_this)._awsKmsKey = awsKmsKey
   668  		(_this)._paddingScheme = paddingScheme
   669  		(_this)._encryptionContextDigest = encryptionContextDigest
   670  		(_this)._grantTokens = grantTokens
   671  	}
   672  }
   673  func (_this *DecryptSingleAWSRSAEncryptedDataKey) Invoke(edk interface{}) interface{} {
   674  	{
   675  		var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey)
   676  		_ = edk
   677  		var res m_Wrappers.Result = m_Wrappers.Result{}
   678  		_ = res
   679  		var _0_unwrap *KmsRsaUnwrapKeyMaterial
   680  		_ = _0_unwrap
   681  		var _nw0 *KmsRsaUnwrapKeyMaterial = New_KmsRsaUnwrapKeyMaterial_()
   682  		_ = _nw0
   683  		_nw0.Ctor__((_this).Client(), (_this).AwsKmsKey(), (_this).PaddingScheme(), (_this).EncryptionContextDigest(), (_this).GrantTokens())
   684  		_0_unwrap = _nw0
   685  		var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(Companion_KmsRsaUnwrapInfo_.Default()))
   686  		_ = _1_valueOrError0
   687  		var _out0 m_Wrappers.Result
   688  		_ = _out0
   689  		_out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial((edk).Dtor_ciphertext(), (_this).Materials(), _0_unwrap)
   690  		_1_valueOrError0 = _out0
   691  		if (_1_valueOrError0).IsFailure() {
   692  			res = (_1_valueOrError0).PropagateFailure()
   693  			return res
   694  		}
   695  		var _2_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput
   696  		_ = _2_unwrapOutput
   697  		_2_unwrapOutput = (_1_valueOrError0).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput)
   698  		var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{}
   699  		_ = _3_valueOrError1
   700  		_3_valueOrError1 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_2_unwrapOutput).Dtor_plaintextDataKey(), (_2_unwrapOutput).Dtor_symmetricSigningKey())
   701  		if (_3_valueOrError1).IsFailure() {
   702  			res = (_3_valueOrError1).PropagateFailure()
   703  			return res
   704  		}
   705  		var _4_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials
   706  		_ = _4_result
   707  		_4_result = (_3_valueOrError1).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials)
   708  		res = m_Wrappers.Companion_Result_.Create_Success_(_4_result)
   709  		return res
   710  		return res
   711  	}
   712  }
   713  func (_this *DecryptSingleAWSRSAEncryptedDataKey) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials {
   714  	{
   715  		return _this._materials
   716  	}
   717  }
   718  func (_this *DecryptSingleAWSRSAEncryptedDataKey) Client() m_ComAmazonawsKmsTypes.IKMSClient {
   719  	{
   720  		return _this._client
   721  	}
   722  }
   723  func (_this *DecryptSingleAWSRSAEncryptedDataKey) AwsKmsKey() _dafny.Sequence {
   724  	{
   725  		return _this._awsKmsKey
   726  	}
   727  }
   728  func (_this *DecryptSingleAWSRSAEncryptedDataKey) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec {
   729  	{
   730  		return _this._paddingScheme
   731  	}
   732  }
   733  func (_this *DecryptSingleAWSRSAEncryptedDataKey) EncryptionContextDigest() _dafny.Sequence {
   734  	{
   735  		return _this._encryptionContextDigest
   736  	}
   737  }
   738  func (_this *DecryptSingleAWSRSAEncryptedDataKey) GrantTokens() _dafny.Sequence {
   739  	{
   740  		return _this._grantTokens
   741  	}
   742  }
   743  
   744  // End of class DecryptSingleAWSRSAEncryptedDataKey
   745  
   746  // Definition of datatype KmsRsaUnwrapInfo
   747  type KmsRsaUnwrapInfo struct {
   748  	Data_KmsRsaUnwrapInfo_
   749  }
   750  
   751  func (_this KmsRsaUnwrapInfo) Get_() Data_KmsRsaUnwrapInfo_ {
   752  	return _this.Data_KmsRsaUnwrapInfo_
   753  }
   754  
   755  type Data_KmsRsaUnwrapInfo_ interface {
   756  	isKmsRsaUnwrapInfo()
   757  }
   758  
   759  type CompanionStruct_KmsRsaUnwrapInfo_ struct {
   760  }
   761  
   762  var Companion_KmsRsaUnwrapInfo_ = CompanionStruct_KmsRsaUnwrapInfo_{}
   763  
   764  type KmsRsaUnwrapInfo_KmsRsaUnwrapInfo struct {
   765  }
   766  
   767  func (KmsRsaUnwrapInfo_KmsRsaUnwrapInfo) isKmsRsaUnwrapInfo() {}
   768  
   769  func (CompanionStruct_KmsRsaUnwrapInfo_) Create_KmsRsaUnwrapInfo_() KmsRsaUnwrapInfo {
   770  	return KmsRsaUnwrapInfo{KmsRsaUnwrapInfo_KmsRsaUnwrapInfo{}}
   771  }
   772  
   773  func (_this KmsRsaUnwrapInfo) Is_KmsRsaUnwrapInfo() bool {
   774  	_, ok := _this.Get_().(KmsRsaUnwrapInfo_KmsRsaUnwrapInfo)
   775  	return ok
   776  }
   777  
   778  func (CompanionStruct_KmsRsaUnwrapInfo_) Default() KmsRsaUnwrapInfo {
   779  	return Companion_KmsRsaUnwrapInfo_.Create_KmsRsaUnwrapInfo_()
   780  }
   781  
   782  func (_ CompanionStruct_KmsRsaUnwrapInfo_) AllSingletonConstructors() _dafny.Iterator {
   783  	i := -1
   784  	return func() (interface{}, bool) {
   785  		i++
   786  		switch i {
   787  		case 0:
   788  			return Companion_KmsRsaUnwrapInfo_.Create_KmsRsaUnwrapInfo_(), true
   789  		default:
   790  			return KmsRsaUnwrapInfo{}, false
   791  		}
   792  	}
   793  }
   794  
   795  func (_this KmsRsaUnwrapInfo) String() string {
   796  	switch _this.Get_().(type) {
   797  	case nil:
   798  		return "null"
   799  	case KmsRsaUnwrapInfo_KmsRsaUnwrapInfo:
   800  		{
   801  			return "AwsKmsRsaKeyring.KmsRsaUnwrapInfo.KmsRsaUnwrapInfo"
   802  		}
   803  	default:
   804  		{
   805  			return "<unexpected>"
   806  		}
   807  	}
   808  }
   809  
   810  func (_this KmsRsaUnwrapInfo) Equals(other KmsRsaUnwrapInfo) bool {
   811  	switch _this.Get_().(type) {
   812  	case KmsRsaUnwrapInfo_KmsRsaUnwrapInfo:
   813  		{
   814  			_, ok := other.Get_().(KmsRsaUnwrapInfo_KmsRsaUnwrapInfo)
   815  			return ok
   816  		}
   817  	default:
   818  		{
   819  			return false // unexpected
   820  		}
   821  	}
   822  }
   823  
   824  func (_this KmsRsaUnwrapInfo) EqualsGeneric(other interface{}) bool {
   825  	typed, ok := other.(KmsRsaUnwrapInfo)
   826  	return ok && _this.Equals(typed)
   827  }
   828  
   829  func Type_KmsRsaUnwrapInfo_() _dafny.TypeDescriptor {
   830  	return type_KmsRsaUnwrapInfo_{}
   831  }
   832  
   833  type type_KmsRsaUnwrapInfo_ struct {
   834  }
   835  
   836  func (_this type_KmsRsaUnwrapInfo_) Default() interface{} {
   837  	return Companion_KmsRsaUnwrapInfo_.Default()
   838  }
   839  
   840  func (_this type_KmsRsaUnwrapInfo_) String() string {
   841  	return "AwsKmsRsaKeyring.KmsRsaUnwrapInfo"
   842  }
   843  func (_this KmsRsaUnwrapInfo) ParentTraits_() []*_dafny.TraitID {
   844  	return [](*_dafny.TraitID){}
   845  }
   846  
   847  var _ _dafny.TraitOffspring = KmsRsaUnwrapInfo{}
   848  
   849  // End of datatype KmsRsaUnwrapInfo
   850  
   851  // Definition of datatype KmsRsaWrapInfo
   852  type KmsRsaWrapInfo struct {
   853  	Data_KmsRsaWrapInfo_
   854  }
   855  
   856  func (_this KmsRsaWrapInfo) Get_() Data_KmsRsaWrapInfo_ {
   857  	return _this.Data_KmsRsaWrapInfo_
   858  }
   859  
   860  type Data_KmsRsaWrapInfo_ interface {
   861  	isKmsRsaWrapInfo()
   862  }
   863  
   864  type CompanionStruct_KmsRsaWrapInfo_ struct {
   865  }
   866  
   867  var Companion_KmsRsaWrapInfo_ = CompanionStruct_KmsRsaWrapInfo_{}
   868  
   869  type KmsRsaWrapInfo_KmsRsaWrapInfo struct {
   870  }
   871  
   872  func (KmsRsaWrapInfo_KmsRsaWrapInfo) isKmsRsaWrapInfo() {}
   873  
   874  func (CompanionStruct_KmsRsaWrapInfo_) Create_KmsRsaWrapInfo_() KmsRsaWrapInfo {
   875  	return KmsRsaWrapInfo{KmsRsaWrapInfo_KmsRsaWrapInfo{}}
   876  }
   877  
   878  func (_this KmsRsaWrapInfo) Is_KmsRsaWrapInfo() bool {
   879  	_, ok := _this.Get_().(KmsRsaWrapInfo_KmsRsaWrapInfo)
   880  	return ok
   881  }
   882  
   883  func (CompanionStruct_KmsRsaWrapInfo_) Default() KmsRsaWrapInfo {
   884  	return Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_()
   885  }
   886  
   887  func (_ CompanionStruct_KmsRsaWrapInfo_) AllSingletonConstructors() _dafny.Iterator {
   888  	i := -1
   889  	return func() (interface{}, bool) {
   890  		i++
   891  		switch i {
   892  		case 0:
   893  			return Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_(), true
   894  		default:
   895  			return KmsRsaWrapInfo{}, false
   896  		}
   897  	}
   898  }
   899  
   900  func (_this KmsRsaWrapInfo) String() string {
   901  	switch _this.Get_().(type) {
   902  	case nil:
   903  		return "null"
   904  	case KmsRsaWrapInfo_KmsRsaWrapInfo:
   905  		{
   906  			return "AwsKmsRsaKeyring.KmsRsaWrapInfo.KmsRsaWrapInfo"
   907  		}
   908  	default:
   909  		{
   910  			return "<unexpected>"
   911  		}
   912  	}
   913  }
   914  
   915  func (_this KmsRsaWrapInfo) Equals(other KmsRsaWrapInfo) bool {
   916  	switch _this.Get_().(type) {
   917  	case KmsRsaWrapInfo_KmsRsaWrapInfo:
   918  		{
   919  			_, ok := other.Get_().(KmsRsaWrapInfo_KmsRsaWrapInfo)
   920  			return ok
   921  		}
   922  	default:
   923  		{
   924  			return false // unexpected
   925  		}
   926  	}
   927  }
   928  
   929  func (_this KmsRsaWrapInfo) EqualsGeneric(other interface{}) bool {
   930  	typed, ok := other.(KmsRsaWrapInfo)
   931  	return ok && _this.Equals(typed)
   932  }
   933  
   934  func Type_KmsRsaWrapInfo_() _dafny.TypeDescriptor {
   935  	return type_KmsRsaWrapInfo_{}
   936  }
   937  
   938  type type_KmsRsaWrapInfo_ struct {
   939  }
   940  
   941  func (_this type_KmsRsaWrapInfo_) Default() interface{} {
   942  	return Companion_KmsRsaWrapInfo_.Default()
   943  }
   944  
   945  func (_this type_KmsRsaWrapInfo_) String() string {
   946  	return "AwsKmsRsaKeyring.KmsRsaWrapInfo"
   947  }
   948  func (_this KmsRsaWrapInfo) ParentTraits_() []*_dafny.TraitID {
   949  	return [](*_dafny.TraitID){}
   950  }
   951  
   952  var _ _dafny.TraitOffspring = KmsRsaWrapInfo{}
   953  
   954  // End of datatype KmsRsaWrapInfo
   955  
   956  // Definition of class KmsRsaGenerateAndWrapKeyMaterial
   957  type KmsRsaGenerateAndWrapKeyMaterial struct {
   958  	_publicKey        _dafny.Sequence
   959  	_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient
   960  	_paddingScheme    m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec
   961  }
   962  
   963  func New_KmsRsaGenerateAndWrapKeyMaterial_() *KmsRsaGenerateAndWrapKeyMaterial {
   964  	_this := KmsRsaGenerateAndWrapKeyMaterial{}
   965  
   966  	_this._publicKey = _dafny.EmptySeq
   967  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
   968  	_this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default()
   969  	return &_this
   970  }
   971  
   972  type CompanionStruct_KmsRsaGenerateAndWrapKeyMaterial_ struct {
   973  }
   974  
   975  var Companion_KmsRsaGenerateAndWrapKeyMaterial_ = CompanionStruct_KmsRsaGenerateAndWrapKeyMaterial_{}
   976  
   977  func (_this *KmsRsaGenerateAndWrapKeyMaterial) Equals(other *KmsRsaGenerateAndWrapKeyMaterial) bool {
   978  	return _this == other
   979  }
   980  
   981  func (_this *KmsRsaGenerateAndWrapKeyMaterial) EqualsGeneric(x interface{}) bool {
   982  	other, ok := x.(*KmsRsaGenerateAndWrapKeyMaterial)
   983  	return ok && _this.Equals(other)
   984  }
   985  
   986  func (*KmsRsaGenerateAndWrapKeyMaterial) String() string {
   987  	return "AwsKmsRsaKeyring.KmsRsaGenerateAndWrapKeyMaterial"
   988  }
   989  
   990  func Type_KmsRsaGenerateAndWrapKeyMaterial_() _dafny.TypeDescriptor {
   991  	return type_KmsRsaGenerateAndWrapKeyMaterial_{}
   992  }
   993  
   994  type type_KmsRsaGenerateAndWrapKeyMaterial_ struct {
   995  }
   996  
   997  func (_this type_KmsRsaGenerateAndWrapKeyMaterial_) Default() interface{} {
   998  	return (*KmsRsaGenerateAndWrapKeyMaterial)(nil)
   999  }
  1000  
  1001  func (_this type_KmsRsaGenerateAndWrapKeyMaterial_) String() string {
  1002  	return "AwsKmsRsaKeyring.KmsRsaGenerateAndWrapKeyMaterial"
  1003  }
  1004  func (_this *KmsRsaGenerateAndWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
  1005  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_GenerateAndWrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
  1006  }
  1007  
  1008  var _ m_MaterialWrapping.GenerateAndWrapMaterial = &KmsRsaGenerateAndWrapKeyMaterial{}
  1009  var _ m_Actions.ActionWithResult = &KmsRsaGenerateAndWrapKeyMaterial{}
  1010  var _ m_Actions.Action = &KmsRsaGenerateAndWrapKeyMaterial{}
  1011  var _ _dafny.TraitOffspring = &KmsRsaGenerateAndWrapKeyMaterial{}
  1012  
  1013  func (_this *KmsRsaGenerateAndWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) {
  1014  	{
  1015  		(_this)._publicKey = publicKey
  1016  		(_this)._cryptoPrimitives = cryptoPrimitives
  1017  		(_this)._paddingScheme = paddingScheme
  1018  	}
  1019  }
  1020  func (_this *KmsRsaGenerateAndWrapKeyMaterial) Invoke(input interface{}) interface{} {
  1021  	{
  1022  		var input m_MaterialWrapping.GenerateAndWrapInput = input.(m_MaterialWrapping.GenerateAndWrapInput)
  1023  		_ = input
  1024  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default()))
  1025  		_ = res
  1026  		var _0_generateBytesResult m_Wrappers.Result
  1027  		_ = _0_generateBytesResult
  1028  		var _out0 m_Wrappers.Result
  1029  		_ = _out0
  1030  		_out0 = ((_this).CryptoPrimitives()).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength((input).Dtor_algorithmSuite())))
  1031  		_0_generateBytesResult = _out0
  1032  		var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
  1033  		_ = _1_valueOrError0
  1034  		_1_valueOrError0 = (_0_generateBytesResult).MapFailure(func(coer99 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
  1035  			return func(arg100 interface{}) interface{} {
  1036  				return coer99(arg100.(m_AwsCryptographyPrimitivesTypes.Error))
  1037  			}
  1038  		}(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
  1039  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e)
  1040  		}))
  1041  		if (_1_valueOrError0).IsFailure() {
  1042  			res = (_1_valueOrError0).PropagateFailure()
  1043  			return res
  1044  		}
  1045  		var _3_plaintextMaterial _dafny.Sequence
  1046  		_ = _3_plaintextMaterial
  1047  		_3_plaintextMaterial = (_1_valueOrError0).Extract().(_dafny.Sequence)
  1048  		var _4_wrap *KmsRsaWrapKeyMaterial
  1049  		_ = _4_wrap
  1050  		var _nw0 *KmsRsaWrapKeyMaterial = New_KmsRsaWrapKeyMaterial_()
  1051  		_ = _nw0
  1052  		_nw0.Ctor__((_this).PublicKey(), (_this).PaddingScheme(), (_this).CryptoPrimitives())
  1053  		_4_wrap = _nw0
  1054  		var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default()))
  1055  		_ = _5_valueOrError1
  1056  		var _out1 interface{}
  1057  		_ = _out1
  1058  		_out1 = (_4_wrap).Invoke(m_MaterialWrapping.Companion_WrapInput_.Create_WrapInput_(_3_plaintextMaterial, (input).Dtor_algorithmSuite(), (input).Dtor_encryptionContext()))
  1059  		_5_valueOrError1 = _out1.(m_Wrappers.Result)
  1060  		if (_5_valueOrError1).IsFailure() {
  1061  			res = (_5_valueOrError1).PropagateFailure()
  1062  			return res
  1063  		}
  1064  		var _6_wrapOutput m_MaterialWrapping.WrapOutput
  1065  		_ = _6_wrapOutput
  1066  		_6_wrapOutput = (_5_valueOrError1).Extract().(m_MaterialWrapping.WrapOutput)
  1067  		var _7_output m_MaterialWrapping.GenerateAndWrapOutput
  1068  		_ = _7_output
  1069  		_7_output = m_MaterialWrapping.Companion_GenerateAndWrapOutput_.Create_GenerateAndWrapOutput_(_3_plaintextMaterial, (_6_wrapOutput).Dtor_wrappedMaterial(), Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_())
  1070  		res = m_Wrappers.Companion_Result_.Create_Success_(_7_output)
  1071  		return res
  1072  		return res
  1073  	}
  1074  }
  1075  func (_this *KmsRsaGenerateAndWrapKeyMaterial) PublicKey() _dafny.Sequence {
  1076  	{
  1077  		return _this._publicKey
  1078  	}
  1079  }
  1080  func (_this *KmsRsaGenerateAndWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
  1081  	{
  1082  		return _this._cryptoPrimitives
  1083  	}
  1084  }
  1085  func (_this *KmsRsaGenerateAndWrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec {
  1086  	{
  1087  		return _this._paddingScheme
  1088  	}
  1089  }
  1090  
  1091  // End of class KmsRsaGenerateAndWrapKeyMaterial
  1092  
  1093  // Definition of class KmsRsaWrapKeyMaterial
  1094  type KmsRsaWrapKeyMaterial struct {
  1095  	_publicKey        _dafny.Sequence
  1096  	_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient
  1097  	_paddingScheme    m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec
  1098  }
  1099  
  1100  func New_KmsRsaWrapKeyMaterial_() *KmsRsaWrapKeyMaterial {
  1101  	_this := KmsRsaWrapKeyMaterial{}
  1102  
  1103  	_this._publicKey = _dafny.EmptySeq
  1104  	_this._cryptoPrimitives = (*m_AtomicPrimitives.AtomicPrimitivesClient)(nil)
  1105  	_this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default()
  1106  	return &_this
  1107  }
  1108  
  1109  type CompanionStruct_KmsRsaWrapKeyMaterial_ struct {
  1110  }
  1111  
  1112  var Companion_KmsRsaWrapKeyMaterial_ = CompanionStruct_KmsRsaWrapKeyMaterial_{}
  1113  
  1114  func (_this *KmsRsaWrapKeyMaterial) Equals(other *KmsRsaWrapKeyMaterial) bool {
  1115  	return _this == other
  1116  }
  1117  
  1118  func (_this *KmsRsaWrapKeyMaterial) EqualsGeneric(x interface{}) bool {
  1119  	other, ok := x.(*KmsRsaWrapKeyMaterial)
  1120  	return ok && _this.Equals(other)
  1121  }
  1122  
  1123  func (*KmsRsaWrapKeyMaterial) String() string {
  1124  	return "AwsKmsRsaKeyring.KmsRsaWrapKeyMaterial"
  1125  }
  1126  
  1127  func Type_KmsRsaWrapKeyMaterial_() _dafny.TypeDescriptor {
  1128  	return type_KmsRsaWrapKeyMaterial_{}
  1129  }
  1130  
  1131  type type_KmsRsaWrapKeyMaterial_ struct {
  1132  }
  1133  
  1134  func (_this type_KmsRsaWrapKeyMaterial_) Default() interface{} {
  1135  	return (*KmsRsaWrapKeyMaterial)(nil)
  1136  }
  1137  
  1138  func (_this type_KmsRsaWrapKeyMaterial_) String() string {
  1139  	return "AwsKmsRsaKeyring.KmsRsaWrapKeyMaterial"
  1140  }
  1141  func (_this *KmsRsaWrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
  1142  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_WrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
  1143  }
  1144  
  1145  var _ m_MaterialWrapping.WrapMaterial = &KmsRsaWrapKeyMaterial{}
  1146  var _ m_Actions.ActionWithResult = &KmsRsaWrapKeyMaterial{}
  1147  var _ m_Actions.Action = &KmsRsaWrapKeyMaterial{}
  1148  var _ _dafny.TraitOffspring = &KmsRsaWrapKeyMaterial{}
  1149  
  1150  func (_this *KmsRsaWrapKeyMaterial) Ctor__(publicKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) {
  1151  	{
  1152  		(_this)._publicKey = publicKey
  1153  		(_this)._cryptoPrimitives = cryptoPrimitives
  1154  		(_this)._paddingScheme = paddingScheme
  1155  	}
  1156  }
  1157  func (_this *KmsRsaWrapKeyMaterial) Invoke(input interface{}) interface{} {
  1158  	{
  1159  		var input m_MaterialWrapping.WrapInput = input.(m_MaterialWrapping.WrapInput)
  1160  		_ = input
  1161  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_WrapOutput_.Default(Companion_KmsRsaWrapInfo_.Default()))
  1162  		_ = res
  1163  		var _0_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
  1164  		_ = _0_valueOrError0
  1165  		var _out0 m_Wrappers.Result
  1166  		_ = _out0
  1167  		_out0 = Companion_Default___.EncryptionContextDigest((_this).CryptoPrimitives(), (input).Dtor_encryptionContext())
  1168  		_0_valueOrError0 = _out0
  1169  		if (_0_valueOrError0).IsFailure() {
  1170  			res = (_0_valueOrError0).PropagateFailure()
  1171  			return res
  1172  		}
  1173  		var _1_encryptionContextDigest _dafny.Sequence
  1174  		_ = _1_encryptionContextDigest
  1175  		_1_encryptionContextDigest = (_0_valueOrError0).Extract().(_dafny.Sequence)
  1176  		var _2_padding m_AwsCryptographyPrimitivesTypes.RSAPaddingMode
  1177  		_ = _2_padding
  1178  		var _source0 m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec = (_this).PaddingScheme()
  1179  		_ = _source0
  1180  		{
  1181  			{
  1182  				if _source0.Is_RSAES__OAEP__SHA__1() {
  1183  					_2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA1_()
  1184  					goto Lmatch0
  1185  				}
  1186  			}
  1187  			{
  1188  				_2_padding = m_AwsCryptographyPrimitivesTypes.Companion_RSAPaddingMode_.Create_OAEP__SHA256_()
  1189  			}
  1190  			goto Lmatch0
  1191  		}
  1192  	Lmatch0:
  1193  		var _3_RSAEncryptOutput m_Wrappers.Result
  1194  		_ = _3_RSAEncryptOutput
  1195  		var _out1 m_Wrappers.Result
  1196  		_ = _out1
  1197  		_out1 = ((_this).CryptoPrimitives()).RSAEncrypt(m_AwsCryptographyPrimitivesTypes.Companion_RSAEncryptInput_.Create_RSAEncryptInput_(_2_padding, (_this).PublicKey(), _dafny.Companion_Sequence_.Concatenate(_1_encryptionContextDigest, (input).Dtor_plaintextMaterial())))
  1198  		_3_RSAEncryptOutput = _out1
  1199  		var _4_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq)
  1200  		_ = _4_valueOrError1
  1201  		_4_valueOrError1 = (_3_RSAEncryptOutput).MapFailure(func(coer100 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
  1202  			return func(arg101 interface{}) interface{} {
  1203  				return coer100(arg101.(m_AwsCryptographyPrimitivesTypes.Error))
  1204  			}
  1205  		}(func(_5_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
  1206  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_5_e)
  1207  		}))
  1208  		if (_4_valueOrError1).IsFailure() {
  1209  			res = (_4_valueOrError1).PropagateFailure()
  1210  			return res
  1211  		}
  1212  		var _6_ciphertext _dafny.Sequence
  1213  		_ = _6_ciphertext
  1214  		_6_ciphertext = (_4_valueOrError1).Extract().(_dafny.Sequence)
  1215  		var _7_output m_MaterialWrapping.WrapOutput
  1216  		_ = _7_output
  1217  		_7_output = m_MaterialWrapping.Companion_WrapOutput_.Create_WrapOutput_(_6_ciphertext, Companion_KmsRsaWrapInfo_.Create_KmsRsaWrapInfo_())
  1218  		res = m_Wrappers.Companion_Result_.Create_Success_(_7_output)
  1219  		return res
  1220  		return res
  1221  	}
  1222  }
  1223  func (_this *KmsRsaWrapKeyMaterial) PublicKey() _dafny.Sequence {
  1224  	{
  1225  		return _this._publicKey
  1226  	}
  1227  }
  1228  func (_this *KmsRsaWrapKeyMaterial) CryptoPrimitives() *m_AtomicPrimitives.AtomicPrimitivesClient {
  1229  	{
  1230  		return _this._cryptoPrimitives
  1231  	}
  1232  }
  1233  func (_this *KmsRsaWrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec {
  1234  	{
  1235  		return _this._paddingScheme
  1236  	}
  1237  }
  1238  
  1239  // End of class KmsRsaWrapKeyMaterial
  1240  
  1241  // Definition of class KmsRsaUnwrapKeyMaterial
  1242  type KmsRsaUnwrapKeyMaterial struct {
  1243  	_client                  m_ComAmazonawsKmsTypes.IKMSClient
  1244  	_grantTokens             _dafny.Sequence
  1245  	_awsKmsKey               _dafny.Sequence
  1246  	_paddingScheme           m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec
  1247  	_encryptionContextDigest _dafny.Sequence
  1248  }
  1249  
  1250  func New_KmsRsaUnwrapKeyMaterial_() *KmsRsaUnwrapKeyMaterial {
  1251  	_this := KmsRsaUnwrapKeyMaterial{}
  1252  
  1253  	_this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil)
  1254  	_this._grantTokens = _dafny.EmptySeq
  1255  	_this._awsKmsKey = _dafny.EmptySeq.SetString()
  1256  	_this._paddingScheme = m_ComAmazonawsKmsTypes.Companion_EncryptionAlgorithmSpec_.Default()
  1257  	_this._encryptionContextDigest = _dafny.EmptySeq
  1258  	return &_this
  1259  }
  1260  
  1261  type CompanionStruct_KmsRsaUnwrapKeyMaterial_ struct {
  1262  }
  1263  
  1264  var Companion_KmsRsaUnwrapKeyMaterial_ = CompanionStruct_KmsRsaUnwrapKeyMaterial_{}
  1265  
  1266  func (_this *KmsRsaUnwrapKeyMaterial) Equals(other *KmsRsaUnwrapKeyMaterial) bool {
  1267  	return _this == other
  1268  }
  1269  
  1270  func (_this *KmsRsaUnwrapKeyMaterial) EqualsGeneric(x interface{}) bool {
  1271  	other, ok := x.(*KmsRsaUnwrapKeyMaterial)
  1272  	return ok && _this.Equals(other)
  1273  }
  1274  
  1275  func (*KmsRsaUnwrapKeyMaterial) String() string {
  1276  	return "AwsKmsRsaKeyring.KmsRsaUnwrapKeyMaterial"
  1277  }
  1278  
  1279  func Type_KmsRsaUnwrapKeyMaterial_() _dafny.TypeDescriptor {
  1280  	return type_KmsRsaUnwrapKeyMaterial_{}
  1281  }
  1282  
  1283  type type_KmsRsaUnwrapKeyMaterial_ struct {
  1284  }
  1285  
  1286  func (_this type_KmsRsaUnwrapKeyMaterial_) Default() interface{} {
  1287  	return (*KmsRsaUnwrapKeyMaterial)(nil)
  1288  }
  1289  
  1290  func (_this type_KmsRsaUnwrapKeyMaterial_) String() string {
  1291  	return "AwsKmsRsaKeyring.KmsRsaUnwrapKeyMaterial"
  1292  }
  1293  func (_this *KmsRsaUnwrapKeyMaterial) ParentTraits_() []*_dafny.TraitID {
  1294  	return [](*_dafny.TraitID){m_MaterialWrapping.Companion_UnwrapMaterial_.TraitID_, m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_}
  1295  }
  1296  
  1297  var _ m_MaterialWrapping.UnwrapMaterial = &KmsRsaUnwrapKeyMaterial{}
  1298  var _ m_Actions.ActionWithResult = &KmsRsaUnwrapKeyMaterial{}
  1299  var _ m_Actions.Action = &KmsRsaUnwrapKeyMaterial{}
  1300  var _ _dafny.TraitOffspring = &KmsRsaUnwrapKeyMaterial{}
  1301  
  1302  func (_this *KmsRsaUnwrapKeyMaterial) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, awsKmsKey _dafny.Sequence, paddingScheme m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec, encryptionContextDigest _dafny.Sequence, grantTokens _dafny.Sequence) {
  1303  	{
  1304  		(_this)._client = client
  1305  		(_this)._awsKmsKey = awsKmsKey
  1306  		(_this)._paddingScheme = paddingScheme
  1307  		(_this)._encryptionContextDigest = encryptionContextDigest
  1308  		(_this)._grantTokens = grantTokens
  1309  	}
  1310  }
  1311  func (_this *KmsRsaUnwrapKeyMaterial) Invoke(input interface{}) interface{} {
  1312  	{
  1313  		var input m_MaterialWrapping.UnwrapInput = input.(m_MaterialWrapping.UnwrapInput)
  1314  		_ = input
  1315  		var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_MaterialWrapping.Companion_UnwrapOutput_.Default(Companion_KmsRsaUnwrapInfo_.Default()))
  1316  		_ = res
  1317  		var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
  1318  		_ = _0_valueOrError0
  1319  		_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")))
  1320  		if (_0_valueOrError0).IsFailure() {
  1321  			res = (_0_valueOrError0).PropagateFailure()
  1322  			return res
  1323  		}
  1324  		var _1_decryptRequest m_ComAmazonawsKmsTypes.DecryptRequest
  1325  		_ = _1_decryptRequest
  1326  		_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_())
  1327  		var _2_maybeDecryptResponse m_Wrappers.Result
  1328  		_ = _2_maybeDecryptResponse
  1329  		var _out0 m_Wrappers.Result
  1330  		_ = _out0
  1331  		_out0 = ((_this).Client()).Decrypt(_1_decryptRequest)
  1332  		_2_maybeDecryptResponse = _out0
  1333  		var _3_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_ComAmazonawsKmsTypes.Companion_DecryptResponse_.Default())
  1334  		_ = _3_valueOrError1
  1335  		_3_valueOrError1 = (_2_maybeDecryptResponse).MapFailure(func(coer101 func(m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} {
  1336  			return func(arg102 interface{}) interface{} {
  1337  				return coer101(arg102.(m_ComAmazonawsKmsTypes.Error))
  1338  			}
  1339  		}(func(_4_e m_ComAmazonawsKmsTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error {
  1340  			return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_ComAmazonawsKms_(_4_e)
  1341  		}))
  1342  		if (_3_valueOrError1).IsFailure() {
  1343  			res = (_3_valueOrError1).PropagateFailure()
  1344  			return res
  1345  		}
  1346  		var _5_decryptResponse m_ComAmazonawsKmsTypes.DecryptResponse
  1347  		_ = _5_decryptResponse
  1348  		_5_decryptResponse = (_3_valueOrError1).Extract().(m_ComAmazonawsKmsTypes.DecryptResponse)
  1349  		var _6_valueOrError2 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
  1350  		_ = _6_valueOrError2
  1351  		_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")))
  1352  		if (_6_valueOrError2).IsFailure() {
  1353  			res = (_6_valueOrError2).PropagateFailure()
  1354  			return res
  1355  		}
  1356  		var _7_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default()
  1357  		_ = _7_valueOrError3
  1358  		_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.")))
  1359  		if (_7_valueOrError3).IsFailure() {
  1360  			res = (_7_valueOrError3).PropagateFailure()
  1361  			return res
  1362  		}
  1363  		var _8_output m_MaterialWrapping.UnwrapOutput
  1364  		_ = _8_output
  1365  		_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_())
  1366  		res = m_Wrappers.Companion_Result_.Create_Success_(_8_output)
  1367  		return res
  1368  		return res
  1369  	}
  1370  }
  1371  func (_this *KmsRsaUnwrapKeyMaterial) Client() m_ComAmazonawsKmsTypes.IKMSClient {
  1372  	{
  1373  		return _this._client
  1374  	}
  1375  }
  1376  func (_this *KmsRsaUnwrapKeyMaterial) GrantTokens() _dafny.Sequence {
  1377  	{
  1378  		return _this._grantTokens
  1379  	}
  1380  }
  1381  func (_this *KmsRsaUnwrapKeyMaterial) AwsKmsKey() _dafny.Sequence {
  1382  	{
  1383  		return _this._awsKmsKey
  1384  	}
  1385  }
  1386  func (_this *KmsRsaUnwrapKeyMaterial) PaddingScheme() m_ComAmazonawsKmsTypes.EncryptionAlgorithmSpec {
  1387  	{
  1388  		return _this._paddingScheme
  1389  	}
  1390  }
  1391  func (_this *KmsRsaUnwrapKeyMaterial) EncryptionContextDigest() _dafny.Sequence {
  1392  	{
  1393  		return _this._encryptionContextDigest
  1394  	}
  1395  }
  1396  
  1397  // End of class KmsRsaUnwrapKeyMaterial