Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / BinaryKeyIdentifierClause.cs / 1 / BinaryKeyIdentifierClause.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; using HexBinary = System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary; public abstract class BinaryKeyIdentifierClause : SecurityKeyIdentifierClause { readonly byte[] identificationData; protected BinaryKeyIdentifierClause(string clauseType, byte[] identificationData, bool cloneBuffer) : this(clauseType, identificationData, cloneBuffer, null, 0) { } protected BinaryKeyIdentifierClause(string clauseType, byte[] identificationData, bool cloneBuffer, byte[] derivationNonce, int derivationLength) : base(clauseType, derivationNonce, derivationLength) { if (identificationData == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("identificationData")); } if (identificationData.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("identificationData", SR.GetString(SR.LengthMustBeGreaterThanZero))); } if (cloneBuffer) { this.identificationData = SecurityUtils.CloneBuffer(identificationData); } else { this.identificationData = identificationData; } } public byte[] GetBuffer() { return SecurityUtils.CloneBuffer(this.identificationData); } protected byte[] GetRawBuffer() { return this.identificationData; } public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) { BinaryKeyIdentifierClause that = keyIdentifierClause as BinaryKeyIdentifierClause; // PreSharp Bug: Parameter 'that' to this public method must be validated: A null-dereference can occur here. #pragma warning suppress 56506 return ReferenceEquals(this, that) || (that != null && that.Matches(this.identificationData)); } public bool Matches(byte[] data) { return Matches(data, 0); } public bool Matches(byte[] data, int offset) { if (offset < 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", SR.GetString(SR.ValueMustBeNonNegative))); } return SecurityUtils.MatchesBuffer(this.identificationData, 0, data, offset); } internal string ToBase64String() { return Convert.ToBase64String(this.identificationData); } internal string ToHexString() { return new HexBinary(this.identificationData).ToString(); } } } // 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
- SerializationHelper.cs
- DataServiceKeyAttribute.cs
- LayoutTable.cs
- CommonProperties.cs
- ParserHooks.cs
- XmlSchemaComplexType.cs
- ObjectViewListener.cs
- ErrorFormatterPage.cs
- XmlIgnoreAttribute.cs
- ConnectionManagementSection.cs
- RegexCapture.cs
- NextPreviousPagerField.cs
- DesignerTextBoxAdapter.cs
- OdbcException.cs
- DataGridViewColumnTypePicker.cs
- BindingGroup.cs
- BamlLocalizableResourceKey.cs
- LinqExpressionNormalizer.cs
- UnsafeNetInfoNativeMethods.cs
- COM2ExtendedUITypeEditor.cs
- AssemblyAttributesGoHere.cs
- CalendarTable.cs
- OdbcError.cs
- Clock.cs
- ParameterBinding.cs
- ReadOnlyCollectionBase.cs
- safesecurityhelperavalon.cs
- HttpVersion.cs
- LinqDataSourceStatusEventArgs.cs
- EditingCommands.cs
- ConfigurationStrings.cs
- AttachedAnnotation.cs
- GlyphTypeface.cs
- DeviceContext2.cs
- DataGridCellAutomationPeer.cs
- DeobfuscatingStream.cs
- ColorConvertedBitmapExtension.cs
- AssemblyResolver.cs
- HostVisual.cs
- FrameDimension.cs
- SafeEventLogReadHandle.cs
- DriveInfo.cs
- SystemSounds.cs
- ProbeDuplexCD1AsyncResult.cs
- WebResponse.cs
- DiscoveryMessageSequence11.cs
- HwndStylusInputProvider.cs
- WebPartUtil.cs
- EntityFrameworkVersions.cs
- ManagementEventArgs.cs
- ToolStripRendererSwitcher.cs
- WsdlBuildProvider.cs
- XmlSchemaRedefine.cs
- PTManager.cs
- DragStartedEventArgs.cs
- SqlCachedBuffer.cs
- ValidatingPropertiesEventArgs.cs
- ImageInfo.cs
- AspNetHostingPermission.cs
- DataControlField.cs
- IfJoinedCondition.cs
- FileDetails.cs
- DataGridViewSelectedRowCollection.cs
- SignedXmlDebugLog.cs
- TagPrefixAttribute.cs
- HttpSysSettings.cs
- SafeRightsManagementPubHandle.cs
- OutputCacheProfileCollection.cs
- LinkedResourceCollection.cs
- AttachmentService.cs
- IdentityModelStringsVersion1.cs
- TcpProcessProtocolHandler.cs
- SynchronizedInputAdaptor.cs
- DiagnosticStrings.cs
- PublisherMembershipCondition.cs
- ScaleTransform3D.cs
- sqlnorm.cs
- ContextMenuService.cs
- UnaryExpressionHelper.cs
- FederatedMessageSecurityOverHttpElement.cs
- TextAutomationPeer.cs
- SoapTypeAttribute.cs
- ConnectionPoolRegistry.cs
- DefaultTraceListener.cs
- AttachedPropertiesService.cs
- ResourceDictionary.cs
- PersonalizableTypeEntry.cs
- ClientTargetSection.cs
- WmlListAdapter.cs
- ipaddressinformationcollection.cs
- DeclaredTypeElementCollection.cs
- CriticalHandle.cs
- CategoryNameCollection.cs
- SafeNativeMethods.cs
- HtmlControl.cs
- UpdateCommandGenerator.cs
- PropertyContainer.cs
- XmlDataSourceNodeDescriptor.cs
- Evidence.cs
- Version.cs