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
- TypeBuilderInstantiation.cs
- BitmapScalingModeValidation.cs
- Icon.cs
- BreakRecordTable.cs
- LineInfo.cs
- ModelUIElement3D.cs
- CssClassPropertyAttribute.cs
- AnnotationAdorner.cs
- SecUtil.cs
- ElementHostAutomationPeer.cs
- SqlUDTStorage.cs
- FontWeightConverter.cs
- KeyInstance.cs
- MessageBuilder.cs
- ContainerFilterService.cs
- ProjectionRewriter.cs
- ListViewItemMouseHoverEvent.cs
- UnsafeNativeMethods.cs
- SQLResource.cs
- OleDbConnection.cs
- ExtentCqlBlock.cs
- SchemaNotation.cs
- ProcessInfo.cs
- Variable.cs
- OptionUsage.cs
- DocumentSchemaValidator.cs
- TableLayoutPanelCellPosition.cs
- VirtualPathProvider.cs
- XmlSchemaSet.cs
- TextServicesProperty.cs
- SqlCacheDependencySection.cs
- DataTrigger.cs
- HostingPreferredMapPath.cs
- SchemaTypeEmitter.cs
- UdpChannelListener.cs
- Page.cs
- RenderTargetBitmap.cs
- PointHitTestParameters.cs
- BufferModeSettings.cs
- XslVisitor.cs
- BitmapEffect.cs
- ToolStripTextBox.cs
- ThrowHelper.cs
- ToolStripEditorManager.cs
- InheritanceRules.cs
- ProfilePropertySettingsCollection.cs
- EarlyBoundInfo.cs
- MessageQueueTransaction.cs
- ValueQuery.cs
- MenuRendererStandards.cs
- InternalsVisibleToAttribute.cs
- HttpPostProtocolImporter.cs
- SqlProviderServices.cs
- ProcessStartInfo.cs
- SafeLibraryHandle.cs
- RequestCache.cs
- ButtonColumn.cs
- SecurityTokenValidationException.cs
- PageCatalogPart.cs
- DbConnectionInternal.cs
- ServicesExceptionNotHandledEventArgs.cs
- TemplatePagerField.cs
- NameValueCache.cs
- EventLogPermissionEntryCollection.cs
- GPPOINTF.cs
- GlyphCollection.cs
- ColumnClickEvent.cs
- DependencySource.cs
- WebZone.cs
- RelationshipFixer.cs
- XmlProcessingInstruction.cs
- AttachedPropertyInfo.cs
- TimeSpan.cs
- InstanceDataCollection.cs
- WorkflowMessageEventArgs.cs
- Roles.cs
- DataGridViewRowStateChangedEventArgs.cs
- SolidColorBrush.cs
- IdentityNotMappedException.cs
- _LazyAsyncResult.cs
- EntityDataSourceDataSelection.cs
- ConnectionPool.cs
- WindowsFormsSynchronizationContext.cs
- SiteMapNodeItem.cs
- ProfileInfo.cs
- RepeaterItemCollection.cs
- SQLSingle.cs
- DeploymentSection.cs
- SerializationException.cs
- TextDecorationUnitValidation.cs
- Function.cs
- Image.cs
- MethodCallConverter.cs
- ParentQuery.cs
- TableItemPatternIdentifiers.cs
- DataGridColumnCollection.cs
- WindowProviderWrapper.cs
- XmlQueryType.cs
- BitmapSource.cs
- XmlCharacterData.cs