Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / BinaryKeyIdentifierClause.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigurationSectionGroup.cs
- Comparer.cs
- StylusOverProperty.cs
- DependencyObjectProvider.cs
- QilStrConcatenator.cs
- ScriptReferenceEventArgs.cs
- ExtendedProperty.cs
- EpmTargetPathSegment.cs
- InputProcessorProfiles.cs
- HttpStaticObjectsCollectionBase.cs
- CompilerCollection.cs
- ElementHostPropertyMap.cs
- ListSortDescription.cs
- xamlnodes.cs
- SqlParameterizer.cs
- DocumentAutomationPeer.cs
- BitSet.cs
- WebPartDisplayModeCollection.cs
- MailAddress.cs
- DataControlCommands.cs
- XmlNamespaceManager.cs
- SpeechSynthesizer.cs
- ServiceNotStartedException.cs
- XomlSerializationHelpers.cs
- DataSvcMapFileSerializer.cs
- AuthorizationSection.cs
- _AuthenticationState.cs
- StringUtil.cs
- WebPartActionVerb.cs
- ConfigurationSectionHelper.cs
- TextWriterEngine.cs
- RepeatInfo.cs
- ExtenderProvidedPropertyAttribute.cs
- EntityDataSourceSelectedEventArgs.cs
- ActiveXSite.cs
- MetadataPropertyvalue.cs
- PolicyLevel.cs
- ModelItemExtensions.cs
- ColorDialog.cs
- ErrorView.xaml.cs
- FtpCachePolicyElement.cs
- TileModeValidation.cs
- ToolBarButtonDesigner.cs
- TriggerAction.cs
- TableCell.cs
- EventListener.cs
- SmiSettersStream.cs
- DesignerMetadata.cs
- EditorZoneBase.cs
- LeaseManager.cs
- AdvancedBindingEditor.cs
- _AuthenticationState.cs
- DateTimeAutomationPeer.cs
- UndirectedGraph.cs
- XmlSchemaAttribute.cs
- TypeConverterAttribute.cs
- LinkConverter.cs
- GeneratedCodeAttribute.cs
- X509UI.cs
- PropertyEntry.cs
- RequestCachePolicyConverter.cs
- FigureParagraph.cs
- EntityDataSourceState.cs
- IdentityNotMappedException.cs
- SvcMapFile.cs
- ServiceConfigurationTraceRecord.cs
- StateMachineWorkflow.cs
- sitestring.cs
- WpfMemberInvoker.cs
- fixedPageContentExtractor.cs
- Bits.cs
- EntityExpressionVisitor.cs
- EncoderNLS.cs
- PageTheme.cs
- RangeExpression.cs
- EventTrigger.cs
- SymbolResolver.cs
- MediaSystem.cs
- SecurityUniqueId.cs
- OrElse.cs
- __FastResourceComparer.cs
- Table.cs
- PropertyDescriptor.cs
- EventProviderWriter.cs
- PcmConverter.cs
- KeyNotFoundException.cs
- TextCompositionEventArgs.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ImageAnimator.cs
- AutoScrollExpandMessageFilter.cs
- LineSegment.cs
- DataListItem.cs
- UpdateManifestForBrowserApplication.cs
- WebBrowserHelper.cs
- XsltContext.cs
- RegistrationServices.cs
- UInt64Converter.cs
- GradientBrush.cs
- SequentialOutput.cs
- AnimationException.cs