public override void WriteContent(XmlDictionaryWriter writer, SecurityKeyIdentifierClause clause) { writer.WriteStartElement(CoreWCF.XD.SecurityJan2004Dictionary.Prefix.Value, CoreWCF.XD.SecurityJan2004Dictionary.KeyIdentifier, CoreWCF.XD.SecurityJan2004Dictionary.Namespace); writer.WriteAttributeString(CoreWCF.XD.SecurityJan2004Dictionary.ValueType, null, ValueTypeUri); if (EmitBspRequiredAttributes) { // Emit the encodingType attribute. writer.WriteAttributeString(CoreWCF.XD.SecurityJan2004Dictionary.EncodingType, null, DefaultEncodingType); } string encoding = DefaultEncodingType; BinaryKeyIdentifierClause binaryClause = clause as BinaryKeyIdentifierClause; byte[] keyIdentifier = binaryClause.GetBuffer(); if (encoding == EncodingTypeValueBase64Binary) { writer.WriteBase64(keyIdentifier, 0, keyIdentifier.Length); } else if (encoding == EncodingTypeValueHexBinary) { writer.WriteBinHex(keyIdentifier, 0, keyIdentifier.Length); } else if (encoding == EncodingTypeValueText) { writer.WriteString(new UTF8Encoding().GetString(keyIdentifier, 0, keyIdentifier.Length)); } writer.WriteEndElement(); }
public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) { BinaryKeyIdentifierClause that = keyIdentifierClause as BinaryKeyIdentifierClause; return(ReferenceEquals(this, that) || (that != null && that.Matches(_identificationData))); }