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
- XmlWhitespace.cs
- CryptoApi.cs
- XsdBuilder.cs
- ArgumentDesigner.xaml.cs
- ListViewCommandEventArgs.cs
- LocalClientSecuritySettings.cs
- ChildrenQuery.cs
- NotifyParentPropertyAttribute.cs
- SqlConnectionManager.cs
- EpmSourcePathSegment.cs
- DataServiceKeyAttribute.cs
- DetailsViewUpdatedEventArgs.cs
- WindowsListBox.cs
- AlgoModule.cs
- OleDbCommandBuilder.cs
- InputReferenceExpression.cs
- ProfileProvider.cs
- MetadataItemSerializer.cs
- ZipIOLocalFileHeader.cs
- DetailsViewInsertEventArgs.cs
- ButtonBaseAdapter.cs
- SessionIDManager.cs
- RightsManagementPermission.cs
- SmtpLoginAuthenticationModule.cs
- ProviderConnectionPoint.cs
- StateDesigner.Helpers.cs
- SqlBulkCopyColumnMapping.cs
- ColorBlend.cs
- TableColumn.cs
- SqlUnionizer.cs
- RedBlackList.cs
- CompilerInfo.cs
- Image.cs
- CannotUnloadAppDomainException.cs
- DispatcherFrame.cs
- IndexOutOfRangeException.cs
- StateBag.cs
- COM2EnumConverter.cs
- ResourcePermissionBase.cs
- _NegoState.cs
- TrustManager.cs
- MouseEventArgs.cs
- LinearGradientBrush.cs
- ISCIIEncoding.cs
- VersionedStreamOwner.cs
- OleDbParameterCollection.cs
- BezierSegment.cs
- GridEntry.cs
- StreamUpdate.cs
- RectangleHotSpot.cs
- FrameAutomationPeer.cs
- RegexMatchCollection.cs
- SqlCacheDependencySection.cs
- ConfigurationConverterBase.cs
- AnnotationHelper.cs
- Brush.cs
- KerberosReceiverSecurityToken.cs
- odbcmetadatacollectionnames.cs
- DispatcherExceptionFilterEventArgs.cs
- MemberAccessException.cs
- SchemaInfo.cs
- HttpWriter.cs
- PointLight.cs
- DockAndAnchorLayout.cs
- Base64Encoder.cs
- Axis.cs
- HttpResponseHeader.cs
- ComponentRenameEvent.cs
- Quaternion.cs
- PersistenceProviderDirectory.cs
- Line.cs
- SemanticBasicElement.cs
- DataGridViewCellValueEventArgs.cs
- BindValidationContext.cs
- RemotingAttributes.cs
- TimeZoneInfo.cs
- TCEAdapterGenerator.cs
- StyleHelper.cs
- MatrixAnimationBase.cs
- CodeIdentifier.cs
- InstalledFontCollection.cs
- CommentEmitter.cs
- DataSourceCache.cs
- FlowDocumentPage.cs
- ObjectCacheHost.cs
- HitTestResult.cs
- BaseTemplateParser.cs
- SqlError.cs
- CollectionBase.cs
- StringToken.cs
- TemplateInstanceAttribute.cs
- AdapterDictionary.cs
- DropDownList.cs
- VariableQuery.cs
- __FastResourceComparer.cs
- BuildProviderCollection.cs
- ListSourceHelper.cs
- InheritanceRules.cs
- ObjectAssociationEndMapping.cs
- DataControlField.cs