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
- PathTooLongException.cs
- ELinqQueryState.cs
- RootBrowserWindowProxy.cs
- NestPullup.cs
- KeySplineConverter.cs
- KeyedCollection.cs
- SQLMoneyStorage.cs
- PersonalizationDictionary.cs
- CompModHelpers.cs
- MonthCalendar.cs
- ServerProtocol.cs
- ComponentResourceKey.cs
- EntityDataSourceViewSchema.cs
- PrivilegedConfigurationManager.cs
- CodeDelegateCreateExpression.cs
- XmlFormatExtensionPrefixAttribute.cs
- WebCategoryAttribute.cs
- CssStyleCollection.cs
- WSDualHttpSecurity.cs
- DisplayInformation.cs
- PropertyEmitterBase.cs
- PageParser.cs
- CoTaskMemHandle.cs
- PersonalizationState.cs
- CalloutQueueItem.cs
- HorizontalAlignConverter.cs
- CodeMemberMethod.cs
- RenderContext.cs
- CatalogZoneBase.cs
- DecimalAnimation.cs
- DiscoveryInnerClientAdhoc11.cs
- BmpBitmapDecoder.cs
- Column.cs
- Block.cs
- SchemaImporterExtensionElement.cs
- UrlAuthFailureHandler.cs
- ImageListStreamer.cs
- util.cs
- SmiTypedGetterSetter.cs
- StringUtil.cs
- Configuration.cs
- SignatureResourcePool.cs
- SizeLimitedCache.cs
- Util.cs
- TablePatternIdentifiers.cs
- XmlSchemaDatatype.cs
- CodeVariableReferenceExpression.cs
- WmpBitmapEncoder.cs
- Item.cs
- DataServiceClientException.cs
- SerializationSectionGroup.cs
- AuthenticationService.cs
- ExtentCqlBlock.cs
- ListManagerBindingsCollection.cs
- DebugHandleTracker.cs
- SystemIPv6InterfaceProperties.cs
- HijriCalendar.cs
- xmlfixedPageInfo.cs
- DataGridHeaderBorder.cs
- WebConvert.cs
- SqlAliasesReferenced.cs
- PasswordTextContainer.cs
- XmlHelper.cs
- httpapplicationstate.cs
- TextDecorationCollection.cs
- StrongNameMembershipCondition.cs
- HttpCachePolicy.cs
- EncodingInfo.cs
- XPathConvert.cs
- NativeMethods.cs
- HtmlEmptyTagControlBuilder.cs
- HtmlInputFile.cs
- XamlWriter.cs
- PointConverter.cs
- MessageSmuggler.cs
- GroupBox.cs
- UnsafeNativeMethods.cs
- BackgroundWorker.cs
- Mappings.cs
- ResourcePermissionBase.cs
- SecurityException.cs
- TextParentUndoUnit.cs
- PasswordRecovery.cs
- DynamicILGenerator.cs
- StorageRoot.cs
- CustomTypeDescriptor.cs
- DefaultMergeHelper.cs
- TransformerInfo.cs
- OleDbDataAdapter.cs
- TextTreeUndoUnit.cs
- StringComparer.cs
- ContextMenuStrip.cs
- RadioButton.cs
- DocumentReferenceCollection.cs
- Int32KeyFrameCollection.cs
- Vars.cs
- BitmapImage.cs
- HwndSourceParameters.cs
- dbenumerator.cs
- _SSPISessionCache.cs