Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / X509SubjectKeyIdentifierClause.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolstripProfessionalRenderer.cs
- SqlProviderManifest.cs
- PlainXmlDeserializer.cs
- SchemaCollectionPreprocessor.cs
- EventLogEntry.cs
- Single.cs
- XamlTemplateSerializer.cs
- PropertyChangedEventManager.cs
- ExpandCollapsePattern.cs
- ellipse.cs
- DataGridRowClipboardEventArgs.cs
- ConsumerConnectionPoint.cs
- HtmlTextArea.cs
- PhoneCall.cs
- AnnotationObservableCollection.cs
- listitem.cs
- SecurityContext.cs
- ToggleButton.cs
- Crypto.cs
- CancellationHandlerDesigner.cs
- InnerItemCollectionView.cs
- LoginName.cs
- CollectionViewGroup.cs
- HtmlTernaryTree.cs
- AllMembershipCondition.cs
- WebProxyScriptElement.cs
- HMAC.cs
- ColorContext.cs
- Point3DIndependentAnimationStorage.cs
- DataGridViewAddColumnDialog.cs
- ToolStripPanelRenderEventArgs.cs
- SafeEventHandle.cs
- OutputCacheProfile.cs
- Ops.cs
- COM2PictureConverter.cs
- Substitution.cs
- ProcessModelSection.cs
- wpf-etw.cs
- GridErrorDlg.cs
- AppSettingsReader.cs
- SecureEnvironment.cs
- SqlServer2KCompatibilityCheck.cs
- UniqueIdentifierService.cs
- ChannelSinkStacks.cs
- UrlPath.cs
- _OverlappedAsyncResult.cs
- MutexSecurity.cs
- PerformanceCounterCategory.cs
- ExpressionNode.cs
- TreeNodeClickEventArgs.cs
- AdvancedBindingEditor.cs
- GeneralTransform3DGroup.cs
- UrlPath.cs
- AllowedAudienceUriElement.cs
- XPathNavigator.cs
- Size.cs
- PlanCompiler.cs
- LongCountAggregationOperator.cs
- ListSourceHelper.cs
- Util.cs
- PresentationTraceSources.cs
- SimpleModelProvider.cs
- _CacheStreams.cs
- TrackingStringDictionary.cs
- SoapReflector.cs
- BufferedReadStream.cs
- XmlSchemaAnyAttribute.cs
- RootBrowserWindow.cs
- MULTI_QI.cs
- PageVisual.cs
- TemplateControlParser.cs
- Token.cs
- RIPEMD160.cs
- CroppedBitmap.cs
- TextureBrush.cs
- HitTestWithGeometryDrawingContextWalker.cs
- MetadataFile.cs
- DocumentXPathNavigator.cs
- InternalCache.cs
- InputScopeConverter.cs
- MatrixCamera.cs
- OSFeature.cs
- MarkupCompilePass1.cs
- ZipFileInfo.cs
- DefaultObjectMappingItemCollection.cs
- StandardOleMarshalObject.cs
- SqlNamer.cs
- KoreanLunisolarCalendar.cs
- SspiSecurityTokenParameters.cs
- DesignRelation.cs
- GridViewColumnHeaderAutomationPeer.cs
- FactoryMaker.cs
- TopClause.cs
- FirstMatchCodeGroup.cs
- KeyPullup.cs
- UpdatePanel.cs
- FontCacheLogic.cs
- FlowDocument.cs
- ComNativeDescriptor.cs
- HTMLTextWriter.cs