Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / X509ThumbprintKeyIdentifierClause.cs / 1305376 / X509ThumbprintKeyIdentifierClause.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; using System.Security.Cryptography.X509Certificates; public class X509ThumbprintKeyIdentifierClause : BinaryKeyIdentifierClause { public X509ThumbprintKeyIdentifierClause(X509Certificate2 certificate) : this(GetHash(certificate), false) { } public X509ThumbprintKeyIdentifierClause(byte[] thumbprint) : this(thumbprint, true) { } internal X509ThumbprintKeyIdentifierClause(byte[] thumbprint, bool cloneBuffer) : base(null, thumbprint, cloneBuffer) { } static byte[] GetHash(X509Certificate2 certificate) { if (certificate == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate"); return certificate.GetCertHash(); } public byte[] GetX509Thumbprint() { return GetBuffer(); } public bool Matches(X509Certificate2 certificate) { if (certificate == null) return false; return Matches(GetHash(certificate)); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "X509ThumbprintKeyIdentifierClause(Hash = 0x{0})", ToHexString()); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; using System.Security.Cryptography.X509Certificates; public class X509ThumbprintKeyIdentifierClause : BinaryKeyIdentifierClause { public X509ThumbprintKeyIdentifierClause(X509Certificate2 certificate) : this(GetHash(certificate), false) { } public X509ThumbprintKeyIdentifierClause(byte[] thumbprint) : this(thumbprint, true) { } internal X509ThumbprintKeyIdentifierClause(byte[] thumbprint, bool cloneBuffer) : base(null, thumbprint, cloneBuffer) { } static byte[] GetHash(X509Certificate2 certificate) { if (certificate == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate"); return certificate.GetCertHash(); } public byte[] GetX509Thumbprint() { return GetBuffer(); } public bool Matches(X509Certificate2 certificate) { if (certificate == null) return false; return Matches(GetHash(certificate)); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "X509ThumbprintKeyIdentifierClause(Hash = 0x{0})", ToHexString()); } } } // 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
- AuthenticatingEventArgs.cs
- ProgressBar.cs
- NameTable.cs
- SystemIPGlobalProperties.cs
- RectAnimationBase.cs
- SpeechEvent.cs
- LoginName.cs
- ClientProxyGenerator.cs
- SettingsPropertyIsReadOnlyException.cs
- SchemaCollectionPreprocessor.cs
- WindowsRichEdit.cs
- WebPartExportVerb.cs
- SchemaMapping.cs
- HttpModulesSection.cs
- DataBindingHandlerAttribute.cs
- NonVisualControlAttribute.cs
- _CacheStreams.cs
- SafeThemeHandle.cs
- ListSortDescriptionCollection.cs
- TableLayoutStyle.cs
- WriteTimeStream.cs
- SchemaImporterExtensionsSection.cs
- ExtensionWindowHeader.cs
- ApplicationSecurityManager.cs
- StandardToolWindows.cs
- XmlSerializerNamespaces.cs
- StorageAssociationSetMapping.cs
- OutArgument.cs
- StyleBamlRecordReader.cs
- UserPreferenceChangingEventArgs.cs
- ControlParameter.cs
- ProcessModelSection.cs
- PolyLineSegmentFigureLogic.cs
- BooleanKeyFrameCollection.cs
- BinaryMethodMessage.cs
- shaper.cs
- DataRecordInternal.cs
- EndpointDiscoveryMetadata11.cs
- BufferedMessageData.cs
- LineSegment.cs
- XmlAttributeProperties.cs
- Positioning.cs
- CollaborationHelperFunctions.cs
- ApplicationBuildProvider.cs
- ConfigurationSchemaErrors.cs
- PolicyAssertionCollection.cs
- Geometry3D.cs
- Internal.cs
- HostSecurityManager.cs
- InstanceKeyCollisionException.cs
- DependentList.cs
- LeaseManager.cs
- TimeSpanStorage.cs
- ThreadPool.cs
- LocalizedNameDescriptionPair.cs
- ProtocolElement.cs
- QueryCacheKey.cs
- _NestedMultipleAsyncResult.cs
- CreatingCookieEventArgs.cs
- TypeCollectionDesigner.xaml.cs
- SerialErrors.cs
- DataConnectionHelper.cs
- _KerberosClient.cs
- Hex.cs
- StrongNameUtility.cs
- SchemaAttDef.cs
- EventLogEntryCollection.cs
- EncryptedPackageFilter.cs
- OrderByQueryOptionExpression.cs
- LineServicesRun.cs
- PersianCalendar.cs
- GridViewPageEventArgs.cs
- MenuBase.cs
- NavigateEvent.cs
- ValidationRule.cs
- ReliabilityContractAttribute.cs
- ResolveMatchesCD1.cs
- AmbientProperties.cs
- HttpProfileBase.cs
- IWorkflowDebuggerService.cs
- OLEDB_Enum.cs
- InkPresenterAutomationPeer.cs
- HttpConfigurationContext.cs
- SectionInformation.cs
- CultureInfo.cs
- RequestDescription.cs
- TripleDESCryptoServiceProvider.cs
- _AcceptOverlappedAsyncResult.cs
- InvalidEnumArgumentException.cs
- TextUtf8RawTextWriter.cs
- VirtualPathUtility.cs
- ImageBrush.cs
- EncryptedXml.cs
- ConfigXmlSignificantWhitespace.cs
- DrawingContext.cs
- WaitHandle.cs
- HijriCalendar.cs
- EncodingInfo.cs
- SubclassTypeValidatorAttribute.cs
- PropertyEmitterBase.cs