1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //------------------------------------------------------------
5 namespace System.ServiceModel.Security
7 using System.IdentityModel;
8 using System.IdentityModel.Tokens;
9 using System.Runtime.CompilerServices;
11 [TypeForwardedFrom("System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
12 public class BinarySecretKeyIdentifierClause : BinaryKeyIdentifierClause
14 InMemorySymmetricSecurityKey symmetricKey;
16 public BinarySecretKeyIdentifierClause(byte[] key)
21 public BinarySecretKeyIdentifierClause(byte[] key, bool cloneBuffer)
22 : this(key, cloneBuffer, null, 0)
26 public BinarySecretKeyIdentifierClause(byte[] key, bool cloneBuffer, byte[] derivationNonce, int derivationLength)
27 : base(XD.TrustFeb2005Dictionary.BinarySecretClauseType.Value, key, cloneBuffer, derivationNonce, derivationLength)
31 public byte[] GetKeyBytes()
36 public override bool CanCreateKey
41 public override SecurityKey CreateKey()
43 if (this.symmetricKey == null)
44 this.symmetricKey = new InMemorySymmetricSecurityKey(GetBuffer(), false);
46 return this.symmetricKey;
49 public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
51 BinarySecretKeyIdentifierClause that = keyIdentifierClause as BinarySecretKeyIdentifierClause;
54 #pragma warning suppress 56506
55 return ReferenceEquals(this, that) || (that != null && that.Matches(this.GetRawBuffer()));