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
- PasswordTextContainer.cs
- PropertyGridView.cs
- Row.cs
- followingquery.cs
- StaticResourceExtension.cs
- ColorDialog.cs
- PageEventArgs.cs
- EndpointDesigner.cs
- NameValueCollection.cs
- PlatformCulture.cs
- WsatServiceCertificate.cs
- EncryptedPackage.cs
- BindingManagerDataErrorEventArgs.cs
- DocumentOutline.cs
- CompilerResults.cs
- OleDbFactory.cs
- PrintPreviewControl.cs
- HttpCacheVary.cs
- ScriptControl.cs
- OleDbErrorCollection.cs
- SeparatorAutomationPeer.cs
- ListDictionaryInternal.cs
- ListDataHelper.cs
- VerificationException.cs
- PathData.cs
- EntryIndex.cs
- RemotingConfiguration.cs
- UserPersonalizationStateInfo.cs
- DataGrid.cs
- XmlAnyAttributeAttribute.cs
- InvalidAsynchronousStateException.cs
- GridItemCollection.cs
- WorkflowInstance.cs
- CustomTypeDescriptor.cs
- DataListItemCollection.cs
- ISO2022Encoding.cs
- TemplateBindingExpressionConverter.cs
- HttpConfigurationContext.cs
- RecipientIdentity.cs
- SystemTcpStatistics.cs
- BamlTreeUpdater.cs
- NavigationEventArgs.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- ActiveXSite.cs
- RectConverter.cs
- ValidationErrorEventArgs.cs
- CellParagraph.cs
- PropertyEntry.cs
- RealizationDrawingContextWalker.cs
- DataException.cs
- CapacityStreamGeometryContext.cs
- StateMachine.cs
- WriteTimeStream.cs
- CompensationDesigner.cs
- MaterialCollection.cs
- SystemResourceHost.cs
- FixedSOMPageConstructor.cs
- SmtpMail.cs
- BitmapSource.cs
- WorkflowApplicationException.cs
- FixedStringLookup.cs
- ISFTagAndGuidCache.cs
- StrokeRenderer.cs
- RoleService.cs
- BamlWriter.cs
- GridErrorDlg.cs
- PropertyChangingEventArgs.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- PageCodeDomTreeGenerator.cs
- Literal.cs
- DescriptionAttribute.cs
- ScrollChrome.cs
- Mappings.cs
- TextDecorationCollection.cs
- SmtpTransport.cs
- SymbolDocumentGenerator.cs
- Maps.cs
- CacheEntry.cs
- DoubleLinkList.cs
- WebPartCancelEventArgs.cs
- ListViewItem.cs
- WindowsHyperlink.cs
- CommandLibraryHelper.cs
- hresults.cs
- PagedDataSource.cs
- WindowsStatic.cs
- NameValueCache.cs
- WebPartCloseVerb.cs
- ProfileModule.cs
- FileSecurity.cs
- CodeCommentStatementCollection.cs
- TemplateNameScope.cs
- UserControlFileEditor.cs
- AccessibleObject.cs
- ModelTypeConverter.cs
- XmlILOptimizerVisitor.cs
- EmptyImpersonationContext.cs
- MembershipUser.cs
- ISAPIApplicationHost.cs
- ResolveDuplexCD1AsyncResult.cs