github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl@v0.2.0/IntermediateKeyWrapping/IntermediateKeyWrapping.go (about) 1 // Package IntermediateKeyWrapping 2 // Dafny module IntermediateKeyWrapping compiled into Go 3 4 package IntermediateKeyWrapping 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_AwsKmsMrkAreUnique "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkAreUnique" 19 m_AwsKmsMrkMatchForDecrypt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsMrkMatchForDecrypt" 20 m_AwsKmsUtils "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/AwsKmsUtils" 21 m_CanonicalEncryptionContext "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CanonicalEncryptionContext" 22 m_Constants "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Constants" 23 m_CreateKeyStoreTable "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeyStoreTable" 24 m_CreateKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/CreateKeys" 25 m_DDBKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/DDBKeystoreOperations" 26 m_GetKeys "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/GetKeys" 27 m_KMSKeystoreOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KMSKeystoreOperations" 28 m_KeyStore "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStore" 29 m_KeyStoreErrorMessages "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KeyStoreErrorMessages" 30 m_Keyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Keyring" 31 m_KmsArn "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/KmsArn" 32 m_MaterialWrapping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MaterialWrapping" 33 m_Materials "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Materials" 34 m_MultiKeyring "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/MultiKeyring" 35 m_Structure "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/Structure" 36 m_AtomicPrimitives "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AtomicPrimitives" 37 m_AwsCryptographyPrimitivesOperations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesOperations" 38 m_AwsCryptographyPrimitivesTypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/AwsCryptographyPrimitivesTypes" 39 m_Digest "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Digest" 40 m_HKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/HKDF" 41 m_KdfCtr "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/KdfCtr" 42 m_Random "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/Random" 43 m_WrappedHKDF "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHKDF" 44 m_WrappedHMAC "github.com/aws/aws-cryptographic-material-providers-library/releases/go/primitives/WrappedHMAC" 45 m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" 46 m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" 47 m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" 48 m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" 49 m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" 50 m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" 51 m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" 52 m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" 53 m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" 54 m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" 55 m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" 56 m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" 57 m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" 58 m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" 59 m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" 60 m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" 61 m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" 62 m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" 63 m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" 64 m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" 65 m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" 66 m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" 67 m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" 68 m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" 69 m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" 70 m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" 71 m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" 72 m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" 73 m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" 74 m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" 75 m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" 76 m_UTF8 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UTF8" 77 m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" 78 m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" 79 m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" 80 m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" 81 m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" 82 m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" 83 _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" 84 ) 85 86 var _ = os.Args 87 var _ _dafny.Dummy__ 88 var _ m__System.Dummy__ 89 var _ m_Wrappers.Dummy__ 90 var _ m_BoundedInts.Dummy__ 91 var _ m_StandardLibrary_UInt.Dummy__ 92 var _ m_StandardLibrary_Sequence.Dummy__ 93 var _ m_StandardLibrary_String.Dummy__ 94 var _ m_StandardLibrary.Dummy__ 95 var _ m_AwsCryptographyPrimitivesTypes.Dummy__ 96 var _ m_Random.Dummy__ 97 var _ m_Digest.Dummy__ 98 var _ m_WrappedHMAC.Dummy__ 99 var _ m_HKDF.Dummy__ 100 var _ m_WrappedHKDF.Dummy__ 101 var _ m_KdfCtr.Dummy__ 102 var _ m_AwsCryptographyPrimitivesOperations.Dummy__ 103 var _ m_AtomicPrimitives.Dummy__ 104 var _ m_ComAmazonawsDynamodbTypes.Dummy__ 105 var _ m_ComAmazonawsKmsTypes.Dummy__ 106 var _ m_Relations.Dummy__ 107 var _ m_Seq_MergeSort.Dummy__ 108 var _ m__Math.Dummy__ 109 var _ m_Seq.Dummy__ 110 var _ m__Unicode.Dummy__ 111 var _ m_Functions.Dummy__ 112 var _ m_Utf8EncodingForm.Dummy__ 113 var _ m_Utf16EncodingForm.Dummy__ 114 var _ m_UnicodeStrings.Dummy__ 115 var _ m_FileIO.Dummy__ 116 var _ m_GeneralInternals.Dummy__ 117 var _ m_MulInternalsNonlinear.Dummy__ 118 var _ m_MulInternals.Dummy__ 119 var _ m_Mul.Dummy__ 120 var _ m_ModInternalsNonlinear.Dummy__ 121 var _ m_DivInternalsNonlinear.Dummy__ 122 var _ m_ModInternals.Dummy__ 123 var _ m_DivInternals.Dummy__ 124 var _ m_DivMod.Dummy__ 125 var _ m_Power.Dummy__ 126 var _ m_Logarithm.Dummy__ 127 var _ m_StandardLibraryInterop.Dummy__ 128 var _ m_Streams.Dummy__ 129 var _ m_Sorting.Dummy__ 130 var _ m_HexStrings.Dummy__ 131 var _ m_GetOpt.Dummy__ 132 var _ m_FloatCompare.Dummy__ 133 var _ m_Base64.Dummy__ 134 var _ m_Base64Lemmas.Dummy__ 135 var _ m_Actions.Dummy__ 136 var _ m_AwsCryptographyKeyStoreTypes.Dummy__ 137 var _ m_AwsCryptographyMaterialProvidersTypes.Dummy__ 138 var _ m_AwsArnParsing.Dummy__ 139 var _ m_AwsKmsMrkMatchForDecrypt.Dummy__ 140 var _ m_AwsKmsUtils.Dummy__ 141 var _ m_KeyStoreErrorMessages.Dummy__ 142 var _ m_KmsArn.Dummy__ 143 var _ m_Structure.Dummy__ 144 var _ m_KMSKeystoreOperations.Dummy__ 145 var _ m_DDBKeystoreOperations.Dummy__ 146 var _ m_CreateKeys.Dummy__ 147 var _ m_CreateKeyStoreTable.Dummy__ 148 var _ m_GetKeys.Dummy__ 149 var _ m_AwsCryptographyKeyStoreOperations.Dummy__ 150 var _ m_Com_Amazonaws_Kms.Dummy__ 151 var _ m_Com_Amazonaws_Dynamodb.Dummy__ 152 var _ m_KeyStore.Dummy__ 153 var _ m_AlgorithmSuites.Dummy__ 154 var _ m_Materials.Dummy__ 155 var _ m_Keyring.Dummy__ 156 var _ m_MultiKeyring.Dummy__ 157 var _ m_AwsKmsMrkAreUnique.Dummy__ 158 var _ m_Constants.Dummy__ 159 var _ m_MaterialWrapping.Dummy__ 160 var _ m_CanonicalEncryptionContext.Dummy__ 161 162 type Dummy__ struct{} 163 164 // Definition of class Default__ 165 type Default__ struct { 166 dummy byte 167 } 168 169 func New_Default___() *Default__ { 170 _this := Default__{} 171 172 return &_this 173 } 174 175 type CompanionStruct_Default___ struct { 176 } 177 178 var Companion_Default___ = CompanionStruct_Default___{} 179 180 func (_this *Default__) Equals(other *Default__) bool { 181 return _this == other 182 } 183 184 func (_this *Default__) EqualsGeneric(x interface{}) bool { 185 other, ok := x.(*Default__) 186 return ok && _this.Equals(other) 187 } 188 189 func (*Default__) String() string { 190 return "IntermediateKeyWrapping.Default__" 191 } 192 func (_this *Default__) ParentTraits_() []*_dafny.TraitID { 193 return [](*_dafny.TraitID){} 194 } 195 196 var _ _dafny.TraitOffspring = &Default__{} 197 198 func (_static *CompanionStruct_Default___) IntermediateUnwrap(unwrap m_MaterialWrapping.UnwrapMaterial, wrappedMaterial _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { 199 var res m_Wrappers.Result = m_Wrappers.Result{} 200 _ = res 201 var _0_maybeCrypto m_Wrappers.Result 202 _ = _0_maybeCrypto 203 var _out0 m_Wrappers.Result 204 _ = _out0 205 _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) 206 _0_maybeCrypto = _out0 207 var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} 208 _ = _1_valueOrError0 209 _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer38 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 210 return func(arg39 interface{}) interface{} { 211 return coer38(arg39.(m_AwsCryptographyPrimitivesTypes.Error)) 212 } 213 }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 214 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) 215 })) 216 if (_1_valueOrError0).IsFailure() { 217 res = (_1_valueOrError0).PropagateFailure() 218 return res 219 } 220 var _3_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient 221 _ = _3_cryptoPrimitivesX 222 _3_cryptoPrimitivesX = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) 223 var _4_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient 224 _ = _4_cryptoPrimitives 225 _4_cryptoPrimitives = _3_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) 226 var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_DeserializedIntermediateWrappedMaterial_.Default()) 227 _ = _5_valueOrError1 228 _5_valueOrError1 = Companion_Default___.DeserializeIntermediateWrappedMaterial(wrappedMaterial, algorithmSuite) 229 if (_5_valueOrError1).IsFailure() { 230 res = (_5_valueOrError1).PropagateFailure() 231 return res 232 } 233 var _6_deserializedWrapped DeserializedIntermediateWrappedMaterial 234 _ = _6_deserializedWrapped 235 _6_deserializedWrapped = (_5_valueOrError1).Extract().(DeserializedIntermediateWrappedMaterial) 236 var _let_tmp_rhs0 DeserializedIntermediateWrappedMaterial = _6_deserializedWrapped 237 _ = _let_tmp_rhs0 238 var _7_encryptedPdk _dafny.Sequence = _let_tmp_rhs0.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).EncryptedPdk 239 _ = _7_encryptedPdk 240 var _8_providerWrappedIkm _dafny.Sequence = _let_tmp_rhs0.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).ProviderWrappedIkm 241 _ = _8_providerWrappedIkm 242 var _9_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} 243 _ = _9_valueOrError2 244 var _out1 interface{} 245 _ = _out1 246 _out1 = (unwrap).Invoke(m_MaterialWrapping.Companion_UnwrapInput_.Create_UnwrapInput_(_8_providerWrappedIkm, algorithmSuite, encryptionContext)) 247 _9_valueOrError2 = _out1.(m_Wrappers.Result) 248 if (_9_valueOrError2).IsFailure() { 249 res = (_9_valueOrError2).PropagateFailure() 250 return res 251 } 252 var _10_unwrapOutput m_MaterialWrapping.UnwrapOutput 253 _ = _10_unwrapOutput 254 _10_unwrapOutput = (_9_valueOrError2).Extract().(m_MaterialWrapping.UnwrapOutput) 255 var _let_tmp_rhs1 m_MaterialWrapping.UnwrapOutput = _10_unwrapOutput 256 _ = _let_tmp_rhs1 257 var _11_intermediateMaterial _dafny.Sequence = _let_tmp_rhs1.Get_().(m_MaterialWrapping.UnwrapOutput_UnwrapOutput).UnwrappedMaterial 258 _ = _11_intermediateMaterial 259 var _12_unwrapInfo interface{} = _let_tmp_rhs1.Get_().(m_MaterialWrapping.UnwrapOutput_UnwrapOutput).UnwrapInfo 260 _ = _12_unwrapInfo 261 var _13_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) 262 _ = _13_valueOrError3 263 var _out2 m_Wrappers.Result 264 _ = _out2 265 _out2 = Companion_Default___.DeriveKeysFromIntermediateMaterial(_11_intermediateMaterial, algorithmSuite, encryptionContext, _4_cryptoPrimitives) 266 _13_valueOrError3 = _out2 267 if (_13_valueOrError3).IsFailure() { 268 res = (_13_valueOrError3).PropagateFailure() 269 return res 270 } 271 var _14_derivedKeys PdkEncryptionAndSymmetricSigningKeys 272 _ = _14_derivedKeys 273 _14_derivedKeys = (_13_valueOrError3).Extract().(PdkEncryptionAndSymmetricSigningKeys) 274 var _let_tmp_rhs2 PdkEncryptionAndSymmetricSigningKeys = _14_derivedKeys 275 _ = _let_tmp_rhs2 276 var _15_pdkEncryptionKey _dafny.Sequence = _let_tmp_rhs2.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey 277 _ = _15_pdkEncryptionKey 278 var _16_symmetricSigningKey _dafny.Sequence = _let_tmp_rhs2.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey 279 _ = _16_symmetricSigningKey 280 var _17_iv _dafny.Sequence 281 _ = _17_iv 282 _17_iv = _dafny.SeqCreate((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptIvLength(algorithmSuite))).Uint32(), func(coer39 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { 283 return func(arg40 _dafny.Int) interface{} { 284 return coer39(arg40) 285 } 286 }(func(_18___v0 _dafny.Int) uint8 { 287 return uint8(0) 288 })) 289 var _19_tagIndex _dafny.Int 290 _ = _19_tagIndex 291 _19_tagIndex = (_dafny.IntOfUint32((_7_encryptedPdk).Cardinality())).Minus(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algorithmSuite))) 292 var _20_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 293 _ = _20_valueOrError4 294 _20_valueOrError4 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext) 295 if (_20_valueOrError4).IsFailure() { 296 res = (_20_valueOrError4).PropagateFailure() 297 return res 298 } 299 var _21_aad _dafny.Sequence 300 _ = _21_aad 301 _21_aad = (_20_valueOrError4).Extract().(_dafny.Sequence) 302 var _22_decInput m_AwsCryptographyPrimitivesTypes.AESDecryptInput 303 _ = _22_decInput 304 _22_decInput = m_AwsCryptographyPrimitivesTypes.Companion_AESDecryptInput_.Create_AESDecryptInput_(((algorithmSuite).Dtor_encrypt()).Dtor_AES__GCM(), _15_pdkEncryptionKey, (_7_encryptedPdk).Take((_19_tagIndex).Uint32()), (_7_encryptedPdk).Drop((_19_tagIndex).Uint32()), _17_iv, _21_aad) 305 var _23_decOutR m_Wrappers.Result 306 _ = _23_decOutR 307 var _out3 m_Wrappers.Result 308 _ = _out3 309 _out3 = (_4_cryptoPrimitives).AESDecrypt(_22_decInput) 310 _23_decOutR = _out3 311 var _24_valueOrError5 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 312 _ = _24_valueOrError5 313 _24_valueOrError5 = (_23_decOutR).MapFailure(func(coer40 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 314 return func(arg41 interface{}) interface{} { 315 return coer40(arg41.(m_AwsCryptographyPrimitivesTypes.Error)) 316 } 317 }(func(_25_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 318 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_25_e) 319 })) 320 if (_24_valueOrError5).IsFailure() { 321 res = (_24_valueOrError5).PropagateFailure() 322 return res 323 } 324 var _26_plaintextDataKey _dafny.Sequence 325 _ = _26_plaintextDataKey 326 _26_plaintextDataKey = (_24_valueOrError5).Extract().(_dafny.Sequence) 327 var _27_valueOrError6 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 328 _ = _27_valueOrError6 329 _27_valueOrError6 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_26_plaintextDataKey).Cardinality())).Cmp(_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unexpected AES_GCM Decrypt length"))) 330 if (_27_valueOrError6).IsFailure() { 331 res = (_27_valueOrError6).PropagateFailure() 332 return res 333 } 334 res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateUnwrapOutput_.Create_IntermediateUnwrapOutput_(_26_plaintextDataKey, _16_symmetricSigningKey, _12_unwrapInfo)) 335 return res 336 return res 337 } 338 func (_static *CompanionStruct_Default___) IntermediateWrap(generateAndWrap m_MaterialWrapping.GenerateAndWrapMaterial, plaintextDataKey _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { 339 var res m_Wrappers.Result = m_Wrappers.Result{} 340 _ = res 341 var _0_maybeCrypto m_Wrappers.Result 342 _ = _0_maybeCrypto 343 var _out0 m_Wrappers.Result 344 _ = _out0 345 _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) 346 _0_maybeCrypto = _out0 347 var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} 348 _ = _1_valueOrError0 349 _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer41 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 350 return func(arg42 interface{}) interface{} { 351 return coer41(arg42.(m_AwsCryptographyPrimitivesTypes.Error)) 352 } 353 }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 354 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) 355 })) 356 if (_1_valueOrError0).IsFailure() { 357 res = (_1_valueOrError0).PropagateFailure() 358 return res 359 } 360 var _3_cryptoPrimitivesX m_AwsCryptographyPrimitivesTypes.IAwsCryptographicPrimitivesClient 361 _ = _3_cryptoPrimitivesX 362 _3_cryptoPrimitivesX = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) 363 var _4_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient 364 _ = _4_cryptoPrimitives 365 _4_cryptoPrimitives = _3_cryptoPrimitivesX.(*m_AtomicPrimitives.AtomicPrimitivesClient) 366 var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Result{} 367 _ = _5_valueOrError1 368 var _out1 interface{} 369 _ = _out1 370 _out1 = (generateAndWrap).Invoke(m_MaterialWrapping.Companion_GenerateAndWrapInput_.Create_GenerateAndWrapInput_(algorithmSuite, encryptionContext)) 371 _5_valueOrError1 = _out1.(m_Wrappers.Result) 372 if (_5_valueOrError1).IsFailure() { 373 res = (_5_valueOrError1).PropagateFailure() 374 return res 375 } 376 var _6_generateAndWrapOutput m_MaterialWrapping.GenerateAndWrapOutput 377 _ = _6_generateAndWrapOutput 378 _6_generateAndWrapOutput = (_5_valueOrError1).Extract().(m_MaterialWrapping.GenerateAndWrapOutput) 379 var _let_tmp_rhs0 m_MaterialWrapping.GenerateAndWrapOutput = _6_generateAndWrapOutput 380 _ = _let_tmp_rhs0 381 var _7_intermediateMaterial _dafny.Sequence = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).PlaintextMaterial 382 _ = _7_intermediateMaterial 383 var _8_providerWrappedIkm _dafny.Sequence = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).WrappedMaterial 384 _ = _8_providerWrappedIkm 385 var _9_wrapInfo interface{} = _let_tmp_rhs0.Get_().(m_MaterialWrapping.GenerateAndWrapOutput_GenerateAndWrapOutput).WrapInfo 386 _ = _9_wrapInfo 387 var _10_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) 388 _ = _10_valueOrError2 389 var _out2 m_Wrappers.Result 390 _ = _out2 391 _out2 = Companion_Default___.DeriveKeysFromIntermediateMaterial(_7_intermediateMaterial, algorithmSuite, encryptionContext, _4_cryptoPrimitives) 392 _10_valueOrError2 = _out2 393 if (_10_valueOrError2).IsFailure() { 394 res = (_10_valueOrError2).PropagateFailure() 395 return res 396 } 397 var _11_derivedKeys PdkEncryptionAndSymmetricSigningKeys 398 _ = _11_derivedKeys 399 _11_derivedKeys = (_10_valueOrError2).Extract().(PdkEncryptionAndSymmetricSigningKeys) 400 var _let_tmp_rhs1 PdkEncryptionAndSymmetricSigningKeys = _11_derivedKeys 401 _ = _let_tmp_rhs1 402 var _12_pdkEncryptionKey _dafny.Sequence = _let_tmp_rhs1.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey 403 _ = _12_pdkEncryptionKey 404 var _13_symmetricSigningKey _dafny.Sequence = _let_tmp_rhs1.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey 405 _ = _13_symmetricSigningKey 406 var _14_iv _dafny.Sequence 407 _ = _14_iv 408 _14_iv = _dafny.SeqCreate((_dafny.IntOfInt32(m_AlgorithmSuites.Companion_Default___.GetEncryptIvLength(algorithmSuite))).Uint32(), func(coer42 func(_dafny.Int) uint8) func(_dafny.Int) interface{} { 409 return func(arg43 _dafny.Int) interface{} { 410 return coer42(arg43) 411 } 412 }(func(_15___v1 _dafny.Int) uint8 { 413 return uint8(0) 414 })) 415 var _16_valueOrError3 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 416 _ = _16_valueOrError3 417 _16_valueOrError3 = m_CanonicalEncryptionContext.Companion_Default___.EncryptionContextToAAD(encryptionContext) 418 if (_16_valueOrError3).IsFailure() { 419 res = (_16_valueOrError3).PropagateFailure() 420 return res 421 } 422 var _17_aad _dafny.Sequence 423 _ = _17_aad 424 _17_aad = (_16_valueOrError3).Extract().(_dafny.Sequence) 425 var _18_encInput m_AwsCryptographyPrimitivesTypes.AESEncryptInput 426 _ = _18_encInput 427 _18_encInput = m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptInput_.Create_AESEncryptInput_(((algorithmSuite).Dtor_encrypt()).Dtor_AES__GCM(), _14_iv, _12_pdkEncryptionKey, plaintextDataKey, _17_aad) 428 var _19_encOutR m_Wrappers.Result 429 _ = _19_encOutR 430 var _out3 m_Wrappers.Result 431 _ = _out3 432 _out3 = (_4_cryptoPrimitives).AESEncrypt(_18_encInput) 433 _19_encOutR = _out3 434 var _20_valueOrError4 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_AwsCryptographyPrimitivesTypes.Companion_AESEncryptOutput_.Default()) 435 _ = _20_valueOrError4 436 _20_valueOrError4 = (_19_encOutR).MapFailure(func(coer43 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 437 return func(arg44 interface{}) interface{} { 438 return coer43(arg44.(m_AwsCryptographyPrimitivesTypes.Error)) 439 } 440 }(func(_21_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 441 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_21_e) 442 })) 443 if (_20_valueOrError4).IsFailure() { 444 res = (_20_valueOrError4).PropagateFailure() 445 return res 446 } 447 var _22_encryptedPdk m_AwsCryptographyPrimitivesTypes.AESEncryptOutput 448 _ = _22_encryptedPdk 449 _22_encryptedPdk = (_20_valueOrError4).Extract().(m_AwsCryptographyPrimitivesTypes.AESEncryptOutput) 450 var _23_valueOrError5 m_Wrappers.Outcome = m_Wrappers.Companion_Outcome_.Default() 451 _ = _23_valueOrError5 452 _23_valueOrError5 = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((_dafny.Companion_Sequence_.Concatenate((_22_encryptedPdk).Dtor_cipherText(), (_22_encryptedPdk).Dtor_authTag())).Cardinality())).Cmp(_dafny.IntOfInt32((m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))+(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algorithmSuite)))) == 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unexpected AES_GCM Encrypt length"))) 453 if (_23_valueOrError5).IsFailure() { 454 res = (_23_valueOrError5).PropagateFailure() 455 return res 456 } 457 var _24_serializedMaterial _dafny.Sequence 458 _ = _24_serializedMaterial 459 _24_serializedMaterial = _dafny.Companion_Sequence_.Concatenate(_dafny.Companion_Sequence_.Concatenate((_22_encryptedPdk).Dtor_cipherText(), (_22_encryptedPdk).Dtor_authTag()), _8_providerWrappedIkm) 460 res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateWrapOutput_.Create_IntermediateWrapOutput_(_24_serializedMaterial, _13_symmetricSigningKey, _9_wrapInfo)) 461 return res 462 return res 463 } 464 func (_static *CompanionStruct_Default___) IntermediateGenerateAndWrap(generateAndWrap m_MaterialWrapping.GenerateAndWrapMaterial, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map) m_Wrappers.Result { 465 var res m_Wrappers.Result = m_Wrappers.Result{} 466 _ = res 467 var _0_maybeCrypto m_Wrappers.Result 468 _ = _0_maybeCrypto 469 var _out0 m_Wrappers.Result 470 _ = _out0 471 _out0 = m_AtomicPrimitives.Companion_Default___.AtomicPrimitives(m_AtomicPrimitives.Companion_Default___.DefaultCryptoConfig()) 472 _0_maybeCrypto = _out0 473 var _1_valueOrError0 m_Wrappers.Result = m_Wrappers.Result{} 474 _ = _1_valueOrError0 475 _1_valueOrError0 = (_0_maybeCrypto).MapFailure(func(coer44 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 476 return func(arg45 interface{}) interface{} { 477 return coer44(arg45.(m_AwsCryptographyPrimitivesTypes.Error)) 478 } 479 }(func(_2_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 480 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_2_e) 481 })) 482 if (_1_valueOrError0).IsFailure() { 483 res = (_1_valueOrError0).PropagateFailure() 484 return res 485 } 486 var _3_cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient 487 _ = _3_cryptoPrimitives 488 _3_cryptoPrimitives = (_1_valueOrError0).Extract().(*m_AtomicPrimitives.AtomicPrimitivesClient) 489 var _4_generateBytesResult m_Wrappers.Result 490 _ = _4_generateBytesResult 491 var _out1 m_Wrappers.Result 492 _ = _out1 493 _out1 = (_3_cryptoPrimitives).GenerateRandomBytes(m_AwsCryptographyPrimitivesTypes.Companion_GenerateRandomBytesInput_.Create_GenerateRandomBytesInput_(m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algorithmSuite))) 494 _4_generateBytesResult = _out1 495 var _5_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 496 _ = _5_valueOrError1 497 _5_valueOrError1 = (_4_generateBytesResult).MapFailure(func(coer45 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 498 return func(arg46 interface{}) interface{} { 499 return coer45(arg46.(m_AwsCryptographyPrimitivesTypes.Error)) 500 } 501 }(func(_6_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 502 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_6_e) 503 })) 504 if (_5_valueOrError1).IsFailure() { 505 res = (_5_valueOrError1).PropagateFailure() 506 return res 507 } 508 var _7_plaintextDataKey _dafny.Sequence 509 _ = _7_plaintextDataKey 510 _7_plaintextDataKey = (_5_valueOrError1).Extract().(_dafny.Sequence) 511 var _8_valueOrError2 m_Wrappers.Result = m_Wrappers.Result{} 512 _ = _8_valueOrError2 513 var _out2 m_Wrappers.Result 514 _ = _out2 515 _out2 = Companion_Default___.IntermediateWrap(generateAndWrap, _7_plaintextDataKey, algorithmSuite, encryptionContext) 516 _8_valueOrError2 = _out2 517 if (_8_valueOrError2).IsFailure() { 518 res = (_8_valueOrError2).PropagateFailure() 519 return res 520 } 521 var _9_wrapOutput IntermediateWrapOutput 522 _ = _9_wrapOutput 523 _9_wrapOutput = (_8_valueOrError2).Extract().(IntermediateWrapOutput) 524 res = m_Wrappers.Companion_Result_.Create_Success_(Companion_IntermediateGenerateAndWrapOutput_.Create_IntermediateGenerateAndWrapOutput_(_7_plaintextDataKey, (_9_wrapOutput).Dtor_wrappedMaterial(), (_9_wrapOutput).Dtor_symmetricSigningKey(), (_9_wrapOutput).Dtor_wrapInfo())) 525 return res 526 return res 527 } 528 func (_static *CompanionStruct_Default___) DeserializeIntermediateWrappedMaterial(material _dafny.Sequence, algSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo) m_Wrappers.Result { 529 var _0_valueOrError0 m_Wrappers.Outcome = m_Wrappers.Companion_Default___.Need((_dafny.IntOfUint32((material).Cardinality())).Cmp(_dafny.IntOfInt32((m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algSuite))+(m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algSuite)))) >= 0, m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographicMaterialProvidersException_(_dafny.SeqOfString("Unable to deserialize Intermediate Key Wrapped material: too short."))) 530 _ = _0_valueOrError0 531 if (_0_valueOrError0).IsFailure() { 532 return (_0_valueOrError0).PropagateFailure() 533 } else { 534 var _1_encryptedPdkLen int32 = (m_AlgorithmSuites.Companion_Default___.GetEncryptKeyLength(algSuite)) + (m_AlgorithmSuites.Companion_Default___.GetEncryptTagLength(algSuite)) 535 _ = _1_encryptedPdkLen 536 return m_Wrappers.Companion_Result_.Create_Success_(Companion_DeserializedIntermediateWrappedMaterial_.Create_DeserializedIntermediateWrappedMaterial_((material).Take(uint32(_1_encryptedPdkLen)), (material).Drop(uint32(_1_encryptedPdkLen)))) 537 } 538 } 539 func (_static *CompanionStruct_Default___) DeriveKeysFromIntermediateMaterial(intermediateMaterial _dafny.Sequence, algorithmSuite m_AwsCryptographyMaterialProvidersTypes.AlgorithmSuiteInfo, encryptionContext _dafny.Map, cryptoPrimitives *m_AtomicPrimitives.AtomicPrimitivesClient) m_Wrappers.Result { 540 var res m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_PdkEncryptionAndSymmetricSigningKeys_.Default()) 541 _ = res 542 var _0_hkdfExtractInput m_AwsCryptographyPrimitivesTypes.HkdfExtractInput 543 _ = _0_hkdfExtractInput 544 _0_hkdfExtractInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExtractInput_.Create_HkdfExtractInput_((((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_hmac(), m_Wrappers.Companion_Option_.Create_None_(), intermediateMaterial) 545 var _1_maybePseudoRandomKey m_Wrappers.Result 546 _ = _1_maybePseudoRandomKey 547 var _out0 m_Wrappers.Result 548 _ = _out0 549 _out0 = (cryptoPrimitives).HkdfExtract(_0_hkdfExtractInput) 550 _1_maybePseudoRandomKey = _out0 551 var _2_valueOrError0 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 552 _ = _2_valueOrError0 553 _2_valueOrError0 = (_1_maybePseudoRandomKey).MapFailure(func(coer46 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 554 return func(arg47 interface{}) interface{} { 555 return coer46(arg47.(m_AwsCryptographyPrimitivesTypes.Error)) 556 } 557 }(func(_3_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 558 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_3_e) 559 })) 560 if (_2_valueOrError0).IsFailure() { 561 res = (_2_valueOrError0).PropagateFailure() 562 return res 563 } 564 var _4_pseudoRandomKey _dafny.Sequence 565 _ = _4_pseudoRandomKey 566 _4_pseudoRandomKey = (_2_valueOrError0).Extract().(_dafny.Sequence) 567 var _5_symmetricSigningKeyInput m_AwsCryptographyPrimitivesTypes.HkdfExpandInput 568 _ = _5_symmetricSigningKeyInput 569 _5_symmetricSigningKeyInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExpandInput_.Create_HkdfExpandInput_((((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_hmac(), _4_pseudoRandomKey, Companion_Default___.KEYWRAP__MAC__INFO(), (((algorithmSuite).Dtor_commitment()).Dtor_HKDF()).Dtor_outputKeyLength()) 570 var _6_pdkEncryptionKeyInput m_AwsCryptographyPrimitivesTypes.HkdfExpandInput 571 _ = _6_pdkEncryptionKeyInput 572 var _7_dt__update__tmp_h0 m_AwsCryptographyPrimitivesTypes.HkdfExpandInput = _5_symmetricSigningKeyInput 573 _ = _7_dt__update__tmp_h0 574 var _8_dt__update_hinfo_h0 _dafny.Sequence = Companion_Default___.KEYWRAP__ENC__INFO() 575 _ = _8_dt__update_hinfo_h0 576 _6_pdkEncryptionKeyInput = m_AwsCryptographyPrimitivesTypes.Companion_HkdfExpandInput_.Create_HkdfExpandInput_((_7_dt__update__tmp_h0).Dtor_digestAlgorithm(), (_7_dt__update__tmp_h0).Dtor_prk(), _8_dt__update_hinfo_h0, (_7_dt__update__tmp_h0).Dtor_expectedLength()) 577 var _9_maybeSymmetricSigningKey m_Wrappers.Result 578 _ = _9_maybeSymmetricSigningKey 579 var _out1 m_Wrappers.Result 580 _ = _out1 581 _out1 = (cryptoPrimitives).HkdfExpand(_5_symmetricSigningKeyInput) 582 _9_maybeSymmetricSigningKey = _out1 583 var _10_valueOrError1 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 584 _ = _10_valueOrError1 585 _10_valueOrError1 = (_9_maybeSymmetricSigningKey).MapFailure(func(coer47 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 586 return func(arg48 interface{}) interface{} { 587 return coer47(arg48.(m_AwsCryptographyPrimitivesTypes.Error)) 588 } 589 }(func(_11_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 590 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_11_e) 591 })) 592 if (_10_valueOrError1).IsFailure() { 593 res = (_10_valueOrError1).PropagateFailure() 594 return res 595 } 596 var _12_symmetricSigningKey _dafny.Sequence 597 _ = _12_symmetricSigningKey 598 _12_symmetricSigningKey = (_10_valueOrError1).Extract().(_dafny.Sequence) 599 var _13_maybePdkEncryptionKey m_Wrappers.Result 600 _ = _13_maybePdkEncryptionKey 601 var _out2 m_Wrappers.Result 602 _ = _out2 603 _out2 = (cryptoPrimitives).HkdfExpand(_6_pdkEncryptionKeyInput) 604 _13_maybePdkEncryptionKey = _out2 605 var _14_valueOrError2 m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(_dafny.EmptySeq) 606 _ = _14_valueOrError2 607 _14_valueOrError2 = (_13_maybePdkEncryptionKey).MapFailure(func(coer48 func(m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error) func(interface{}) interface{} { 608 return func(arg49 interface{}) interface{} { 609 return coer48(arg49.(m_AwsCryptographyPrimitivesTypes.Error)) 610 } 611 }(func(_15_e m_AwsCryptographyPrimitivesTypes.Error) m_AwsCryptographyMaterialProvidersTypes.Error { 612 return m_AwsCryptographyMaterialProvidersTypes.Companion_Error_.Create_AwsCryptographyPrimitives_(_15_e) 613 })) 614 if (_14_valueOrError2).IsFailure() { 615 res = (_14_valueOrError2).PropagateFailure() 616 return res 617 } 618 var _16_pdkEncryptionKey _dafny.Sequence 619 _ = _16_pdkEncryptionKey 620 _16_pdkEncryptionKey = (_14_valueOrError2).Extract().(_dafny.Sequence) 621 res = m_Wrappers.Companion_Result_.Create_Success_(Companion_PdkEncryptionAndSymmetricSigningKeys_.Create_PdkEncryptionAndSymmetricSigningKeys_(_16_pdkEncryptionKey, _12_symmetricSigningKey)) 622 return res 623 return res 624 } 625 func (_static *CompanionStruct_Default___) KEYWRAP__MAC__INFO() _dafny.Sequence { 626 return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("AWS_MPL_INTERMEDIATE_KEYWRAP_MAC")) 627 } 628 func (_static *CompanionStruct_Default___) KEYWRAP__ENC__INFO() _dafny.Sequence { 629 return m_UTF8.Companion_Default___.EncodeAscii(_dafny.SeqOfString("AWS_MPL_INTERMEDIATE_KEYWRAP_ENC")) 630 } 631 632 // End of class Default__ 633 634 // Definition of datatype IntermediateUnwrapOutput 635 type IntermediateUnwrapOutput struct { 636 Data_IntermediateUnwrapOutput_ 637 } 638 639 func (_this IntermediateUnwrapOutput) Get_() Data_IntermediateUnwrapOutput_ { 640 return _this.Data_IntermediateUnwrapOutput_ 641 } 642 643 type Data_IntermediateUnwrapOutput_ interface { 644 isIntermediateUnwrapOutput() 645 } 646 647 type CompanionStruct_IntermediateUnwrapOutput_ struct { 648 } 649 650 var Companion_IntermediateUnwrapOutput_ = CompanionStruct_IntermediateUnwrapOutput_{} 651 652 type IntermediateUnwrapOutput_IntermediateUnwrapOutput struct { 653 PlaintextDataKey _dafny.Sequence 654 SymmetricSigningKey _dafny.Sequence 655 UnwrapInfo interface{} 656 } 657 658 func (IntermediateUnwrapOutput_IntermediateUnwrapOutput) isIntermediateUnwrapOutput() {} 659 660 func (CompanionStruct_IntermediateUnwrapOutput_) Create_IntermediateUnwrapOutput_(PlaintextDataKey _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, UnwrapInfo interface{}) IntermediateUnwrapOutput { 661 return IntermediateUnwrapOutput{IntermediateUnwrapOutput_IntermediateUnwrapOutput{PlaintextDataKey, SymmetricSigningKey, UnwrapInfo}} 662 } 663 664 func (_this IntermediateUnwrapOutput) Is_IntermediateUnwrapOutput() bool { 665 _, ok := _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput) 666 return ok 667 } 668 669 func (CompanionStruct_IntermediateUnwrapOutput_) Default(_default_T interface{}) IntermediateUnwrapOutput { 670 return Companion_IntermediateUnwrapOutput_.Create_IntermediateUnwrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _default_T) 671 } 672 673 func (_this IntermediateUnwrapOutput) Dtor_plaintextDataKey() _dafny.Sequence { 674 return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).PlaintextDataKey 675 } 676 677 func (_this IntermediateUnwrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { 678 return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).SymmetricSigningKey 679 } 680 681 func (_this IntermediateUnwrapOutput) Dtor_unwrapInfo() interface{} { 682 return _this.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput).UnwrapInfo 683 } 684 685 func (_this IntermediateUnwrapOutput) String() string { 686 switch data := _this.Get_().(type) { 687 case nil: 688 return "null" 689 case IntermediateUnwrapOutput_IntermediateUnwrapOutput: 690 { 691 return "IntermediateKeyWrapping.IntermediateUnwrapOutput.IntermediateUnwrapOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.UnwrapInfo) + ")" 692 } 693 default: 694 { 695 return "<unexpected>" 696 } 697 } 698 } 699 700 func (_this IntermediateUnwrapOutput) Equals(other IntermediateUnwrapOutput) bool { 701 switch data1 := _this.Get_().(type) { 702 case IntermediateUnwrapOutput_IntermediateUnwrapOutput: 703 { 704 data2, ok := other.Get_().(IntermediateUnwrapOutput_IntermediateUnwrapOutput) 705 return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.UnwrapInfo, data2.UnwrapInfo) 706 } 707 default: 708 { 709 return false // unexpected 710 } 711 } 712 } 713 714 func (_this IntermediateUnwrapOutput) EqualsGeneric(other interface{}) bool { 715 typed, ok := other.(IntermediateUnwrapOutput) 716 return ok && _this.Equals(typed) 717 } 718 719 func Type_IntermediateUnwrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 720 return type_IntermediateUnwrapOutput_{Type_T_} 721 } 722 723 type type_IntermediateUnwrapOutput_ struct { 724 Type_T_ _dafny.TypeDescriptor 725 } 726 727 func (_this type_IntermediateUnwrapOutput_) Default() interface{} { 728 Type_T_ := _this.Type_T_ 729 _ = Type_T_ 730 return Companion_IntermediateUnwrapOutput_.Default(Type_T_.Default()) 731 } 732 733 func (_this type_IntermediateUnwrapOutput_) String() string { 734 return "IntermediateKeyWrapping.IntermediateUnwrapOutput" 735 } 736 func (_this IntermediateUnwrapOutput) ParentTraits_() []*_dafny.TraitID { 737 return [](*_dafny.TraitID){} 738 } 739 740 var _ _dafny.TraitOffspring = IntermediateUnwrapOutput{} 741 742 // End of datatype IntermediateUnwrapOutput 743 744 // Definition of datatype IntermediateGenerateAndWrapOutput 745 type IntermediateGenerateAndWrapOutput struct { 746 Data_IntermediateGenerateAndWrapOutput_ 747 } 748 749 func (_this IntermediateGenerateAndWrapOutput) Get_() Data_IntermediateGenerateAndWrapOutput_ { 750 return _this.Data_IntermediateGenerateAndWrapOutput_ 751 } 752 753 type Data_IntermediateGenerateAndWrapOutput_ interface { 754 isIntermediateGenerateAndWrapOutput() 755 } 756 757 type CompanionStruct_IntermediateGenerateAndWrapOutput_ struct { 758 } 759 760 var Companion_IntermediateGenerateAndWrapOutput_ = CompanionStruct_IntermediateGenerateAndWrapOutput_{} 761 762 type IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput struct { 763 PlaintextDataKey _dafny.Sequence 764 WrappedMaterial _dafny.Sequence 765 SymmetricSigningKey _dafny.Sequence 766 WrapInfo interface{} 767 } 768 769 func (IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) isIntermediateGenerateAndWrapOutput() { 770 } 771 772 func (CompanionStruct_IntermediateGenerateAndWrapOutput_) Create_IntermediateGenerateAndWrapOutput_(PlaintextDataKey _dafny.Sequence, WrappedMaterial _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, WrapInfo interface{}) IntermediateGenerateAndWrapOutput { 773 return IntermediateGenerateAndWrapOutput{IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput{PlaintextDataKey, WrappedMaterial, SymmetricSigningKey, WrapInfo}} 774 } 775 776 func (_this IntermediateGenerateAndWrapOutput) Is_IntermediateGenerateAndWrapOutput() bool { 777 _, ok := _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) 778 return ok 779 } 780 781 func (CompanionStruct_IntermediateGenerateAndWrapOutput_) Default(_default_T interface{}) IntermediateGenerateAndWrapOutput { 782 return Companion_IntermediateGenerateAndWrapOutput_.Create_IntermediateGenerateAndWrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _dafny.EmptySeq, _default_T) 783 } 784 785 func (_this IntermediateGenerateAndWrapOutput) Dtor_plaintextDataKey() _dafny.Sequence { 786 return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).PlaintextDataKey 787 } 788 789 func (_this IntermediateGenerateAndWrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { 790 return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).WrappedMaterial 791 } 792 793 func (_this IntermediateGenerateAndWrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { 794 return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).SymmetricSigningKey 795 } 796 797 func (_this IntermediateGenerateAndWrapOutput) Dtor_wrapInfo() interface{} { 798 return _this.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput).WrapInfo 799 } 800 801 func (_this IntermediateGenerateAndWrapOutput) String() string { 802 switch data := _this.Get_().(type) { 803 case nil: 804 return "null" 805 case IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput: 806 { 807 return "IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput.IntermediateGenerateAndWrapOutput" + "(" + _dafny.String(data.PlaintextDataKey) + ", " + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" 808 } 809 default: 810 { 811 return "<unexpected>" 812 } 813 } 814 } 815 816 func (_this IntermediateGenerateAndWrapOutput) Equals(other IntermediateGenerateAndWrapOutput) bool { 817 switch data1 := _this.Get_().(type) { 818 case IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput: 819 { 820 data2, ok := other.Get_().(IntermediateGenerateAndWrapOutput_IntermediateGenerateAndWrapOutput) 821 return ok && data1.PlaintextDataKey.Equals(data2.PlaintextDataKey) && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) 822 } 823 default: 824 { 825 return false // unexpected 826 } 827 } 828 } 829 830 func (_this IntermediateGenerateAndWrapOutput) EqualsGeneric(other interface{}) bool { 831 typed, ok := other.(IntermediateGenerateAndWrapOutput) 832 return ok && _this.Equals(typed) 833 } 834 835 func Type_IntermediateGenerateAndWrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 836 return type_IntermediateGenerateAndWrapOutput_{Type_T_} 837 } 838 839 type type_IntermediateGenerateAndWrapOutput_ struct { 840 Type_T_ _dafny.TypeDescriptor 841 } 842 843 func (_this type_IntermediateGenerateAndWrapOutput_) Default() interface{} { 844 Type_T_ := _this.Type_T_ 845 _ = Type_T_ 846 return Companion_IntermediateGenerateAndWrapOutput_.Default(Type_T_.Default()) 847 } 848 849 func (_this type_IntermediateGenerateAndWrapOutput_) String() string { 850 return "IntermediateKeyWrapping.IntermediateGenerateAndWrapOutput" 851 } 852 func (_this IntermediateGenerateAndWrapOutput) ParentTraits_() []*_dafny.TraitID { 853 return [](*_dafny.TraitID){} 854 } 855 856 var _ _dafny.TraitOffspring = IntermediateGenerateAndWrapOutput{} 857 858 // End of datatype IntermediateGenerateAndWrapOutput 859 860 // Definition of datatype IntermediateWrapOutput 861 type IntermediateWrapOutput struct { 862 Data_IntermediateWrapOutput_ 863 } 864 865 func (_this IntermediateWrapOutput) Get_() Data_IntermediateWrapOutput_ { 866 return _this.Data_IntermediateWrapOutput_ 867 } 868 869 type Data_IntermediateWrapOutput_ interface { 870 isIntermediateWrapOutput() 871 } 872 873 type CompanionStruct_IntermediateWrapOutput_ struct { 874 } 875 876 var Companion_IntermediateWrapOutput_ = CompanionStruct_IntermediateWrapOutput_{} 877 878 type IntermediateWrapOutput_IntermediateWrapOutput struct { 879 WrappedMaterial _dafny.Sequence 880 SymmetricSigningKey _dafny.Sequence 881 WrapInfo interface{} 882 } 883 884 func (IntermediateWrapOutput_IntermediateWrapOutput) isIntermediateWrapOutput() {} 885 886 func (CompanionStruct_IntermediateWrapOutput_) Create_IntermediateWrapOutput_(WrappedMaterial _dafny.Sequence, SymmetricSigningKey _dafny.Sequence, WrapInfo interface{}) IntermediateWrapOutput { 887 return IntermediateWrapOutput{IntermediateWrapOutput_IntermediateWrapOutput{WrappedMaterial, SymmetricSigningKey, WrapInfo}} 888 } 889 890 func (_this IntermediateWrapOutput) Is_IntermediateWrapOutput() bool { 891 _, ok := _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput) 892 return ok 893 } 894 895 func (CompanionStruct_IntermediateWrapOutput_) Default(_default_T interface{}) IntermediateWrapOutput { 896 return Companion_IntermediateWrapOutput_.Create_IntermediateWrapOutput_(_dafny.EmptySeq, _dafny.EmptySeq, _default_T) 897 } 898 899 func (_this IntermediateWrapOutput) Dtor_wrappedMaterial() _dafny.Sequence { 900 return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).WrappedMaterial 901 } 902 903 func (_this IntermediateWrapOutput) Dtor_symmetricSigningKey() _dafny.Sequence { 904 return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).SymmetricSigningKey 905 } 906 907 func (_this IntermediateWrapOutput) Dtor_wrapInfo() interface{} { 908 return _this.Get_().(IntermediateWrapOutput_IntermediateWrapOutput).WrapInfo 909 } 910 911 func (_this IntermediateWrapOutput) String() string { 912 switch data := _this.Get_().(type) { 913 case nil: 914 return "null" 915 case IntermediateWrapOutput_IntermediateWrapOutput: 916 { 917 return "IntermediateKeyWrapping.IntermediateWrapOutput.IntermediateWrapOutput" + "(" + _dafny.String(data.WrappedMaterial) + ", " + _dafny.String(data.SymmetricSigningKey) + ", " + _dafny.String(data.WrapInfo) + ")" 918 } 919 default: 920 { 921 return "<unexpected>" 922 } 923 } 924 } 925 926 func (_this IntermediateWrapOutput) Equals(other IntermediateWrapOutput) bool { 927 switch data1 := _this.Get_().(type) { 928 case IntermediateWrapOutput_IntermediateWrapOutput: 929 { 930 data2, ok := other.Get_().(IntermediateWrapOutput_IntermediateWrapOutput) 931 return ok && data1.WrappedMaterial.Equals(data2.WrappedMaterial) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) && _dafny.AreEqual(data1.WrapInfo, data2.WrapInfo) 932 } 933 default: 934 { 935 return false // unexpected 936 } 937 } 938 } 939 940 func (_this IntermediateWrapOutput) EqualsGeneric(other interface{}) bool { 941 typed, ok := other.(IntermediateWrapOutput) 942 return ok && _this.Equals(typed) 943 } 944 945 func Type_IntermediateWrapOutput_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 946 return type_IntermediateWrapOutput_{Type_T_} 947 } 948 949 type type_IntermediateWrapOutput_ struct { 950 Type_T_ _dafny.TypeDescriptor 951 } 952 953 func (_this type_IntermediateWrapOutput_) Default() interface{} { 954 Type_T_ := _this.Type_T_ 955 _ = Type_T_ 956 return Companion_IntermediateWrapOutput_.Default(Type_T_.Default()) 957 } 958 959 func (_this type_IntermediateWrapOutput_) String() string { 960 return "IntermediateKeyWrapping.IntermediateWrapOutput" 961 } 962 func (_this IntermediateWrapOutput) ParentTraits_() []*_dafny.TraitID { 963 return [](*_dafny.TraitID){} 964 } 965 966 var _ _dafny.TraitOffspring = IntermediateWrapOutput{} 967 968 // End of datatype IntermediateWrapOutput 969 970 // Definition of datatype DeserializedIntermediateWrappedMaterial 971 type DeserializedIntermediateWrappedMaterial struct { 972 Data_DeserializedIntermediateWrappedMaterial_ 973 } 974 975 func (_this DeserializedIntermediateWrappedMaterial) Get_() Data_DeserializedIntermediateWrappedMaterial_ { 976 return _this.Data_DeserializedIntermediateWrappedMaterial_ 977 } 978 979 type Data_DeserializedIntermediateWrappedMaterial_ interface { 980 isDeserializedIntermediateWrappedMaterial() 981 } 982 983 type CompanionStruct_DeserializedIntermediateWrappedMaterial_ struct { 984 } 985 986 var Companion_DeserializedIntermediateWrappedMaterial_ = CompanionStruct_DeserializedIntermediateWrappedMaterial_{} 987 988 type DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial struct { 989 EncryptedPdk _dafny.Sequence 990 ProviderWrappedIkm _dafny.Sequence 991 } 992 993 func (DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) isDeserializedIntermediateWrappedMaterial() { 994 } 995 996 func (CompanionStruct_DeserializedIntermediateWrappedMaterial_) Create_DeserializedIntermediateWrappedMaterial_(EncryptedPdk _dafny.Sequence, ProviderWrappedIkm _dafny.Sequence) DeserializedIntermediateWrappedMaterial { 997 return DeserializedIntermediateWrappedMaterial{DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial{EncryptedPdk, ProviderWrappedIkm}} 998 } 999 1000 func (_this DeserializedIntermediateWrappedMaterial) Is_DeserializedIntermediateWrappedMaterial() bool { 1001 _, ok := _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) 1002 return ok 1003 } 1004 1005 func (CompanionStruct_DeserializedIntermediateWrappedMaterial_) Default() DeserializedIntermediateWrappedMaterial { 1006 return Companion_DeserializedIntermediateWrappedMaterial_.Create_DeserializedIntermediateWrappedMaterial_(_dafny.EmptySeq, _dafny.EmptySeq) 1007 } 1008 1009 func (_this DeserializedIntermediateWrappedMaterial) Dtor_encryptedPdk() _dafny.Sequence { 1010 return _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).EncryptedPdk 1011 } 1012 1013 func (_this DeserializedIntermediateWrappedMaterial) Dtor_providerWrappedIkm() _dafny.Sequence { 1014 return _this.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial).ProviderWrappedIkm 1015 } 1016 1017 func (_this DeserializedIntermediateWrappedMaterial) String() string { 1018 switch data := _this.Get_().(type) { 1019 case nil: 1020 return "null" 1021 case DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial: 1022 { 1023 return "IntermediateKeyWrapping.DeserializedIntermediateWrappedMaterial.DeserializedIntermediateWrappedMaterial" + "(" + _dafny.String(data.EncryptedPdk) + ", " + _dafny.String(data.ProviderWrappedIkm) + ")" 1024 } 1025 default: 1026 { 1027 return "<unexpected>" 1028 } 1029 } 1030 } 1031 1032 func (_this DeserializedIntermediateWrappedMaterial) Equals(other DeserializedIntermediateWrappedMaterial) bool { 1033 switch data1 := _this.Get_().(type) { 1034 case DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial: 1035 { 1036 data2, ok := other.Get_().(DeserializedIntermediateWrappedMaterial_DeserializedIntermediateWrappedMaterial) 1037 return ok && data1.EncryptedPdk.Equals(data2.EncryptedPdk) && data1.ProviderWrappedIkm.Equals(data2.ProviderWrappedIkm) 1038 } 1039 default: 1040 { 1041 return false // unexpected 1042 } 1043 } 1044 } 1045 1046 func (_this DeserializedIntermediateWrappedMaterial) EqualsGeneric(other interface{}) bool { 1047 typed, ok := other.(DeserializedIntermediateWrappedMaterial) 1048 return ok && _this.Equals(typed) 1049 } 1050 1051 func Type_DeserializedIntermediateWrappedMaterial_() _dafny.TypeDescriptor { 1052 return type_DeserializedIntermediateWrappedMaterial_{} 1053 } 1054 1055 type type_DeserializedIntermediateWrappedMaterial_ struct { 1056 } 1057 1058 func (_this type_DeserializedIntermediateWrappedMaterial_) Default() interface{} { 1059 return Companion_DeserializedIntermediateWrappedMaterial_.Default() 1060 } 1061 1062 func (_this type_DeserializedIntermediateWrappedMaterial_) String() string { 1063 return "IntermediateKeyWrapping.DeserializedIntermediateWrappedMaterial" 1064 } 1065 func (_this DeserializedIntermediateWrappedMaterial) ParentTraits_() []*_dafny.TraitID { 1066 return [](*_dafny.TraitID){} 1067 } 1068 1069 var _ _dafny.TraitOffspring = DeserializedIntermediateWrappedMaterial{} 1070 1071 // End of datatype DeserializedIntermediateWrappedMaterial 1072 1073 // Definition of datatype PdkEncryptionAndSymmetricSigningKeys 1074 type PdkEncryptionAndSymmetricSigningKeys struct { 1075 Data_PdkEncryptionAndSymmetricSigningKeys_ 1076 } 1077 1078 func (_this PdkEncryptionAndSymmetricSigningKeys) Get_() Data_PdkEncryptionAndSymmetricSigningKeys_ { 1079 return _this.Data_PdkEncryptionAndSymmetricSigningKeys_ 1080 } 1081 1082 type Data_PdkEncryptionAndSymmetricSigningKeys_ interface { 1083 isPdkEncryptionAndSymmetricSigningKeys() 1084 } 1085 1086 type CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_ struct { 1087 } 1088 1089 var Companion_PdkEncryptionAndSymmetricSigningKeys_ = CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_{} 1090 1091 type PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys struct { 1092 PdkEncryptionKey _dafny.Sequence 1093 SymmetricSigningKey _dafny.Sequence 1094 } 1095 1096 func (PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) isPdkEncryptionAndSymmetricSigningKeys() { 1097 } 1098 1099 func (CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_) Create_PdkEncryptionAndSymmetricSigningKeys_(PdkEncryptionKey _dafny.Sequence, SymmetricSigningKey _dafny.Sequence) PdkEncryptionAndSymmetricSigningKeys { 1100 return PdkEncryptionAndSymmetricSigningKeys{PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys{PdkEncryptionKey, SymmetricSigningKey}} 1101 } 1102 1103 func (_this PdkEncryptionAndSymmetricSigningKeys) Is_PdkEncryptionAndSymmetricSigningKeys() bool { 1104 _, ok := _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) 1105 return ok 1106 } 1107 1108 func (CompanionStruct_PdkEncryptionAndSymmetricSigningKeys_) Default() PdkEncryptionAndSymmetricSigningKeys { 1109 return Companion_PdkEncryptionAndSymmetricSigningKeys_.Create_PdkEncryptionAndSymmetricSigningKeys_(_dafny.EmptySeq, _dafny.EmptySeq) 1110 } 1111 1112 func (_this PdkEncryptionAndSymmetricSigningKeys) Dtor_pdkEncryptionKey() _dafny.Sequence { 1113 return _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).PdkEncryptionKey 1114 } 1115 1116 func (_this PdkEncryptionAndSymmetricSigningKeys) Dtor_symmetricSigningKey() _dafny.Sequence { 1117 return _this.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys).SymmetricSigningKey 1118 } 1119 1120 func (_this PdkEncryptionAndSymmetricSigningKeys) String() string { 1121 switch data := _this.Get_().(type) { 1122 case nil: 1123 return "null" 1124 case PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys: 1125 { 1126 return "IntermediateKeyWrapping.PdkEncryptionAndSymmetricSigningKeys.PdkEncryptionAndSymmetricSigningKeys" + "(" + _dafny.String(data.PdkEncryptionKey) + ", " + _dafny.String(data.SymmetricSigningKey) + ")" 1127 } 1128 default: 1129 { 1130 return "<unexpected>" 1131 } 1132 } 1133 } 1134 1135 func (_this PdkEncryptionAndSymmetricSigningKeys) Equals(other PdkEncryptionAndSymmetricSigningKeys) bool { 1136 switch data1 := _this.Get_().(type) { 1137 case PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys: 1138 { 1139 data2, ok := other.Get_().(PdkEncryptionAndSymmetricSigningKeys_PdkEncryptionAndSymmetricSigningKeys) 1140 return ok && data1.PdkEncryptionKey.Equals(data2.PdkEncryptionKey) && data1.SymmetricSigningKey.Equals(data2.SymmetricSigningKey) 1141 } 1142 default: 1143 { 1144 return false // unexpected 1145 } 1146 } 1147 } 1148 1149 func (_this PdkEncryptionAndSymmetricSigningKeys) EqualsGeneric(other interface{}) bool { 1150 typed, ok := other.(PdkEncryptionAndSymmetricSigningKeys) 1151 return ok && _this.Equals(typed) 1152 } 1153 1154 func Type_PdkEncryptionAndSymmetricSigningKeys_() _dafny.TypeDescriptor { 1155 return type_PdkEncryptionAndSymmetricSigningKeys_{} 1156 } 1157 1158 type type_PdkEncryptionAndSymmetricSigningKeys_ struct { 1159 } 1160 1161 func (_this type_PdkEncryptionAndSymmetricSigningKeys_) Default() interface{} { 1162 return Companion_PdkEncryptionAndSymmetricSigningKeys_.Default() 1163 } 1164 1165 func (_this type_PdkEncryptionAndSymmetricSigningKeys_) String() string { 1166 return "IntermediateKeyWrapping.PdkEncryptionAndSymmetricSigningKeys" 1167 } 1168 func (_this PdkEncryptionAndSymmetricSigningKeys) ParentTraits_() []*_dafny.TraitID { 1169 return [](*_dafny.TraitID){} 1170 } 1171 1172 var _ _dafny.TraitOffspring = PdkEncryptionAndSymmetricSigningKeys{} 1173 1174 // End of datatype PdkEncryptionAndSymmetricSigningKeys