| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | namespace CoreWCF.Security |
| | | 5 | | { |
| | | 6 | | internal struct ReceiveSecurityHeaderEntry |
| | | 7 | | { |
| | | 8 | | internal ReceiveSecurityHeaderElementCategory elementCategory; |
| | | 9 | | internal object element; |
| | | 10 | | internal ReceiveSecurityHeaderBindingModes bindingMode; |
| | | 11 | | internal string id; |
| | | 12 | | internal string encryptedFormId; |
| | | 13 | | internal string encryptedFormWsuId; |
| | | 14 | | internal bool signed; |
| | | 15 | | internal bool encrypted; |
| | | 16 | | internal byte[] decryptedBuffer; |
| | | 17 | | internal TokenTracker supportingTokenTracker; |
| | | 18 | | internal bool doubleEncrypted; |
| | | 19 | | |
| | | 20 | | public bool MatchesId(string id, bool requiresEncryptedFormId) |
| | | 21 | | { |
| | 0 | 22 | | if (doubleEncrypted) |
| | | 23 | | { |
| | 0 | 24 | | return (encryptedFormId == id || encryptedFormWsuId == id); |
| | | 25 | | } |
| | | 26 | | else |
| | | 27 | | { |
| | 0 | 28 | | if (requiresEncryptedFormId) |
| | | 29 | | { |
| | 0 | 30 | | return encryptedFormId == id; |
| | | 31 | | } |
| | | 32 | | else |
| | | 33 | | { |
| | 0 | 34 | | return this.id == id; |
| | | 35 | | } |
| | | 36 | | } |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | public void PreserveIdBeforeDecryption() |
| | | 40 | | { |
| | 0 | 41 | | encryptedFormId = id; |
| | 0 | 42 | | } |
| | | 43 | | |
| | | 44 | | public void SetElement( |
| | | 45 | | ReceiveSecurityHeaderElementCategory elementCategory, object element, |
| | | 46 | | ReceiveSecurityHeaderBindingModes bindingMode, string id, bool encrypted, byte[] decryptedBuffer, TokenTrack |
| | | 47 | | { |
| | 181 | 48 | | this.elementCategory = elementCategory; |
| | 181 | 49 | | this.element = element; |
| | 181 | 50 | | this.bindingMode = bindingMode; |
| | 181 | 51 | | this.encrypted = encrypted; |
| | 181 | 52 | | this.decryptedBuffer = decryptedBuffer; |
| | 181 | 53 | | this.supportingTokenTracker = supportingTokenTracker; |
| | 181 | 54 | | this.id = id; |
| | 181 | 55 | | } |
| | | 56 | | } |
| | | 57 | | } |