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
- precedingquery.cs
- BindingExpression.cs
- FormViewCommandEventArgs.cs
- CodeEventReferenceExpression.cs
- InvalidFilterCriteriaException.cs
- ProviderCollection.cs
- DefaultObjectSerializer.cs
- VersionPair.cs
- Activation.cs
- WindowsStatic.cs
- ResourceAssociationType.cs
- BinaryEditor.cs
- ProxyHwnd.cs
- CommandManager.cs
- LocatorPart.cs
- RegistrySecurity.cs
- XmlArrayItemAttributes.cs
- Page.cs
- ValidationPropertyAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- DataBinder.cs
- DescendantQuery.cs
- EntitySetDataBindingList.cs
- VisualTarget.cs
- VideoDrawing.cs
- ChangePasswordDesigner.cs
- HtmlShim.cs
- XamlClipboardData.cs
- ExecutionScope.cs
- ClientFormsIdentity.cs
- ImageAutomationPeer.cs
- TextFormatterHost.cs
- PageCatalogPart.cs
- XmlAnyElementAttributes.cs
- DiscriminatorMap.cs
- TreeNodeStyle.cs
- ParameterCollectionEditor.cs
- ContextMenu.cs
- SoapInteropTypes.cs
- Classification.cs
- Int64Storage.cs
- WebReferencesBuildProvider.cs
- AtomContentProperty.cs
- CharUnicodeInfo.cs
- DataSourceSelectArguments.cs
- VerticalAlignConverter.cs
- FullTextState.cs
- TextTreeDeleteContentUndoUnit.cs
- SystemGatewayIPAddressInformation.cs
- GZipUtils.cs
- EdmSchemaError.cs
- OdbcInfoMessageEvent.cs
- SecurityTokenTypes.cs
- Array.cs
- ButtonField.cs
- SqlWorkflowInstanceStore.cs
- HiddenField.cs
- BitmapEffectGeneralTransform.cs
- TokenBasedSetEnumerator.cs
- CachedBitmap.cs
- ConstructorBuilder.cs
- XmlCompatibilityReader.cs
- ToolboxItemFilterAttribute.cs
- SharedPerformanceCounter.cs
- PrePostDescendentsWalker.cs
- PropertyMapper.cs
- Convert.cs
- SqlDependency.cs
- LocatorManager.cs
- ServiceHttpHandlerFactory.cs
- StylusPointPropertyId.cs
- XPathNodeHelper.cs
- PathFigure.cs
- OpenFileDialog.cs
- ControlUtil.cs
- Rect.cs
- TypeUsage.cs
- WindowsButton.cs
- AbstractExpressions.cs
- SQLInt16Storage.cs
- Utils.cs
- DataGridViewComboBoxColumn.cs
- RightNameExpirationInfoPair.cs
- DesignDataSource.cs
- _ProxyChain.cs
- MediaSystem.cs
- EntityRecordInfo.cs
- XPathNodeInfoAtom.cs
- Attributes.cs
- ToolStripItemDesigner.cs
- MenuItem.cs
- CodeGotoStatement.cs
- ListItemCollection.cs
- WSMessageEncoding.cs
- DeviceFilterEditorDialog.cs
- SqlCacheDependency.cs
- EditorReuseAttribute.cs
- DataGridState.cs
- PageAction.cs