Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / X509SubjectKeyIdentifierClause.cs / 1 / X509SubjectKeyIdentifierClause.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; using System.Security.Cryptography.X509Certificates; public class X509SubjectKeyIdentifierClause : BinaryKeyIdentifierClause { const string SubjectKeyIdentifierOid = "2.5.29.14"; const int SkiDataOffset = 2; public X509SubjectKeyIdentifierClause(byte[] ski) : this(ski, true) { } internal X509SubjectKeyIdentifierClause(byte[] ski, bool cloneBuffer) : base(null, ski, cloneBuffer) { } static byte[] GetSkiRawData(X509Certificate2 certificate) { if (certificate == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate"); X509SubjectKeyIdentifierExtension skiExtension = certificate.Extensions[SubjectKeyIdentifierOid] as X509SubjectKeyIdentifierExtension; if (skiExtension != null) { return skiExtension.RawData; } else { return null; } } public byte[] GetX509SubjectKeyIdentifier() { return GetBuffer(); } public bool Matches(X509Certificate2 certificate) { if (certificate == null) return false; byte[] data = GetSkiRawData(certificate); return data != null && Matches(data, SkiDataOffset); } public static bool TryCreateFrom(X509Certificate2 certificate, out X509SubjectKeyIdentifierClause keyIdentifierClause) { byte[] data = GetSkiRawData(certificate); keyIdentifierClause = null; if (data != null) { byte[] ski = SecurityUtils.CloneBuffer(data, SkiDataOffset, data.Length - SkiDataOffset); keyIdentifierClause = new X509SubjectKeyIdentifierClause(ski, false); } return keyIdentifierClause != null; } public static bool CanCreateFrom(X509Certificate2 certificate) { return null != GetSkiRawData(certificate); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "X509SubjectKeyIdentifierClause(SKI = 0x{0})", ToHexString()); } } } // 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
- CacheVirtualItemsEvent.cs
- XamlWriterExtensions.cs
- PageHandlerFactory.cs
- TabPanel.cs
- CompressionTransform.cs
- TrackingMemoryStreamFactory.cs
- XamlPointCollectionSerializer.cs
- safelink.cs
- Helper.cs
- Composition.cs
- PersonalizationProviderCollection.cs
- WmlPhoneCallAdapter.cs
- PrinterSettings.cs
- XmlSchemaComplexType.cs
- mansign.cs
- DirectoryObjectSecurity.cs
- Roles.cs
- EDesignUtil.cs
- PhysicalFontFamily.cs
- Attributes.cs
- ErrorProvider.cs
- SafeNativeMethods.cs
- FragmentQueryProcessor.cs
- PackageRelationshipCollection.cs
- HashAlgorithm.cs
- TraceLevelStore.cs
- WebUtil.cs
- OAVariantLib.cs
- TreeView.cs
- PasswordBox.cs
- Validator.cs
- CompileLiteralTextParser.cs
- unsafenativemethodstextservices.cs
- ObjectItemCollection.cs
- AccessibleObject.cs
- PresentationAppDomainManager.cs
- HashHelpers.cs
- BinaryConverter.cs
- EdmSchemaAttribute.cs
- HandleRef.cs
- Roles.cs
- HotSpot.cs
- HandlerBase.cs
- WebReferenceCollection.cs
- RoleManagerModule.cs
- DesignerSerializationVisibilityAttribute.cs
- ApplicationServiceHelper.cs
- XmlSchemaAny.cs
- EntityDataSourceContextDisposingEventArgs.cs
- GridViewEditEventArgs.cs
- Debug.cs
- TableParaClient.cs
- DesignerDataSourceView.cs
- CopyNodeSetAction.cs
- WindowsPen.cs
- CompressStream.cs
- XmlWriterTraceListener.cs
- RootBrowserWindowAutomationPeer.cs
- StoragePropertyMapping.cs
- Margins.cs
- NetworkCredential.cs
- TreeView.cs
- BasicExpandProvider.cs
- PolyBezierSegment.cs
- Positioning.cs
- X509CertificateCollection.cs
- GridEntryCollection.cs
- X500Name.cs
- SettingsPropertyNotFoundException.cs
- ProfileServiceManager.cs
- xamlnodes.cs
- PrintController.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- Range.cs
- EditorAttribute.cs
- EntityUtil.cs
- TemplateBindingExtension.cs
- EntityDataSource.cs
- ExclusiveNamedPipeTransportManager.cs
- EmptyControlCollection.cs
- LambdaCompiler.Logical.cs
- PageOrientation.cs
- baseshape.cs
- StylusLogic.cs
- X509CertificateCollection.cs
- XmlSchemaSubstitutionGroup.cs
- DES.cs
- WaitHandleCannotBeOpenedException.cs
- CacheAxisQuery.cs
- AuthenticationServiceManager.cs
- DoubleKeyFrameCollection.cs
- MailWriter.cs
- SrgsText.cs
- ThreadPool.cs
- FolderLevelBuildProvider.cs
- ButtonBaseAutomationPeer.cs
- XslException.cs
- BindValidator.cs
- ClassImporter.cs
- MonthCalendar.cs