Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / EncryptedHeaderXml.cs / 1 / EncryptedHeaderXml.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Security { using System.IO; using System.ServiceModel.Channels; using System.ServiceModel; using System.IdentityModel.Tokens; using System.IdentityModel.Selectors; using System.Security.Cryptography; using System.Xml; using DictionaryManager = System.IdentityModel.DictionaryManager; using ISecurityElement = System.IdentityModel.ISecurityElement; sealed class EncryptedHeaderXml { internal static readonly XmlDictionaryString ElementName = XD.SecurityXXX2005Dictionary.EncryptedHeader; internal static readonly XmlDictionaryString NamespaceUri = XD.SecurityXXX2005Dictionary.Namespace; const string Prefix = SecurityXXX2005Strings.Prefix; string id; bool mustUnderstand; bool relay; string actor; MessageVersion version; EncryptedData encryptedData; public EncryptedHeaderXml(MessageVersion version) { this.version = version; encryptedData = new EncryptedData(); } public string Actor { get { return this.actor; } set { this.actor = value; } } public string EncryptionMethod { get { return encryptedData.EncryptionMethod; } set { encryptedData.EncryptionMethod = value; } } public XmlDictionaryString EncryptionMethodDictionaryString { get { return encryptedData.EncryptionMethodDictionaryString; } set { encryptedData.EncryptionMethodDictionaryString = value; } } public bool HasId { get { return true; } } public string Id { get { return id; } set { id = value; } } public SecurityKeyIdentifier KeyIdentifier { get { return encryptedData.KeyIdentifier; } set { encryptedData.KeyIdentifier = value; } } public bool MustUnderstand { get { return this.mustUnderstand; } set { this.mustUnderstand = value; } } public bool Relay { get { return this.relay; } set { this.relay = value; } } public SecurityTokenSerializer SecurityTokenSerializer { get { return encryptedData.SecurityTokenSerializer; } set { encryptedData.SecurityTokenSerializer = value; } } public byte[] GetDecryptedBuffer() { return encryptedData.GetDecryptedBuffer(); } public void ReadFrom(XmlDictionaryReader reader, long maxBufferSize) { reader.MoveToStartElement(ElementName, NamespaceUri); bool isReferenceParameter; MessageHeader.GetHeaderAttributes(reader, version, out this.actor, out this.mustUnderstand, out this.relay, out isReferenceParameter); this.id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace); reader.ReadStartElement(); encryptedData.ReadFrom(reader, maxBufferSize); reader.ReadEndElement(); } public void SetUpDecryption(SymmetricAlgorithm algorithm) { encryptedData.SetUpDecryption(algorithm); } public void SetUpEncryption(SymmetricAlgorithm algorithm, MemoryStream source) { encryptedData.SetUpEncryption(algorithm, new ArraySegment(source.GetBuffer(), 0, (int) source.Length)); } public void WriteHeaderElement(XmlDictionaryWriter writer) { writer.WriteStartElement(Prefix, ElementName, NamespaceUri); } public void WriteHeaderId(XmlDictionaryWriter writer) { writer.WriteAttributeString(XD.UtilityDictionary.Prefix.Value, XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace, id); } public void WriteHeaderContents(XmlDictionaryWriter writer) { this.encryptedData.WriteTo(writer, ServiceModelDictionaryManager.Instance); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SocketAddress.cs
- SaveFileDialog.cs
- nulltextnavigator.cs
- RawStylusInputCustomData.cs
- SpecularMaterial.cs
- PointAnimationClockResource.cs
- ResolveDuplexAsyncResult.cs
- TextContainer.cs
- GeometryGroup.cs
- TextFormattingConverter.cs
- PrintEvent.cs
- SafeRegistryHandle.cs
- AnimationException.cs
- SecurityKeyUsage.cs
- EditorPart.cs
- AsyncCompletedEventArgs.cs
- RemotingSurrogateSelector.cs
- OledbConnectionStringbuilder.cs
- MSAAWinEventWrap.cs
- CursorConverter.cs
- Menu.cs
- TranslateTransform.cs
- SqlServices.cs
- MultiAsyncResult.cs
- DesignSurfaceEvent.cs
- CanExpandCollapseAllConverter.cs
- InternalResources.cs
- ServicePointManager.cs
- SystemDropShadowChrome.cs
- LinqToSqlWrapper.cs
- LinqDataSource.cs
- XXXOnTypeBuilderInstantiation.cs
- ExpandoClass.cs
- SiteMapHierarchicalDataSourceView.cs
- PolyLineSegment.cs
- FileDialog_Vista_Interop.cs
- SecurityResources.cs
- DataGridViewCellEventArgs.cs
- ComponentConverter.cs
- AsymmetricKeyExchangeDeformatter.cs
- MasterPageCodeDomTreeGenerator.cs
- IdlingCommunicationPool.cs
- TagMapCollection.cs
- KeyManager.cs
- webeventbuffer.cs
- invalidudtexception.cs
- HtmlUtf8RawTextWriter.cs
- BatchParser.cs
- ProfessionalColorTable.cs
- FormParameter.cs
- ItemsChangedEventArgs.cs
- OdbcDataAdapter.cs
- SplayTreeNode.cs
- WeakReferenceEnumerator.cs
- ResourceDescriptionAttribute.cs
- DivideByZeroException.cs
- FindCompletedEventArgs.cs
- BitmapEffectGroup.cs
- Validator.cs
- HttpFileCollectionBase.cs
- Interop.cs
- ReadingWritingEntityEventArgs.cs
- ModuleElement.cs
- DefaultHttpHandler.cs
- SwitchAttribute.cs
- XmlSchemaComplexContentExtension.cs
- UnsafeNativeMethods.cs
- FontFamilyValueSerializer.cs
- LinqDataSource.cs
- PrimitiveOperationFormatter.cs
- ELinqQueryState.cs
- FileCodeGroup.cs
- ImportRequest.cs
- DesignTimeParseData.cs
- XmlSchemaChoice.cs
- ListViewSortEventArgs.cs
- RoutingTable.cs
- CompiledQueryCacheKey.cs
- SendKeys.cs
- RegularExpressionValidator.cs
- DropShadowEffect.cs
- DataGridRelationshipRow.cs
- TreeBuilderBamlTranslator.cs
- CrossContextChannel.cs
- ConstraintManager.cs
- TextProperties.cs
- FilterableAttribute.cs
- LicenseManager.cs
- FixedPageStructure.cs
- WebPermission.cs
- WorkflowItemPresenter.cs
- OperationAbortedException.cs
- AddInAttribute.cs
- ValidatorUtils.cs
- CompiledQuery.cs
- ArrayHelper.cs
- XmlLanguage.cs
- ReaderWriterLockWrapper.cs
- ShaderRenderModeValidation.cs
- OutputScopeManager.cs