ReceiveSecurityHeaderEntry.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //----------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.Security
  5. {
  6. 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. public bool MatchesId(string id, bool requiresEncryptedFormId)
  20. {
  21. if (doubleEncrypted)
  22. {
  23. return (this.encryptedFormId == id || this.encryptedFormWsuId == id);
  24. }
  25. else
  26. {
  27. if (requiresEncryptedFormId)
  28. {
  29. return this.encryptedFormId == id;
  30. }
  31. else
  32. {
  33. return this.id == id;
  34. }
  35. }
  36. }
  37. public void PreserveIdBeforeDecryption()
  38. {
  39. this.encryptedFormId = this.id;
  40. }
  41. public void SetElement(
  42. ReceiveSecurityHeaderElementCategory elementCategory, object element,
  43. ReceiveSecurityHeaderBindingModes bindingMode, string id, bool encrypted, byte[] decryptedBuffer, TokenTracker supportingTokenTracker)
  44. {
  45. this.elementCategory = elementCategory;
  46. this.element = element;
  47. this.bindingMode = bindingMode;
  48. this.encrypted = encrypted;
  49. this.decryptedBuffer = decryptedBuffer;
  50. this.supportingTokenTracker = supportingTokenTracker;
  51. this.id = id;
  52. }
  53. }
  54. }