Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / BinaryNegotiation.cs / 1 / BinaryNegotiation.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Security { using System; using System.Xml; using System.ServiceModel.Channels; internal sealed class BinaryNegotiation { private byte[] negotiationData; XmlDictionaryString valueTypeUriDictionaryString; string valueTypeUri; public BinaryNegotiation( string valueTypeUri, byte[] negotiationData) { if (valueTypeUri == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("valueTypeUri"); } if (negotiationData == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("negotiationData"); } this.valueTypeUriDictionaryString = null; this.valueTypeUri = valueTypeUri; this.negotiationData = negotiationData; } public BinaryNegotiation( XmlDictionaryString valueTypeDictionaryString, byte[] negotiationData) { if (valueTypeDictionaryString == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("valueTypeDictionaryString"); } if (negotiationData == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("negotiationData"); } this.valueTypeUriDictionaryString = valueTypeDictionaryString; this.valueTypeUri = valueTypeDictionaryString.Value; this.negotiationData = negotiationData; } public void Validate(XmlDictionaryString valueTypeUriDictionaryString) { if (this.valueTypeUri != valueTypeUriDictionaryString.Value) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(SR.GetString(SR.IncorrectBinaryNegotiationValueType, this.valueTypeUri))); } this.valueTypeUriDictionaryString = valueTypeUriDictionaryString; } public void WriteTo(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString ns, XmlDictionaryString valueTypeLocalName, XmlDictionaryString valueTypeNs) { writer.WriteStartElement(prefix, localName, ns); writer.WriteStartAttribute(valueTypeLocalName, valueTypeNs); if (valueTypeUriDictionaryString != null) writer.WriteString(valueTypeUriDictionaryString); else writer.WriteString(valueTypeUri); writer.WriteEndAttribute(); writer.WriteStartAttribute(XD.SecurityJan2004Dictionary.EncodingType, null); writer.WriteString(XD.SecurityJan2004Dictionary.EncodingTypeValueBase64Binary); writer.WriteEndAttribute(); writer.WriteBase64(this.negotiationData, 0, this.negotiationData.Length); writer.WriteEndElement(); } public string ValueTypeUri { get { return this.valueTypeUri; } } public byte[] GetNegotiationData() { // avoid copying since this is internal and callers use it as read-only return this.negotiationData; } } } // 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
- ProtectedProviderSettings.cs
- HtmlPageAdapter.cs
- odbcmetadatacollectionnames.cs
- Inflater.cs
- Point4DConverter.cs
- FamilyTypefaceCollection.cs
- InstanceCreationEditor.cs
- prompt.cs
- WebPart.cs
- LassoHelper.cs
- NativeMethods.cs
- SchemaImporterExtensionElement.cs
- XmlCountingReader.cs
- ProcessThreadCollection.cs
- Size3DValueSerializer.cs
- TreeNodeBinding.cs
- CommandEventArgs.cs
- CollectionBuilder.cs
- BackgroundFormatInfo.cs
- ManipulationInertiaStartingEventArgs.cs
- FeatureSupport.cs
- Point4D.cs
- SqlBinder.cs
- PropertyTab.cs
- Registry.cs
- IndicShape.cs
- NullableDecimalMinMaxAggregationOperator.cs
- DoubleLinkListEnumerator.cs
- PerformanceCounterManager.cs
- UntypedNullExpression.cs
- ComponentDispatcherThread.cs
- validationstate.cs
- TreeViewEvent.cs
- CallContext.cs
- SetterBase.cs
- LineGeometry.cs
- ButtonAutomationPeer.cs
- BinaryUtilClasses.cs
- WinEventTracker.cs
- BinaryObjectWriter.cs
- Point.cs
- HandlerBase.cs
- SystemWebSectionGroup.cs
- GridViewColumnCollection.cs
- DataBinding.cs
- MethodRental.cs
- BinaryUtilClasses.cs
- XamlClipboardData.cs
- SettingsPropertyIsReadOnlyException.cs
- XmlNodeList.cs
- TransformerTypeCollection.cs
- TypeHelper.cs
- CheckoutException.cs
- LayoutEvent.cs
- OdbcFactory.cs
- JournalEntryStack.cs
- DetailsViewDeletedEventArgs.cs
- ContentPlaceHolder.cs
- TextRangeEditLists.cs
- CustomBinding.cs
- ViewGenerator.cs
- SyntaxCheck.cs
- OrCondition.cs
- Exceptions.cs
- CoreSwitches.cs
- WebServiceHandlerFactory.cs
- _NtlmClient.cs
- ToolZone.cs
- Frame.cs
- WebChannelFactory.cs
- GridItemCollection.cs
- XamlPathDataSerializer.cs
- ClassValidator.cs
- Message.cs
- CheckBox.cs
- PersonalizableTypeEntry.cs
- TextEditorMouse.cs
- SystemWebCachingSectionGroup.cs
- Emitter.cs
- DocumentViewerBaseAutomationPeer.cs
- PageTheme.cs
- CachedTypeface.cs
- ImageConverter.cs
- _IPv6Address.cs
- StructuredProperty.cs
- ListInitExpression.cs
- PageCache.cs
- RepeaterItem.cs
- SelectionEditor.cs
- DeadCharTextComposition.cs
- Int32KeyFrameCollection.cs
- InputScope.cs
- Sequence.cs
- PasswordTextNavigator.cs
- SettingsContext.cs
- TextTabProperties.cs
- UnhandledExceptionEventArgs.cs
- DataServiceQueryContinuation.cs
- SqlTransaction.cs
- ScopeCompiler.cs