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
- QueryExpr.cs
- TextSchema.cs
- MsmqIntegrationChannelListener.cs
- Context.cs
- dataobject.cs
- PersistChildrenAttribute.cs
- MethodExpression.cs
- StoreItemCollection.Loader.cs
- DocumentReference.cs
- SeekStoryboard.cs
- VBIdentifierName.cs
- ZoomingMessageFilter.cs
- Funcletizer.cs
- MetaColumn.cs
- ObfuscationAttribute.cs
- SHA384.cs
- FormatException.cs
- XamlGridLengthSerializer.cs
- ObjectListItem.cs
- ProtocolsSection.cs
- PenContexts.cs
- listviewsubitemcollectioneditor.cs
- unsafenativemethodstextservices.cs
- DBCSCodePageEncoding.cs
- DocumentOrderQuery.cs
- ResourceDescriptionAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DataListDesigner.cs
- BamlWriter.cs
- PathFigure.cs
- XamlBrushSerializer.cs
- MouseDevice.cs
- AlphabeticalEnumConverter.cs
- FileDialogCustomPlace.cs
- UnsafePeerToPeerMethods.cs
- WebServiceParameterData.cs
- NativeMethods.cs
- MissingMethodException.cs
- PagesSection.cs
- SmiSettersStream.cs
- ConvertEvent.cs
- MessageParameterAttribute.cs
- AssemblyUtil.cs
- NumericUpDownAcceleration.cs
- ListViewCancelEventArgs.cs
- Pens.cs
- TraceRecords.cs
- Style.cs
- LogicalExpr.cs
- AppDomainFactory.cs
- DesignerCalendarAdapter.cs
- ListViewDeletedEventArgs.cs
- XmlSchemaSimpleContentRestriction.cs
- DataServiceProviderWrapper.cs
- DataSourceCacheDurationConverter.cs
- WorkflowCompensationBehavior.cs
- Operator.cs
- SimpleWorkerRequest.cs
- DataGridDetailsPresenterAutomationPeer.cs
- ProfileGroupSettingsCollection.cs
- XmlSchemaCollection.cs
- InvalidWMPVersionException.cs
- ListControlConvertEventArgs.cs
- Matrix.cs
- ItemChangedEventArgs.cs
- XPathSingletonIterator.cs
- FieldAccessException.cs
- HtmlWindowCollection.cs
- BamlRecords.cs
- RealProxy.cs
- LocalizationComments.cs
- WebPartDescriptionCollection.cs
- BinaryConverter.cs
- Cursor.cs
- FlowLayoutPanel.cs
- RouteUrlExpressionBuilder.cs
- CommandBinding.cs
- OleDbDataAdapter.cs
- PrintDialogException.cs
- DBConnectionString.cs
- NetMsmqSecurityElement.cs
- SafeNativeMemoryHandle.cs
- XAMLParseException.cs
- Missing.cs
- Grid.cs
- DirectoryObjectSecurity.cs
- MessageEnumerator.cs
- MsmqOutputMessage.cs
- DefaultMemberAttribute.cs
- MainMenu.cs
- OperationResponse.cs
- XmlSchemaAppInfo.cs
- BitmapEffectGroup.cs
- BitmapEffectRenderDataResource.cs
- CharStorage.cs
- CodeTypeMember.cs
- ConfigurationManagerInternalFactory.cs
- ProxyWebPartManager.cs
- iisPickupDirectory.cs
- SaveLedgerEntryRequest.cs