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
- TextChangedEventArgs.cs
- FileNotFoundException.cs
- XPathScanner.cs
- StringCollection.cs
- XpsS0ValidatingLoader.cs
- TextFormatterImp.cs
- DrawingContextFlattener.cs
- BackgroundFormatInfo.cs
- ProviderManager.cs
- ButtonBase.cs
- InputElement.cs
- CalloutQueueItem.cs
- SpotLight.cs
- Roles.cs
- ConstrainedDataObject.cs
- ResolvedKeyFrameEntry.cs
- RuntimeResourceSet.cs
- ExceptionUtil.cs
- StrongNameIdentityPermission.cs
- PopOutPanel.cs
- SQLInt64Storage.cs
- PathParser.cs
- ServiceDurableInstanceContextProvider.cs
- Quad.cs
- SiteMapDataSourceView.cs
- ButtonBaseDesigner.cs
- Comparer.cs
- ApplicationId.cs
- Clipboard.cs
- TemplateBindingExpression.cs
- TypeConverterHelper.cs
- LazyTextWriterCreator.cs
- CodeCommentStatementCollection.cs
- EntitySqlQueryState.cs
- ContentPresenter.cs
- CollectionsUtil.cs
- HashCryptoHandle.cs
- Soap12ProtocolImporter.cs
- ListManagerBindingsCollection.cs
- ToolStripLabel.cs
- Lasso.cs
- SelectedCellsCollection.cs
- VisualBasicValue.cs
- OleDbConnectionInternal.cs
- ContractAdapter.cs
- FileDataSourceCache.cs
- WpfKnownTypeInvoker.cs
- DataBindingCollectionConverter.cs
- CategoryAttribute.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- RewritingValidator.cs
- OrderedEnumerableRowCollection.cs
- TextProperties.cs
- SchemaMapping.cs
- MsmqInputMessage.cs
- ListControl.cs
- AbandonedMutexException.cs
- CngKey.cs
- WindowsProgressbar.cs
- FileVersion.cs
- OrderedParallelQuery.cs
- QueryOpeningEnumerator.cs
- OleServicesContext.cs
- XmlAtomErrorReader.cs
- SessionStateItemCollection.cs
- EntityDataSourceContextCreatedEventArgs.cs
- DataServiceExpressionVisitor.cs
- AssemblyCacheEntry.cs
- ProviderUtil.cs
- safelink.cs
- Events.cs
- MethodImplAttribute.cs
- DesignerActionVerbItem.cs
- HandlerMappingMemo.cs
- RichTextBox.cs
- OracleColumn.cs
- CompoundFileIOPermission.cs
- UInt16.cs
- BrowsableAttribute.cs
- DataSource.cs
- _TLSstream.cs
- SoapSchemaExporter.cs
- BlurEffect.cs
- BindingManagerDataErrorEventArgs.cs
- BitmapEffect.cs
- StylusPointPropertyUnit.cs
- StringUtil.cs
- httpstaticobjectscollection.cs
- Parameter.cs
- IsolatedStorageFilePermission.cs
- ContentTextAutomationPeer.cs
- ColumnResizeAdorner.cs
- TraceData.cs
- ZeroOpNode.cs
- CompensatableTransactionScopeActivityDesigner.cs
- EastAsianLunisolarCalendar.cs
- SpecialTypeDataContract.cs
- SqlBooleanMismatchVisitor.cs
- KeyManager.cs
- AnnotationAdorner.cs