github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl@v0.2.0/AwsKmsDiscoveryKeyring/AwsKmsDiscoveryKeyring.go (about) 1 // Package AwsKmsDiscoveryKeyring 2 // Dafny module AwsKmsDiscoveryKeyring compiled into Go 3 4 package AwsKmsDiscoveryKeyring 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_AwsKmsKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsKeyring" 19 m_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" 20 m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" 21 m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" 22 m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" 23 m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" 24 m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" 25 m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" 26 m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" 27 m_EdkWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/EdkWrapping" 28 m_ErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/ErrorMessages" 29 m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" 30 m_IntermediateKeyWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/IntermediateKeyWrapping" 31 m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" 32 m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" 33 m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" 34 m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" 35 m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" 36 m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" 37 m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" 38 m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" 39 m_StrictMultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/StrictMultiKeyring" 40 m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" 41 m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" 42 m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" 43 m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" 44 m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" 45 m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" 46 m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" 47 m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" 48 m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" 49 m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" 50 m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" 51 m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" 52 m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" 53 m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" 54 m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" 55 m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" 56 m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" 57 m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" 58 m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" 59 m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" 60 m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" 61 m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" 62 m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" 63 m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" 64 m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" 65 m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" 66 m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" 67 m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" 68 m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" 69 m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" 70 m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" 71 m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" 72 m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" 73 m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" 74 m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" 75 m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" 76 m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" 77 m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" 78 m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" 79 m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" 80 m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" 81 m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" 82 m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" 83 m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" 84 m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" 85 m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" 86 m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" 87 m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" 88 _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" 89 ) 90 91 var _ = os.Args 92 var _ _dafny.Dummy__ 93 var _ m__System.Dummy__ 94 var _ m_Wrappers.Dummy__ 95 var _ m_BoundedInts.Dummy__ 96 var _ m_StandardLibrary_UInt.Dummy__ 97 var _ m_StandardLibrary_Sequence.Dummy__ 98 var _ m_StandardLibrary_String.Dummy__ 99 var _ m_StandardLibrary.Dummy__ 100 var _ m_AwsCryptographyPrimitivesTypes.Dummy__ 101 var _ m_Random.Dummy__ 102 var _ m_Digest.Dummy__ 103 var _ m_WrappedHMAC.Dummy__ 104 var _ m_HKDF.Dummy__ 105 var _ m_WrappedHKDF.Dummy__ 106 var _ m_KdfCtr.Dummy__ 107 var _ m_AwsCryptographyPrimitivesOperations.Dummy__ 108 var _ m_AtomicPrimitives.Dummy__ 109 var _ m_ComAmazonawsDynamodbTypes.Dummy__ 110 var _ m_ComAmazonawsKmsTypes.Dummy__ 111 var _ m_Relations.Dummy__ 112 var _ m_Seq_MergeSort.Dummy__ 113 var _ m__Math.Dummy__ 114 var _ m_Seq.Dummy__ 115 var _ m__Unicode.Dummy__ 116 var _ m_Functions.Dummy__ 117 var _ m_Utf8EncodingForm.Dummy__ 118 var _ m_Utf16EncodingForm.Dummy__ 119 var _ m_UnicodeStrings.Dummy__ 120 var _ m_FileIO.Dummy__ 121 var _ m_GeneralInternals.Dummy__ 122 var _ m_MulInternalsNonlinear.Dummy__ 123 var _ m_MulInternals.Dummy__ 124 var _ m_Mul.Dummy__ 125 var _ m_ModInternalsNonlinear.Dummy__ 126 var _ m_DivInternalsNonlinear.Dummy__ 127 var _ m_ModInternals.Dummy__ 128 var _ m_DivInternals.Dummy__ 129 var _ m_DivMod.Dummy__ 130 var _ m_Power.Dummy__ 131 var _ m_Logarithm.Dummy__ 132 var _ m_StandardLibraryInterop.Dummy__ 133 var _ m_Streams.Dummy__ 134 var _ m_Sorting.Dummy__ 135 var _ m_HexStrings.Dummy__ 136 var _ m_GetOpt.Dummy__ 137 var _ m_FloatCompare.Dummy__ 138 var _ m_Base64.Dummy__ 139 var _ m_Base64Lemmas.Dummy__ 140 var _ m_Actions.Dummy__ 141 var _ m_AwsCryptographyKeyStoreTypes.Dummy__ 142 var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ 143 var _ m_AwsArnParsing.Dummy__ 144 var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ 145 var _ m_AwsKmsUtils.Dummy__ 146 var _ m_KeyStoreErrorMessages.Dummy__ 147 var _ m_KmsArn.Dummy__ 148 var _ m_Structure.Dummy__ 149 var _ m_KMSKeystoreOperations.Dummy__ 150 var _ m_DDBKeystoreOperations.Dummy__ 151 var _ m_CreateKeys.Dummy__ 152 var _ m_CreateKeyStoreTable.Dummy__ 153 var _ m_GetKeys.Dummy__ 154 var _ m_AwsCryptographyKeyStoreOperations.Dummy__ 155 var _ m_Com_Amazonaws_Kms.Dummy__ 156 var _ m_Com_Amazonaws_Dynamodb.Dummy__ 157 var _ m_KeyStore.Dummy__ 158 var _ m_AlgorithmSuites.Dummy__ 159 var _ m_Materials.Dummy__ 160 var _ m_Keyring.Dummy__ 161 var _ m_MultiKeyring.Dummy__ 162 var _ m_AwsKmsMrkAreUnique.Dummy__ 163 var _ m_Constants.Dummy__ 164 var _ m_MaterialWrapping.Dummy__ 165 var _ m_CanonicalEncryptionContext.Dummy__ 166 var _ m_IntermediateKeyWrapping.Dummy__ 167 var _ m_EdkWrapping.Dummy__ 168 var _ m_ErrorMessages.Dummy__ 169 var _ m_AwsKmsKeyring.Dummy__ 170 var _ m_StrictMultiKeyring.Dummy__ 171 172 type Dummy__ struct{} 173 174 // Definition of class Default__ 175 type Default__ struct { 176 dummy byte 177 } 178 179 func New_Default___() *Default__ { 180 _this := Default__{} 181 182 return &_this 183 } 184 185 type CompanionStruct_Default___ struct { 186 } 187 188 var Companion_Default___ = CompanionStruct_Default___{} 189 190 func (_this *Default__) Equals(other *Default__) bool { 191 return _this == other 192 } 193 194 func (_this *Default__) EqualsGeneric(x interface{}) bool { 195 other, ok := x.(*Default__) 196 return ok && _this.Equals(other) 197 } 198 199 func (*Default__) String() string { 200 return "AwsKmsDiscoveryKeyring.Default__" 201 } 202 func (_this *Default__) ParentTraits_() []*_dafny.TraitID { 203 return [](*_dafny.TraitID){} 204 } 205 206 var _ _dafny.TraitOffspring = &Default__{} 207 208 func (_static *CompanionStruct_Default___) DiscoveryMatch(arn m_AwsArnParsing.AwsArn, discoveryFilter m_Wrappers.Option) bool { 209 return (true) && (func() bool { 210 var _source0 m_Wrappers.Option = discoveryFilter 211 _ = _source0 212 { 213 if _source0.Is_Some() { 214 var _0_filter m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter = _source0.Get_().(m_Wrappers.Option_Some).Value.(m_AwsCryptographyMaterialProvidersTypes.DiscoveryFilter) 215 _ = _0_filter 216 return (_dafny.Companion_Sequence_.Equal((_0_filter).Dtor_partition(), (arn).Dtor_partition())) && (_dafny.Companion_Sequence_.IsPrefixOf((_0_filter).Dtor_accountIds(), _dafny.SeqOf((arn).Dtor_account()))) 217 } 218 } 219 { 220 return true 221 } 222 }()) 223 } 224 225 // End of class Default__ 226 227 // Definition of class AwsKmsDiscoveryKeyring 228 type AwsKmsDiscoveryKeyring struct { 229 _client m_ComAmazonawsKmsTypes.IKMSClient 230 _discoveryFilter m_Wrappers.Option 231 _grantTokens _dafny.Sequence 232 } 233 234 func New_AwsKmsDiscoveryKeyring_() *AwsKmsDiscoveryKeyring { 235 _this := AwsKmsDiscoveryKeyring{} 236 237 _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) 238 _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() 239 _this._grantTokens = _dafny.EmptySeq 240 return &_this 241 } 242 243 type CompanionStruct_AwsKmsDiscoveryKeyring_ struct { 244 } 245 246 var Companion_AwsKmsDiscoveryKeyring_ = CompanionStruct_AwsKmsDiscoveryKeyring_{} 247 248 func (_this *AwsKmsDiscoveryKeyring) Equals(other *AwsKmsDiscoveryKeyring) bool { 249 return _this == other 250 } 251 252 func (_this *AwsKmsDiscoveryKeyring) EqualsGeneric(x interface{}) bool { 253 other, ok := x.(*AwsKmsDiscoveryKeyring) 254 return ok && _this.Equals(other) 255 } 256 257 func (*AwsKmsDiscoveryKeyring) String() string { 258 return "AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring" 259 } 260 261 func Type_AwsKmsDiscoveryKeyring_() _dafny.TypeDescriptor { 262 return type_AwsKmsDiscoveryKeyring_{} 263 } 264 265 type type_AwsKmsDiscoveryKeyring_ struct { 266 } 267 268 func (_this type_AwsKmsDiscoveryKeyring_) Default() interface{} { 269 return (*AwsKmsDiscoveryKeyring)(nil) 270 } 271 272 func (_this type_AwsKmsDiscoveryKeyring_) String() string { 273 return "AwsKmsDiscoveryKeyring.AwsKmsDiscoveryKeyring" 274 } 275 func (_this *AwsKmsDiscoveryKeyring) ParentTraits_() []*_dafny.TraitID { 276 return [](*_dafny.TraitID){m_Keyring.Companion_VerifiableInterface_.TraitID_, m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.TraitID_} 277 } 278 279 var _ m_Keyring.VerifiableInterface = &AwsKmsDiscoveryKeyring{} 280 var _ m_AwsCryptographyMaterialProvidersTypes.IKeyring = &AwsKmsDiscoveryKeyring{} 281 var _ _dafny.TraitOffspring = &AwsKmsDiscoveryKeyring{} 282 283 func (_this *AwsKmsDiscoveryKeyring) OnDecrypt(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { 284 var _out3 m_Wrappers.Result 285 _ = _out3 286 _out3 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnDecrypt(_this, input) 287 return _out3 288 } 289 func (_this *AwsKmsDiscoveryKeyring) OnEncrypt(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { 290 var _out3 m_Wrappers.Result 291 _ = _out3 292 _out3 = m_AwsCryptographyMaterialProvidersTypes.Companion_IKeyring_.OnEncrypt(_this, input) 293 return _out3 294 } 295 func (_this *AwsKmsDiscoveryKeyring) Ctor__(client m_ComAmazonawsKmsTypes.IKMSClient, discoveryFilter m_Wrappers.Option, grantTokens _dafny.Sequence) { 296 { 297 (_this)._client = client 298 (_this)._discoveryFilter = discoveryFilter 299 (_this)._grantTokens = grantTokens 300 } 301 } 302 func (_this *AwsKmsDiscoveryKeyring) OnEncrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnEncryptInput) m_Wrappers.Result { 303 { 304 var output m_Wrappers.Result = m_Wrappers.Result{} 305 _ = output 306 output = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encryption is not supported with a Discovery Keyring."))) 307 return output 308 return output 309 } 310 } 311 func (_this *AwsKmsDiscoveryKeyring) OnDecrypt_k(input m_AwsCryptographyMaterialProvidersTypes.OnDecryptInput) m_Wrappers.Result { 312 { 313 var res m_Wrappers.Result = m_Wrappers.Result{} 314 _ = res 315 var _0_materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials 316 _ = _0_materials 317 _0_materials = (input).Dtor_materials() 318 var _1_encryptedDataKeys _dafny.Sequence 319 _ = _1_encryptedDataKeys 320 _1_encryptedDataKeys = (input).Dtor_encryptedDataKeys() 321 var _2_suite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo 322 _ = _2_suite 323 _2_suite = ((input).Dtor_materials()).Dtor_algorithmSuite() 324 var _3_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 325 _ = _3_valueOrError0 326 _3_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_Materials.Companion_Default___.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Keyring received decryption materials that already contain a plaintext data key."))) 327 if (_3_valueOrError0).IsFailure() { 328 res = (_3_valueOrError0).PropagateFailure() 329 return res 330 } 331 var _4_edkFilter *AwsKmsEncryptedDataKeyFilter 332 _ = _4_edkFilter 333 var _nw0 *AwsKmsEncryptedDataKeyFilter = New_AwsKmsEncryptedDataKeyFilter_() 334 _ = _nw0 335 _nw0.Ctor__((_this).DiscoveryFilter()) 336 _4_edkFilter = _nw0 337 var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 338 _ = _5_valueOrError1 339 var _out0 m_Wrappers.Result 340 _ = _out0 341 _out0 = m_Actions.Companion_Default___.FilterWithResult(_4_edkFilter, _1_encryptedDataKeys) 342 _5_valueOrError1 = _out0 343 if (_5_valueOrError1).IsFailure() { 344 res = (_5_valueOrError1).PropagateFailure() 345 return res 346 } 347 var _6_matchingEdks _dafny.Sequence 348 _ = _6_matchingEdks 349 _6_matchingEdks = (_5_valueOrError1).Extract().(_dafny.Sequence) 350 var _7_edkTransform *AwsKmsEncryptedDataKeyTransformer 351 _ = _7_edkTransform 352 var _nw1 *AwsKmsEncryptedDataKeyTransformer = New_AwsKmsEncryptedDataKeyTransformer_() 353 _ = _nw1 354 _nw1.Ctor__() 355 _7_edkTransform = _nw1 356 var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 357 _ = _8_valueOrError2 358 var _out1 m_Wrappers.Result 359 _ = _out1 360 _out1 = m_Actions.Companion_Default___.DeterministicFlatMapWithResult(_7_edkTransform, _6_matchingEdks) 361 _8_valueOrError2 = _out1 362 if (_8_valueOrError2).IsFailure() { 363 res = (_8_valueOrError2).PropagateFailure() 364 return res 365 } 366 var _9_edksToAttempt _dafny.Sequence 367 _ = _9_edksToAttempt 368 _9_edksToAttempt = (_8_valueOrError2).Extract().(_dafny.Sequence) 369 if (_dafny.IntOfUint32((_9_edksToAttempt).Cardinality())).Sign() == 0 { 370 var _10_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) 371 _ = _10_valueOrError3 372 _10_valueOrError3 = m_ErrorMessages.Companion_Default___.IncorrectDataKeys((input).Dtor_encryptedDataKeys(), ((input).Dtor_materials()).Dtor_algorithmSuite(), _dafny.SeqOfString("")) 373 if (_10_valueOrError3).IsFailure() { 374 res = (_10_valueOrError3).PropagateFailure() 375 return res 376 } 377 var _11_errorMessage _dafny.Sequence 378 _ = _11_errorMessage 379 _11_errorMessage = (_10_valueOrError3).Extract().(_dafny.Sequence) 380 res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_11_errorMessage)) 381 return res 382 } 383 var _12_decryptAction *AwsKmsEncryptedDataKeyDecryptor 384 _ = _12_decryptAction 385 var _nw2 *AwsKmsEncryptedDataKeyDecryptor = New_AwsKmsEncryptedDataKeyDecryptor_() 386 _ = _nw2 387 _nw2.Ctor__(_0_materials, (_this).Client(), (_this).GrantTokens()) 388 _12_decryptAction = _nw2 389 var _13_outcome m_Wrappers.Result 390 _ = _13_outcome 391 var _out2 m_Wrappers.Result 392 _ = _out2 393 _out2 = m_Actions.Companion_Default___.ReduceToSuccess(_12_decryptAction, _9_edksToAttempt) 394 _13_outcome = _out2 395 var _source0 m_Wrappers.Result = _13_outcome 396 _ = _source0 397 { 398 { 399 if _source0.Is_Success() { 400 var _14_mat m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials = _source0.Get_().(m_Wrappers.Result_Success).Value.(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) 401 _ = _14_mat 402 res = m_Wrappers.Companion_Result_.Create_Success_(m_AwsCryptographyMaterialProvidersTypes.Companion_OnDecryptOutput_.Create_OnDecryptOutput_(_14_mat)) 403 goto Lmatch0 404 } 405 } 406 { 407 var _15_errors _dafny.Sequence = _source0.Get_().(m_Wrappers.Result_Failure).Error.(_dafny.Sequence) 408 _ = _15_errors 409 res = m_Wrappers.Companion_Result_.Create_Failure_(m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_CollectionOfErrors_(_15_errors, _dafny.SeqOfString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`."))) 410 } 411 goto Lmatch0 412 } 413 Lmatch0: 414 return res 415 return res 416 } 417 } 418 func (_this *AwsKmsDiscoveryKeyring) Client() m_ComAmazonawsKmsTypes.IKMSClient { 419 { 420 return _this._client 421 } 422 } 423 func (_this *AwsKmsDiscoveryKeyring) DiscoveryFilter() m_Wrappers.Option { 424 { 425 return _this._discoveryFilter 426 } 427 } 428 func (_this *AwsKmsDiscoveryKeyring) GrantTokens() _dafny.Sequence { 429 { 430 return _this._grantTokens 431 } 432 } 433 434 // End of class AwsKmsDiscoveryKeyring 435 436 // Definition of class AwsKmsEncryptedDataKeyFilter 437 type AwsKmsEncryptedDataKeyFilter struct { 438 _discoveryFilter m_Wrappers.Option 439 } 440 441 func New_AwsKmsEncryptedDataKeyFilter_() *AwsKmsEncryptedDataKeyFilter { 442 _this := AwsKmsEncryptedDataKeyFilter{} 443 444 _this._discoveryFilter = m_Wrappers.Companion_Option_.Default() 445 return &_this 446 } 447 448 type CompanionStruct_AwsKmsEncryptedDataKeyFilter_ struct { 449 } 450 451 var Companion_AwsKmsEncryptedDataKeyFilter_ = CompanionStruct_AwsKmsEncryptedDataKeyFilter_{} 452 453 func (_this *AwsKmsEncryptedDataKeyFilter) Equals(other *AwsKmsEncryptedDataKeyFilter) bool { 454 return _this == other 455 } 456 457 func (_this *AwsKmsEncryptedDataKeyFilter) EqualsGeneric(x interface{}) bool { 458 other, ok := x.(*AwsKmsEncryptedDataKeyFilter) 459 return ok && _this.Equals(other) 460 } 461 462 func (*AwsKmsEncryptedDataKeyFilter) String() string { 463 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyFilter" 464 } 465 466 func Type_AwsKmsEncryptedDataKeyFilter_() _dafny.TypeDescriptor { 467 return type_AwsKmsEncryptedDataKeyFilter_{} 468 } 469 470 type type_AwsKmsEncryptedDataKeyFilter_ struct { 471 } 472 473 func (_this type_AwsKmsEncryptedDataKeyFilter_) Default() interface{} { 474 return (*AwsKmsEncryptedDataKeyFilter)(nil) 475 } 476 477 func (_this type_AwsKmsEncryptedDataKeyFilter_) String() string { 478 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyFilter" 479 } 480 func (_this *AwsKmsEncryptedDataKeyFilter) ParentTraits_() []*_dafny.TraitID { 481 return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} 482 } 483 484 var _ m_Actions.DeterministicActionWithResult = &AwsKmsEncryptedDataKeyFilter{} 485 var _ m_Actions.DeterministicAction = &AwsKmsEncryptedDataKeyFilter{} 486 var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyFilter{} 487 488 func (_this *AwsKmsEncryptedDataKeyFilter) Ctor__(discoveryFilter m_Wrappers.Option) { 489 { 490 (_this)._discoveryFilter = discoveryFilter 491 } 492 } 493 func (_this *AwsKmsEncryptedDataKeyFilter) Invoke(edk interface{}) interface{} { 494 { 495 var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) 496 _ = edk 497 var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(false) 498 _ = output 499 var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 500 _ = _0_valueOrError0 501 _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) 502 if (_0_valueOrError0).IsFailure() { 503 output = (_0_valueOrError0).PropagateFailure() 504 return output 505 } 506 var _1_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) 507 _ = _1_valueOrError1 508 _1_valueOrError1 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer63 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 509 return func(arg64 interface{}) interface{} { 510 return coer63(arg64.(_dafny.Sequence)) 511 } 512 }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) 513 if (_1_valueOrError1).IsFailure() { 514 output = (_1_valueOrError1).PropagateFailure() 515 return output 516 } 517 var _2_keyId _dafny.Sequence 518 _ = _2_keyId 519 _2_keyId = (_1_valueOrError1).Extract().(_dafny.Sequence) 520 var _3_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} 521 _ = _3_valueOrError2 522 _3_valueOrError2 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_2_keyId)).MapFailure(func(coer64 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 523 return func(arg65 interface{}) interface{} { 524 return coer64(arg65.(_dafny.Sequence)) 525 } 526 }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) 527 if (_3_valueOrError2).IsFailure() { 528 output = (_3_valueOrError2).PropagateFailure() 529 return output 530 } 531 var _4_arn m_AwsArnParsing.AwsArn 532 _ = _4_arn 533 _4_arn = (_3_valueOrError2).Extract().(m_AwsArnParsing.AwsArn) 534 var _5_valueOrError3 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 535 _ = _5_valueOrError3 536 _5_valueOrError3 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal(((_4_arn).Dtor_resource()).Dtor_resourceType(), _dafny.SeqOfString("key")), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Only AWS KMS Keys supported"))) 537 if (_5_valueOrError3).IsFailure() { 538 output = (_5_valueOrError3).PropagateFailure() 539 return output 540 } 541 if !_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()) { 542 output = m_Wrappers.Companion_Result_.Create_Success_(false) 543 return output 544 } 545 if !(Companion_Default___.DiscoveryMatch(_4_arn, (_this).DiscoveryFilter())) { 546 output = m_Wrappers.Companion_Result_.Create_Success_(false) 547 return output 548 } 549 output = m_Wrappers.Companion_Result_.Create_Success_(true) 550 return output 551 return output 552 } 553 } 554 func (_this *AwsKmsEncryptedDataKeyFilter) DiscoveryFilter() m_Wrappers.Option { 555 { 556 return _this._discoveryFilter 557 } 558 } 559 560 // End of class AwsKmsEncryptedDataKeyFilter 561 562 // Definition of class AwsKmsEncryptedDataKeyTransformer 563 type AwsKmsEncryptedDataKeyTransformer struct { 564 dummy byte 565 } 566 567 func New_AwsKmsEncryptedDataKeyTransformer_() *AwsKmsEncryptedDataKeyTransformer { 568 _this := AwsKmsEncryptedDataKeyTransformer{} 569 570 return &_this 571 } 572 573 type CompanionStruct_AwsKmsEncryptedDataKeyTransformer_ struct { 574 } 575 576 var Companion_AwsKmsEncryptedDataKeyTransformer_ = CompanionStruct_AwsKmsEncryptedDataKeyTransformer_{} 577 578 func (_this *AwsKmsEncryptedDataKeyTransformer) Equals(other *AwsKmsEncryptedDataKeyTransformer) bool { 579 return _this == other 580 } 581 582 func (_this *AwsKmsEncryptedDataKeyTransformer) EqualsGeneric(x interface{}) bool { 583 other, ok := x.(*AwsKmsEncryptedDataKeyTransformer) 584 return ok && _this.Equals(other) 585 } 586 587 func (*AwsKmsEncryptedDataKeyTransformer) String() string { 588 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyTransformer" 589 } 590 591 func Type_AwsKmsEncryptedDataKeyTransformer_() _dafny.TypeDescriptor { 592 return type_AwsKmsEncryptedDataKeyTransformer_{} 593 } 594 595 type type_AwsKmsEncryptedDataKeyTransformer_ struct { 596 } 597 598 func (_this type_AwsKmsEncryptedDataKeyTransformer_) Default() interface{} { 599 return (*AwsKmsEncryptedDataKeyTransformer)(nil) 600 } 601 602 func (_this type_AwsKmsEncryptedDataKeyTransformer_) String() string { 603 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyTransformer" 604 } 605 func (_this *AwsKmsEncryptedDataKeyTransformer) ParentTraits_() []*_dafny.TraitID { 606 return [](*_dafny.TraitID){m_Actions.Companion_DeterministicActionWithResult_.TraitID_, m_Actions.Companion_DeterministicAction_.TraitID_} 607 } 608 609 var _ m_Actions.DeterministicActionWithResult = &AwsKmsEncryptedDataKeyTransformer{} 610 var _ m_Actions.DeterministicAction = &AwsKmsEncryptedDataKeyTransformer{} 611 var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyTransformer{} 612 613 func (_this *AwsKmsEncryptedDataKeyTransformer) Ctor__() { 614 { 615 } 616 } 617 func (_this *AwsKmsEncryptedDataKeyTransformer) Invoke(edk interface{}) interface{} { 618 { 619 var edk m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey = edk.(m_AwsCryptographyMaterialProvidersTypes.EncryptedDataKey) 620 _ = edk 621 var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 622 _ = res 623 var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 624 _ = _0_valueOrError0 625 _0_valueOrError0 = m_Wrappers.Companion_Default___.Need(_dafny.Companion_Sequence_.Equal((edk).Dtor_keyProviderId(), m_Constants.Companion_Default___.PROVIDER__ID()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Encrypted data key was not generated by KMS"))) 626 if (_0_valueOrError0).IsFailure() { 627 res = (_0_valueOrError0).PropagateFailure() 628 return res 629 } 630 var _1_valueOrError1 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 631 _ = _1_valueOrError1 632 _1_valueOrError1 = m_Wrappers.Companion_Default___.Need(m_UTF8.Companion_Default___.ValidUTF8Seq((edk).Dtor_keyProviderInfo()), m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Invalid AWS KMS encoding, provider info is not UTF8."))) 633 if (_1_valueOrError1).IsFailure() { 634 res = (_1_valueOrError1).PropagateFailure() 635 return res 636 } 637 var _2_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq.SetString()) 638 _ = _2_valueOrError2 639 _2_valueOrError2 = (m_UTF8.Decode((edk).Dtor_keyProviderInfo())).MapFailure(func(coer65 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 640 return func(arg66 interface{}) interface{} { 641 return coer65(arg66.(_dafny.Sequence)) 642 } 643 }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) 644 if (_2_valueOrError2).IsFailure() { 645 res = (_2_valueOrError2).PropagateFailure() 646 return res 647 } 648 var _3_keyId _dafny.Sequence 649 _ = _3_keyId 650 _3_keyId = (_2_valueOrError2).Extract().(_dafny.Sequence) 651 var _4_valueOrError3 m_Wrappers.Result = m_Wrappers.Result{} 652 _ = _4_valueOrError3 653 _4_valueOrError3 = (m_AwsArnParsing.Companion_Default___.ParseAwsKmsArn(_3_keyId)).MapFailure(func(coer66 func(_dafny.Sequence) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 654 return func(arg67 interface{}) interface{} { 655 return coer66(arg67.(_dafny.Sequence)) 656 } 657 }(m_AwsKmsUtils.Companion_Default___.WrapStringToError)) 658 if (_4_valueOrError3).IsFailure() { 659 res = (_4_valueOrError3).PropagateFailure() 660 return res 661 } 662 var _5_arn m_AwsArnParsing.AwsArn 663 _ = _5_arn 664 _5_arn = (_4_valueOrError3).Extract().(m_AwsArnParsing.AwsArn) 665 res = m_Wrappers.Companion_Result_.Create_Success_(_dafny.SeqOf(m_Constants.Companion_AwsKmsEdkHelper_.Create_AwsKmsEdkHelper_(edk, _5_arn))) 666 return res 667 return res 668 } 669 } 670 671 // End of class AwsKmsEncryptedDataKeyTransformer 672 673 // Definition of class AwsKmsEncryptedDataKeyDecryptor 674 type AwsKmsEncryptedDataKeyDecryptor struct { 675 _materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials 676 _client m_ComAmazonawsKmsTypes.IKMSClient 677 _grantTokens _dafny.Sequence 678 } 679 680 func New_AwsKmsEncryptedDataKeyDecryptor_() *AwsKmsEncryptedDataKeyDecryptor { 681 _this := AwsKmsEncryptedDataKeyDecryptor{} 682 683 _this._materials = m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials{} 684 _this._client = (m_ComAmazonawsKmsTypes.IKMSClient)(nil) 685 _this._grantTokens = _dafny.EmptySeq 686 return &_this 687 } 688 689 type CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_ struct { 690 } 691 692 var Companion_AwsKmsEncryptedDataKeyDecryptor_ = CompanionStruct_AwsKmsEncryptedDataKeyDecryptor_{} 693 694 func (_this *AwsKmsEncryptedDataKeyDecryptor) Equals(other *AwsKmsEncryptedDataKeyDecryptor) bool { 695 return _this == other 696 } 697 698 func (_this *AwsKmsEncryptedDataKeyDecryptor) EqualsGeneric(x interface{}) bool { 699 other, ok := x.(*AwsKmsEncryptedDataKeyDecryptor) 700 return ok && _this.Equals(other) 701 } 702 703 func (*AwsKmsEncryptedDataKeyDecryptor) String() string { 704 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" 705 } 706 707 func Type_AwsKmsEncryptedDataKeyDecryptor_() _dafny.TypeDescriptor { 708 return type_AwsKmsEncryptedDataKeyDecryptor_{} 709 } 710 711 type type_AwsKmsEncryptedDataKeyDecryptor_ struct { 712 } 713 714 func (_this type_AwsKmsEncryptedDataKeyDecryptor_) Default() interface{} { 715 return (*AwsKmsEncryptedDataKeyDecryptor)(nil) 716 } 717 718 func (_this type_AwsKmsEncryptedDataKeyDecryptor_) String() string { 719 return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyDecryptor" 720 } 721 func (_this *AwsKmsEncryptedDataKeyDecryptor) ParentTraits_() []*_dafny.TraitID { 722 return [](*_dafny.TraitID){m_Actions.Companion_ActionWithResult_.TraitID_, m_Actions.Companion_Action_.TraitID_} 723 } 724 725 var _ m_Actions.ActionWithResult = &AwsKmsEncryptedDataKeyDecryptor{} 726 var _ m_Actions.Action = &AwsKmsEncryptedDataKeyDecryptor{} 727 var _ _dafny.TraitOffspring = &AwsKmsEncryptedDataKeyDecryptor{} 728 729 func (_this *AwsKmsEncryptedDataKeyDecryptor) Ctor__(materials m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials, client m_ComAmazonawsKmsTypes.IKMSClient, grantTokens _dafny.Sequence) { 730 { 731 (_this)._materials = materials 732 (_this)._client = client 733 (_this)._grantTokens = grantTokens 734 } 735 } 736 func (_this *AwsKmsEncryptedDataKeyDecryptor) Invoke(helper interface{}) interface{} { 737 { 738 var helper m_Constants.AwsKmsEdkHelper = helper.(m_Constants.AwsKmsEdkHelper) 739 _ = helper 740 var res m_Wrappers.Result = m_Wrappers.Result{} 741 _ = res 742 var _0_awsKmsKey _dafny.Sequence 743 _ = _0_awsKmsKey 744 _0_awsKmsKey = ((helper).Dtor_arn()).ToString() 745 var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.TupleOf()) 746 _ = _1_valueOrError0 747 _1_valueOrError0 = m_AwsKmsUtils.Companion_Default___.ValidateKmsKeyId(((helper).Dtor_arn()).ToString()) 748 if (_1_valueOrError0).IsFailure() { 749 res = (_1_valueOrError0).PropagateFailure() 750 return res 751 } 752 var _2___v0 _dafny.Tuple 753 _ = _2___v0 754 _2___v0 = (_1_valueOrError0).Extract().(_dafny.Tuple) 755 var _3_kmsUnwrap *m_AwsKmsKeyring.KmsUnwrapKeyMaterial 756 _ = _3_kmsUnwrap 757 var _nw0 *m_AwsKmsKeyring.KmsUnwrapKeyMaterial = m_AwsKmsKeyring.New_KmsUnwrapKeyMaterial_() 758 _ = _nw0 759 _nw0.Ctor__((_this).Client(), _0_awsKmsKey, (_this).GrantTokens()) 760 _3_kmsUnwrap = _nw0 761 var _4_unwrapOutputRes m_Wrappers.Result 762 _ = _4_unwrapOutputRes 763 var _out0 m_Wrappers.Result 764 _ = _out0 765 _out0 = m_EdkWrapping.Companion_Default___.UnwrapEdkMaterial(((helper).Dtor_edk()).Dtor_ciphertext(), (_this).Materials(), _3_kmsUnwrap) 766 _4_unwrapOutputRes = _out0 767 var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_EdkWrapping.Companion_UnwrapEdkMaterialOutput_.Default(m_AwsKmsKeyring.Companion_KmsUnwrapInfo_.Default())) 768 _ = _5_valueOrError1 769 _5_valueOrError1 = _4_unwrapOutputRes 770 if (_5_valueOrError1).IsFailure() { 771 res = (_5_valueOrError1).PropagateFailure() 772 return res 773 } 774 var _6_unwrapOutput m_EdkWrapping.UnwrapEdkMaterialOutput 775 _ = _6_unwrapOutput 776 _6_unwrapOutput = (_5_valueOrError1).Extract().(m_EdkWrapping.UnwrapEdkMaterialOutput) 777 var _7_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} 778 _ = _7_valueOrError2 779 _7_valueOrError2 = m_Materials.Companion_Default___.DecryptionMaterialsAddDataKey((_this).Materials(), (_6_unwrapOutput).Dtor_plaintextDataKey(), (_6_unwrapOutput).Dtor_symmetricSigningKey()) 780 if (_7_valueOrError2).IsFailure() { 781 res = (_7_valueOrError2).PropagateFailure() 782 return res 783 } 784 var _8_result m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials 785 _ = _8_result 786 _8_result = (_7_valueOrError2).Extract().(m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials) 787 res = m_Wrappers.Companion_Result_.Create_Success_(_8_result) 788 return res 789 return res 790 } 791 } 792 func (_this *AwsKmsEncryptedDataKeyDecryptor) Materials() m_AwsCryptographyMaterialProvidersTypes.DecryptionMaterials { 793 { 794 return _this._materials 795 } 796 } 797 func (_this *AwsKmsEncryptedDataKeyDecryptor) Client() m_ComAmazonawsKmsTypes.IKMSClient { 798 { 799 return _this._client 800 } 801 } 802 func (_this *AwsKmsEncryptedDataKeyDecryptor) GrantTokens() _dafny.Sequence { 803 { 804 return _this._grantTokens 805 } 806 } 807 808 // End of class AwsKmsEncryptedDataKeyDecryptor