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
- DataGridViewColumnConverter.cs
- ReflectPropertyDescriptor.cs
- XmlBindingWorker.cs
- MetadataArtifactLoaderCompositeFile.cs
- CheckoutException.cs
- SessionIDManager.cs
- DockPattern.cs
- TrailingSpaceComparer.cs
- AlphabeticalEnumConverter.cs
- HtmlGenericControl.cs
- CopyAction.cs
- JumpItem.cs
- CacheModeValueSerializer.cs
- EditorBrowsableAttribute.cs
- GridViewColumnCollectionChangedEventArgs.cs
- XmlSchemaAny.cs
- HtmlElementErrorEventArgs.cs
- PeerNearMe.cs
- EditingScopeUndoUnit.cs
- Tag.cs
- TypedReference.cs
- ToolboxItemAttribute.cs
- XPathAncestorQuery.cs
- ContextItemManager.cs
- ExpandedWrapper.cs
- StorageInfo.cs
- ConnectionDemuxer.cs
- PathGeometry.cs
- IntSecurity.cs
- HierarchicalDataBoundControl.cs
- InputLanguageManager.cs
- UserNamePasswordValidationMode.cs
- TrustLevel.cs
- SrgsRulesCollection.cs
- StringFunctions.cs
- WebMessageEncodingBindingElement.cs
- Propagator.Evaluator.cs
- SoapSchemaImporter.cs
- MouseEventArgs.cs
- PlainXmlWriter.cs
- WebEventTraceProvider.cs
- CodeRegionDirective.cs
- SelectorAutomationPeer.cs
- PasswordTextNavigator.cs
- HtmlToClrEventProxy.cs
- PointLight.cs
- DesignSurfaceCollection.cs
- XmlAttributeCache.cs
- HttpValueCollection.cs
- PrimitiveCodeDomSerializer.cs
- FixedSOMSemanticBox.cs
- StateItem.cs
- MailBnfHelper.cs
- XmlBinaryReader.cs
- SoapInteropTypes.cs
- TcpConnectionPoolSettingsElement.cs
- GlobalProxySelection.cs
- CacheManager.cs
- CatalogPartCollection.cs
- AppDomainManager.cs
- TrackBar.cs
- InvalidBodyAccessException.cs
- TextBlock.cs
- Visitors.cs
- Margins.cs
- ListDataHelper.cs
- ValidatingPropertiesEventArgs.cs
- AccessText.cs
- HostingEnvironmentException.cs
- TaskFormBase.cs
- FamilyTypeface.cs
- Oid.cs
- PerformanceCounterManager.cs
- ObjectItemConventionAssemblyLoader.cs
- WinEventTracker.cs
- VariantWrapper.cs
- RoutingTable.cs
- MailAddressCollection.cs
- PropertyConverter.cs
- AlgoModule.cs
- List.cs
- SynchronizedDisposablePool.cs
- MethodAccessException.cs
- DateTimePickerDesigner.cs
- UpdateProgress.cs
- AsymmetricSignatureDeformatter.cs
- SudsCommon.cs
- WebRequestModulesSection.cs
- RijndaelManagedTransform.cs
- Message.cs
- InheritanceService.cs
- HtmlWindowCollection.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- TemplatedEditableDesignerRegion.cs
- ValueQuery.cs
- PingReply.cs
- ConfigurationCollectionAttribute.cs
- TypeLibConverter.cs
- MessageSmuggler.cs
- ListViewItemSelectionChangedEvent.cs