| | | 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 | | using System.Xml; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.IdentityModel |
| | | 7 | | { |
| | | 8 | | internal class EncryptionMethodElement |
| | | 9 | | { |
| | 0 | 10 | | public string Algorithm { get; set; } |
| | | 11 | | |
| | 0 | 12 | | public string Parameters { get; set; } |
| | | 13 | | |
| | | 14 | | public void ReadXml( XmlDictionaryReader reader ) |
| | | 15 | | { |
| | 0 | 16 | | if ( reader == null ) |
| | | 17 | | { |
| | 0 | 18 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( nameof(reader)); |
| | | 19 | | } |
| | | 20 | | |
| | 0 | 21 | | reader.MoveToContent(); |
| | 0 | 22 | | if ( !reader.IsStartElement( XmlEncryptionConstants.Elements.EncryptionMethod, XmlEncryptionConstants.Namesp |
| | | 23 | | { |
| | 0 | 24 | | return; |
| | | 25 | | } |
| | | 26 | | |
| | 0 | 27 | | Algorithm = reader.GetAttribute( XmlEncryptionConstants.Attributes.Algorithm, null ); |
| | | 28 | | |
| | 0 | 29 | | if ( !reader.IsEmptyElement ) |
| | | 30 | | { |
| | | 31 | | // |
| | | 32 | | // Trace unread missing element |
| | | 33 | | // |
| | | 34 | | |
| | 0 | 35 | | string xml = reader.ReadOuterXml(); |
| | | 36 | | //if ( DiagnosticUtility.ShouldTraceWarning ) |
| | | 37 | | //{ |
| | | 38 | | // TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, read |
| | | 39 | | //} |
| | | 40 | | } |
| | | 41 | | else |
| | | 42 | | { |
| | | 43 | | // |
| | | 44 | | // Read to the next element |
| | | 45 | | // |
| | 0 | 46 | | reader.Read(); |
| | | 47 | | } |
| | 0 | 48 | | } |
| | | 49 | | |
| | | 50 | | public void WriteXml( XmlWriter writer ) |
| | | 51 | | { |
| | 0 | 52 | | writer.WriteStartElement( XmlEncryptionConstants.Prefix, XmlEncryptionConstants.Elements.EncryptionMethod, X |
| | | 53 | | |
| | 0 | 54 | | writer.WriteAttributeString( XmlEncryptionConstants.Attributes.Algorithm, null, Algorithm ); |
| | | 55 | | |
| | | 56 | | // <EncryptionMethod> |
| | | 57 | | |
| | 0 | 58 | | writer.WriteEndElement(); |
| | 0 | 59 | | } |
| | | 60 | | |
| | | 61 | | } |
| | | 62 | | } |