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
- BadImageFormatException.cs
- HierarchicalDataSourceControl.cs
- SpotLight.cs
- TableHeaderCell.cs
- LayoutDump.cs
- TextViewSelectionProcessor.cs
- ExpiredSecurityTokenException.cs
- MarshalDirectiveException.cs
- TextViewBase.cs
- OpenTypeLayoutCache.cs
- SecurityContextCookieSerializer.cs
- PeerNameResolver.cs
- ObjectParameter.cs
- LayoutManager.cs
- DATA_BLOB.cs
- TextSimpleMarkerProperties.cs
- InternalTypeHelper.cs
- MinMaxParagraphWidth.cs
- InfoCardRSACryptoProvider.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- xmlformatgeneratorstatics.cs
- MarshalByRefObject.cs
- WindowsListViewItem.cs
- Single.cs
- DataSourceProvider.cs
- EmulateRecognizeCompletedEventArgs.cs
- WebPartEditorOkVerb.cs
- SoapMessage.cs
- processwaithandle.cs
- DataPagerFieldCollection.cs
- BitmapEffectDrawingContextState.cs
- DocumentGrid.cs
- TrustManager.cs
- DataSet.cs
- AttachedPropertiesService.cs
- SqlDependency.cs
- WebServiceMethodData.cs
- TypedRowGenerator.cs
- DataControlFieldTypeEditor.cs
- EntitySqlQueryCacheKey.cs
- SessionStateUtil.cs
- TypeSystem.cs
- HttpContext.cs
- WebControlParameterProxy.cs
- OSFeature.cs
- WizardForm.cs
- ActiveXContainer.cs
- EventBuilder.cs
- XmlHierarchicalDataSourceView.cs
- DecryptRequest.cs
- TimelineGroup.cs
- DeviceOverridableAttribute.cs
- SerializeAbsoluteContext.cs
- DataGridViewRowsRemovedEventArgs.cs
- FigureParaClient.cs
- ScaleTransform.cs
- VerificationException.cs
- KoreanCalendar.cs
- WindowsFormsHostAutomationPeer.cs
- FocusTracker.cs
- DurableOperationAttribute.cs
- Timer.cs
- InputLangChangeRequestEvent.cs
- StylusShape.cs
- SqlTrackingService.cs
- Condition.cs
- DictionaryBase.cs
- DirectoryRedirect.cs
- OperandQuery.cs
- FixedSOMTableRow.cs
- StandardRuntimeEnumValidator.cs
- HttpServerVarsCollection.cs
- PKCS1MaskGenerationMethod.cs
- CompositeFontParser.cs
- SecurityContextSecurityToken.cs
- OdbcParameter.cs
- MsmqHostedTransportConfiguration.cs
- SafeNativeMethods.cs
- NodeLabelEditEvent.cs
- TokenFactoryBase.cs
- SessionStateSection.cs
- CodeConditionStatement.cs
- AutoCompleteStringCollection.cs
- _SingleItemRequestCache.cs
- Math.cs
- StrokeCollectionDefaultValueFactory.cs
- CodeRegionDirective.cs
- DataAccessException.cs
- CardSpaceShim.cs
- Ticks.cs
- FormView.cs
- WebScriptEndpointElement.cs
- HMACMD5.cs
- cache.cs
- Decorator.cs
- CopyCodeAction.cs
- PageVisual.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- CompositeActivityTypeDescriptorProvider.cs
- Light.cs