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
- BeginGetFileNameFromUserRequest.cs
- StateWorkerRequest.cs
- QueryableDataSource.cs
- ChtmlCalendarAdapter.cs
- Matrix3DConverter.cs
- WsdlHelpGeneratorElement.cs
- EventBookmark.cs
- CellConstant.cs
- exports.cs
- InstanceNotFoundException.cs
- SecurityException.cs
- HtmlInputSubmit.cs
- DebugView.cs
- Label.cs
- UniqueIdentifierService.cs
- HtmlTableRow.cs
- SoapTypeAttribute.cs
- QilIterator.cs
- XPathException.cs
- DataGridViewRowsRemovedEventArgs.cs
- MessagePropertyFilter.cs
- CodeChecksumPragma.cs
- DataGridTablesFactory.cs
- PatternMatchRules.cs
- SqlConnectionString.cs
- ZipIOExtraField.cs
- WindowPattern.cs
- TdsParameterSetter.cs
- Rules.cs
- NamespaceList.cs
- SerializationEventsCache.cs
- _OverlappedAsyncResult.cs
- EntityTypeBase.cs
- hresults.cs
- Control.cs
- rsa.cs
- BezierSegment.cs
- UriWriter.cs
- XXXOnTypeBuilderInstantiation.cs
- PermissionAttributes.cs
- Vector3DCollection.cs
- HelpProvider.cs
- TextTreeUndo.cs
- SoapExtensionImporter.cs
- XmlSchemaAny.cs
- _SecureChannel.cs
- NativeRightsManagementAPIsStructures.cs
- ObjectNotFoundException.cs
- RelationshipType.cs
- DataListCommandEventArgs.cs
- ClientSession.cs
- PropertyChangedEventArgs.cs
- StatusBarPanel.cs
- OdbcDataReader.cs
- Compiler.cs
- TypeBuilder.cs
- Pointer.cs
- OrderablePartitioner.cs
- CompModSwitches.cs
- GACIdentityPermission.cs
- ExpanderAutomationPeer.cs
- MarginCollapsingState.cs
- NativeObjectSecurity.cs
- ToggleProviderWrapper.cs
- BuildManager.cs
- CachedRequestParams.cs
- StringValidatorAttribute.cs
- ProcessThreadCollection.cs
- StylusEventArgs.cs
- RepeatInfo.cs
- EffectiveValueEntry.cs
- RichTextBox.cs
- ProxySimple.cs
- InvokeMethodActivity.cs
- EncryptedXml.cs
- TextPattern.cs
- SecurityResources.cs
- GetLedgerEntryForRecipientRequest.cs
- FontCacheLogic.cs
- MethodCallConverter.cs
- Perspective.cs
- RegexCompiler.cs
- SoapCodeExporter.cs
- ConnectorDragDropGlyph.cs
- Ipv6Element.cs
- ManifestBasedResourceGroveler.cs
- WebPartEditorCancelVerb.cs
- ProtocolsConfigurationEntry.cs
- ExecutionContext.cs
- TransformerInfoCollection.cs
- PageVisual.cs
- SettingsBase.cs
- MethodRental.cs
- CollectionView.cs
- SecurityKeyEntropyMode.cs
- JoinElimination.cs
- Underline.cs
- PolicyLevel.cs
- CodeIdentifier.cs
- DomainUpDown.cs