void WriteBinarySecretKeyIdentifierClause(
     XmlWriter w, BinarySecretKeyIdentifierClause ic)
 {
     w.WriteStartElement("t", "BinarySecret", Constants.WstNamespace);
     w.WriteString(Convert.ToBase64String(ic.GetBuffer()));
     w.WriteEndElement();
 }
        public override bool Matches(SecurityKeyIdentifierClause clause)
        {
            if (clause == null)
            {
                throw new ArgumentNullException("clause");
            }
            BinarySecretKeyIdentifierClause other =
                clause as BinarySecretKeyIdentifierClause;

            if (other == null)
            {
                return(false);
            }
            byte [] b1 = GetRawBuffer();
            byte [] b2 = other.GetRawBuffer();
            if (b1.Length != b2.Length)
            {
                return(false);
            }
            for (int i = 0; i < b1.Length; i++)
            {
                if (b1 [i] != b2 [i])
                {
                    return(false);
                }
            }
            return(true);
        }
        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            BinarySecretKeyIdentifierClause that = keyIdentifierClause as BinarySecretKeyIdentifierClause;

            // PreSharp Bug: Parameter 'that' to this public method must be validated: A null-dereference can occur here.
#pragma warning suppress 56506
            return ReferenceEquals(this, that) || (that != null && that.Matches(this.GetRawBuffer()));
        }
        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            BinarySecretKeyIdentifierClause that = keyIdentifierClause as BinarySecretKeyIdentifierClause;

            // PreSharp
#pragma warning suppress 56506
            return(ReferenceEquals(this, that) || (that != null && that.Matches(this.GetRawBuffer())));
        }
Esempio n. 5
0
        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            BinarySecretKeyIdentifierClause that = keyIdentifierClause as BinarySecretKeyIdentifierClause;

            return(ReferenceEquals(this, that) || (that != null && that.Matches(GetRawBuffer())));
        }
Esempio n. 6
0
		void WriteBinarySecretKeyIdentifierClause (
			XmlWriter w, BinarySecretKeyIdentifierClause ic)
		{
			w.WriteStartElement ("t", "BinarySecret", Constants.WstNamespace);
			w.WriteString (Convert.ToBase64String (ic.GetBuffer ()));
			w.WriteEndElement ();
		}
		public void CreateBinarySecretKeyIdentifierClause ()
		{
			byte [] bytes = new byte [32];
			SecurityToken wt = new BinarySecretSecurityToken (bytes);
			SecurityKeyIdentifierClause kic =
				new BinarySecretKeyIdentifierClause (bytes);
			WrappedKeySecurityToken token = new WrappedKeySecurityToken ("urn:gyabo",
				bytes, SecurityAlgorithms.Aes256KeyWrap, wt,
				new SecurityKeyIdentifier (kic));
			token.CreateKeyIdentifierClause<BinarySecretKeyIdentifierClause> ();
		}
		public void WriteBinarySecretKeyIdentifierClause1 ()
		{
			StringWriter sw = new StringWriter ();
			byte [] bytes = new byte [32];
			BinarySecretKeyIdentifierClause ic = new BinarySecretKeyIdentifierClause (bytes);
			using (XmlWriter w = XmlWriter.Create (sw, GetWriterSettings ())) {
				WSSecurityTokenSerializer.DefaultInstance.WriteKeyIdentifierClause (w, ic);
			}
			string expected = String.Format ("<t:BinarySecret xmlns:t=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">{0}</t:BinarySecret>", Convert.ToBase64String (bytes));
			Assert.AreEqual (expected, sw.ToString (), "#1");
		}
        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            BinarySecretKeyIdentifierClause objB = keyIdentifierClause as BinarySecretKeyIdentifierClause;

            return(object.ReferenceEquals(this, objB) || ((objB != null) && objB.Matches(base.GetRawBuffer())));
        }