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
- SecurityContext.cs
- HtmlInputReset.cs
- IPEndPoint.cs
- Label.cs
- HttpResponse.cs
- ToolStripProgressBar.cs
- SpeechSeg.cs
- ToolStripPanelCell.cs
- DefaultBinder.cs
- DetailsViewUpdatedEventArgs.cs
- Control.cs
- WebColorConverter.cs
- Calendar.cs
- MobileCategoryAttribute.cs
- WindowsTab.cs
- ToolStripEditorManager.cs
- CorrelationActionMessageFilter.cs
- EnumUnknown.cs
- WebBrowserBase.cs
- MaskPropertyEditor.cs
- AssertHelper.cs
- DataSourceBooleanViewSchemaConverter.cs
- IncrementalHitTester.cs
- SessionParameter.cs
- MarginCollapsingState.cs
- SuppressIldasmAttribute.cs
- DropDownList.cs
- InvalidCardException.cs
- DynamicRendererThreadManager.cs
- TreeWalkHelper.cs
- DbConnectionFactory.cs
- DataKeyCollection.cs
- ControlPersister.cs
- EllipticalNodeOperations.cs
- MemberDescriptor.cs
- DateTimeFormatInfoScanner.cs
- Operator.cs
- InputReportEventArgs.cs
- BitmapCodecInfoInternal.cs
- mediapermission.cs
- CounterSampleCalculator.cs
- MultiTrigger.cs
- BindingContext.cs
- ScrollItemPatternIdentifiers.cs
- StrongTypingException.cs
- DeflateEmulationStream.cs
- ListItem.cs
- ClientConfigPaths.cs
- KeyValuePairs.cs
- CodeTypeMemberCollection.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- Transform3DGroup.cs
- DynamicVirtualDiscoSearcher.cs
- LocalClientSecuritySettings.cs
- ClientBuildManagerCallback.cs
- FormViewUpdateEventArgs.cs
- documentsequencetextview.cs
- MSAAWinEventWrap.cs
- EncryptedKeyIdentifierClause.cs
- Schema.cs
- TableLayoutRowStyleCollection.cs
- XmlnsDictionary.cs
- CellRelation.cs
- ImmComposition.cs
- InvalidOleVariantTypeException.cs
- ToolStripRendererSwitcher.cs
- TextServicesHost.cs
- AuthenticateEventArgs.cs
- XmlReaderSettings.cs
- oledbmetadatacolumnnames.cs
- OutOfMemoryException.cs
- InvokePattern.cs
- PropertyPath.cs
- CloudCollection.cs
- EmptyCollection.cs
- Drawing.cs
- Subtree.cs
- BookmarkUndoUnit.cs
- EventHandlerList.cs
- ScriptReferenceBase.cs
- TypeConverterHelper.cs
- ActiveDocumentEvent.cs
- ActiveDocumentEvent.cs
- CalloutQueueItem.cs
- StringConverter.cs
- DataGridViewElement.cs
- Util.cs
- CodeParameterDeclarationExpression.cs
- ClientOptions.cs
- ChangesetResponse.cs
- ScriptControlDescriptor.cs
- SoapExtension.cs
- StrokeNodeOperations2.cs
- StringUtil.cs
- FlowDocumentScrollViewer.cs
- SettingsAttributeDictionary.cs
- Resources.Designer.cs
- XPathChildIterator.cs
- WebPartDisplayModeCancelEventArgs.cs
- ObjectListComponentEditor.cs