Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / EnvelopedSignatureTransform.cs / 1305376 / EnvelopedSignatureTransform.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel { using System.Xml; using System.Security.Cryptography; sealed class EnvelopedSignatureTransform : Transform { string prefix = XmlSignatureStrings.Prefix; public EnvelopedSignatureTransform() { } public override string Algorithm { get { return XD.XmlSignatureDictionary.EnvelopedSignature.Value; } } public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager) { XmlTokenStream tokenStream = input as XmlTokenStream; if (tokenStream != null) { tokenStream.SetElementExclusion(XmlSignatureStrings.Signature, XmlSignatureStrings.Namespace); return tokenStream; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedInputTypeForTransform, input.GetType()))); } // this transform is not allowed as the last one in a chain public override byte[] ProcessAndDigest(object input, SignatureResourcePool resourcePool, string digestAlgorithm, DictionaryManager dictionaryManager) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedLastTransform))); } public override void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager) { reader.MoveToContent(); string algorithm = XmlHelper.ReadEmptyElementAndRequiredAttribute(reader, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace, dictionaryManager.XmlSignatureDictionary.Algorithm, out this.prefix); if (algorithm != this.Algorithm) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(SR.GetString(SR.AlgorithmMismatchForTransform))); } } public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager) { writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace); writer.WriteAttributeString(dictionaryManager.XmlSignatureDictionary.Algorithm, null, this.Algorithm); writer.WriteEndElement(); // Transform } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel { using System.Xml; using System.Security.Cryptography; sealed class EnvelopedSignatureTransform : Transform { string prefix = XmlSignatureStrings.Prefix; public EnvelopedSignatureTransform() { } public override string Algorithm { get { return XD.XmlSignatureDictionary.EnvelopedSignature.Value; } } public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager) { XmlTokenStream tokenStream = input as XmlTokenStream; if (tokenStream != null) { tokenStream.SetElementExclusion(XmlSignatureStrings.Signature, XmlSignatureStrings.Namespace); return tokenStream; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedInputTypeForTransform, input.GetType()))); } // this transform is not allowed as the last one in a chain public override byte[] ProcessAndDigest(object input, SignatureResourcePool resourcePool, string digestAlgorithm, DictionaryManager dictionaryManager) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedLastTransform))); } public override void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager) { reader.MoveToContent(); string algorithm = XmlHelper.ReadEmptyElementAndRequiredAttribute(reader, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace, dictionaryManager.XmlSignatureDictionary.Algorithm, out this.prefix); if (algorithm != this.Algorithm) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(SR.GetString(SR.AlgorithmMismatchForTransform))); } } public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager) { writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace); writer.WriteAttributeString(dictionaryManager.XmlSignatureDictionary.Algorithm, null, this.Algorithm); writer.WriteEndElement(); // Transform } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ValidationErrorCollection.cs
- ExtenderProvidedPropertyAttribute.cs
- X509UI.cs
- Track.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ExecutionEngineException.cs
- GCHandleCookieTable.cs
- CollectionDataContractAttribute.cs
- LogicalExpressionEditor.cs
- RelationshipWrapper.cs
- ConfigXmlWhitespace.cs
- _AuthenticationState.cs
- AdornedElementPlaceholder.cs
- CustomErrorsSectionWrapper.cs
- KeyTimeConverter.cs
- ListenerConnectionModeReader.cs
- PageOrientation.cs
- DataSourceComponent.cs
- Instrumentation.cs
- HttpWebResponse.cs
- MethodImplAttribute.cs
- DispatchWrapper.cs
- PasswordRecoveryDesigner.cs
- TearOffProxy.cs
- SmtpClient.cs
- PersonalizationProvider.cs
- CategoryAttribute.cs
- ArrangedElement.cs
- CodeDOMUtility.cs
- RadioButtonList.cs
- Model3DGroup.cs
- PrimaryKeyTypeConverter.cs
- ColumnPropertiesGroup.cs
- TransformerTypeCollection.cs
- ThreadPool.cs
- KeyValuePair.cs
- DependencyObjectPropertyDescriptor.cs
- CompositeKey.cs
- ProviderConnectionPointCollection.cs
- XmlDocumentFragment.cs
- OleDbTransaction.cs
- DataExpression.cs
- LoginNameDesigner.cs
- Stream.cs
- ExportFileRequest.cs
- EndpointInfo.cs
- Connector.cs
- ToolStripItemEventArgs.cs
- SafeTimerHandle.cs
- AsymmetricKeyExchangeDeformatter.cs
- ListView.cs
- DataGridViewColumn.cs
- ArrayWithOffset.cs
- TableParagraph.cs
- TcpClientSocketManager.cs
- KeyInstance.cs
- SessionParameter.cs
- SessionEndingCancelEventArgs.cs
- OperationParameterInfo.cs
- TextDecorationUnitValidation.cs
- Expression.cs
- Enum.cs
- BinaryConverter.cs
- DataPagerFieldCollection.cs
- Accessible.cs
- NotificationContext.cs
- XPathConvert.cs
- ComplexType.cs
- CodeDOMProvider.cs
- HttpInputStream.cs
- TimeoutException.cs
- OverlappedAsyncResult.cs
- PixelFormats.cs
- WebPartUtil.cs
- RMEnrollmentPage3.cs
- QilTernary.cs
- HttpCacheVaryByContentEncodings.cs
- UnsafeNativeMethodsMilCoreApi.cs
- BaseUriWithWildcard.cs
- ThreadExceptionEvent.cs
- PrivilegedConfigurationManager.cs
- EntityClassGenerator.cs
- XmlDocumentSurrogate.cs
- HandlerBase.cs
- Send.cs
- ChtmlTextWriter.cs
- StrongName.cs
- ChangeProcessor.cs
- StreamWriter.cs
- FocusWithinProperty.cs
- ContextMenuAutomationPeer.cs
- FamilyTypeface.cs
- PathGradientBrush.cs
- BufferedGraphicsManager.cs
- indexingfiltermarshaler.cs
- RegionData.cs
- OutOfMemoryException.cs
- PhysicalFontFamily.cs
- JournalEntryListConverter.cs
- TransportSecurityHelpers.cs