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
- SendMailErrorEventArgs.cs
- TransactionException.cs
- ListBindingHelper.cs
- HttpTransportElement.cs
- Figure.cs
- SerializationStore.cs
- OuterProxyWrapper.cs
- TypeConverterHelper.cs
- Profiler.cs
- MouseDevice.cs
- TextTreeUndoUnit.cs
- CodeAccessPermission.cs
- SQLInt32Storage.cs
- Path.cs
- Relationship.cs
- DiffuseMaterial.cs
- RadioButton.cs
- OletxVolatileEnlistment.cs
- XmlDataSourceNodeDescriptor.cs
- EntryIndex.cs
- MultiView.cs
- ContainerUtilities.cs
- XmlSchemaObjectTable.cs
- Parameter.cs
- HandledEventArgs.cs
- CollectionChangeEventArgs.cs
- XamlWriter.cs
- InstanceHandleConflictException.cs
- SmiContextFactory.cs
- ElapsedEventArgs.cs
- Update.cs
- Action.cs
- FixedSOMPage.cs
- CodeTypeOfExpression.cs
- EventManager.cs
- XmlParserContext.cs
- LongSumAggregationOperator.cs
- TileBrush.cs
- ManagementScope.cs
- WebChannelFactory.cs
- WebPartDisplayModeCollection.cs
- IdentifierService.cs
- CellCreator.cs
- SrgsGrammarCompiler.cs
- BrowserDefinitionCollection.cs
- DrawingAttributesDefaultValueFactory.cs
- StatusBarItemAutomationPeer.cs
- NoneExcludedImageIndexConverter.cs
- XmlSchemaCompilationSettings.cs
- ImageIndexEditor.cs
- UnionExpr.cs
- WebColorConverter.cs
- SerializationObjectManager.cs
- ContextDataSourceContextData.cs
- RowTypeElement.cs
- TextEncodedRawTextWriter.cs
- JournalEntryListConverter.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- XmlElementAttributes.cs
- RC2.cs
- ValidationErrorInfo.cs
- RadioButtonFlatAdapter.cs
- VisualStyleElement.cs
- ColumnResult.cs
- Translator.cs
- GraphicsPath.cs
- WebCategoryAttribute.cs
- SignHashRequest.cs
- BaseTreeIterator.cs
- ComponentCommands.cs
- LocalValueEnumerator.cs
- ArrayConverter.cs
- ControlCachePolicy.cs
- CodeComment.cs
- VerticalAlignConverter.cs
- ITextView.cs
- VirtualizedCellInfoCollection.cs
- ScaleTransform3D.cs
- PreloadedPackages.cs
- LinqDataSourceInsertEventArgs.cs
- EntityObject.cs
- FastPropertyAccessor.cs
- BitmapEffectOutputConnector.cs
- UserControlAutomationPeer.cs
- PermissionListSet.cs
- ReaderWriterLockWrapper.cs
- AnnotationDocumentPaginator.cs
- GenericTextProperties.cs
- QilGenerator.cs
- DescendentsWalkerBase.cs
- ResourcePart.cs
- Base64Stream.cs
- VersionUtil.cs
- DesignerForm.cs
- BufferModesCollection.cs
- SecurityAppliedMessage.cs
- X509ChainElement.cs
- StreamAsIStream.cs
- QuotedPairReader.cs
- WasEndpointConfigContainer.cs