Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / X509RawDataKeyIdentifierClause.cs / 1305376 / X509RawDataKeyIdentifierClause.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; using System.Security.Cryptography.X509Certificates; public class X509RawDataKeyIdentifierClause : BinaryKeyIdentifierClause { X509Certificate2 certificate; X509AsymmetricSecurityKey key; public X509RawDataKeyIdentifierClause(X509Certificate2 certificate) : this(GetRawData(certificate), false) { this.certificate = certificate; } public X509RawDataKeyIdentifierClause(byte[] certificateRawData) : this(certificateRawData, true) { } internal X509RawDataKeyIdentifierClause(byte[] certificateRawData, bool cloneBuffer) : base(null, certificateRawData, cloneBuffer) { } public override bool CanCreateKey { get { return true; } } public override SecurityKey CreateKey() { if (this.key == null) { if (this.certificate == null) { this.certificate = new X509Certificate2(GetBuffer()); } this.key = new X509AsymmetricSecurityKey(this.certificate); } return this.key; } static byte[] GetRawData(X509Certificate certificate) { if (certificate == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate"); return certificate.GetRawCertData(); } public byte[] GetX509RawData() { return GetBuffer(); } public bool Matches(X509Certificate2 certificate) { if (certificate == null) return false; return Matches(GetRawData(certificate)); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "X509RawDataKeyIdentifierClause(RawData = {0})", ToBase64String()); } } } // 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 X509RawDataKeyIdentifierClause : BinaryKeyIdentifierClause { X509Certificate2 certificate; X509AsymmetricSecurityKey key; public X509RawDataKeyIdentifierClause(X509Certificate2 certificate) : this(GetRawData(certificate), false) { this.certificate = certificate; } public X509RawDataKeyIdentifierClause(byte[] certificateRawData) : this(certificateRawData, true) { } internal X509RawDataKeyIdentifierClause(byte[] certificateRawData, bool cloneBuffer) : base(null, certificateRawData, cloneBuffer) { } public override bool CanCreateKey { get { return true; } } public override SecurityKey CreateKey() { if (this.key == null) { if (this.certificate == null) { this.certificate = new X509Certificate2(GetBuffer()); } this.key = new X509AsymmetricSecurityKey(this.certificate); } return this.key; } static byte[] GetRawData(X509Certificate certificate) { if (certificate == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("certificate"); return certificate.GetRawCertData(); } public byte[] GetX509RawData() { return GetBuffer(); } public bool Matches(X509Certificate2 certificate) { if (certificate == null) return false; return Matches(GetRawData(certificate)); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "X509RawDataKeyIdentifierClause(RawData = {0})", ToBase64String()); } } } // 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
- Proxy.cs
- MobileContainerDesigner.cs
- StringValidatorAttribute.cs
- InvalidPropValue.cs
- DateTimeConverter2.cs
- ListSourceHelper.cs
- TextTreeExtractElementUndoUnit.cs
- UidPropertyAttribute.cs
- GeometryHitTestParameters.cs
- RegexMatch.cs
- NonBatchDirectoryCompiler.cs
- DragEventArgs.cs
- HasCopySemanticsAttribute.cs
- AssemblyInfo.cs
- Image.cs
- DataSourceCache.cs
- TextBlockAutomationPeer.cs
- InternalSafeNativeMethods.cs
- TypeDependencyAttribute.cs
- ToolStripDropDownButton.cs
- DataGridParentRows.cs
- X509Certificate.cs
- BitmapVisualManager.cs
- CodeBinaryOperatorExpression.cs
- TextDecorationUnitValidation.cs
- NodeInfo.cs
- XComponentModel.cs
- RemoveStoryboard.cs
- RuntimeConfigLKG.cs
- ObjectDataSourceSelectingEventArgs.cs
- ToolStripPanelCell.cs
- TextMetrics.cs
- ApplicationSecurityManager.cs
- MarkupExtensionParser.cs
- BaseTemplateParser.cs
- DynamicResourceExtensionConverter.cs
- HttpResponse.cs
- Section.cs
- SpeakCompletedEventArgs.cs
- hresults.cs
- SignatureToken.cs
- MissingFieldException.cs
- UxThemeWrapper.cs
- HMACSHA256.cs
- SqlDataSourceWizardForm.cs
- unsafenativemethodsother.cs
- serverconfig.cs
- GeometryDrawing.cs
- Codec.cs
- TypeUnloadedException.cs
- MouseBinding.cs
- GorillaCodec.cs
- HttpListenerException.cs
- ToolStripDropDownClosingEventArgs.cs
- Opcode.cs
- WebBrowserDesigner.cs
- CaseCqlBlock.cs
- ComponentResourceManager.cs
- ApplicationHost.cs
- PtsContext.cs
- Label.cs
- UnmanagedMemoryStream.cs
- CompositionCommandSet.cs
- Avt.cs
- ClientRuntimeConfig.cs
- XPathEmptyIterator.cs
- GenerateTemporaryTargetAssembly.cs
- XmlNodeWriter.cs
- GridViewRow.cs
- Size.cs
- versioninfo.cs
- ImageMapEventArgs.cs
- GenericsInstances.cs
- MetadataArtifactLoaderComposite.cs
- TableRow.cs
- ProfileProvider.cs
- ItemType.cs
- TemplateGroupCollection.cs
- ContentHostHelper.cs
- ToggleButton.cs
- RelationshipConverter.cs
- GridViewEditEventArgs.cs
- SecurityTokenReferenceStyle.cs
- SeparatorAutomationPeer.cs
- HyperLinkStyle.cs
- TypedColumnHandler.cs
- LineSegment.cs
- propertytag.cs
- InputGestureCollection.cs
- RangeValuePattern.cs
- BasePropertyDescriptor.cs
- IntSecurity.cs
- DateTimeConverter.cs
- FormatException.cs
- BeginEvent.cs
- InheritanceAttribute.cs
- DynamicRenderer.cs
- KeyManager.cs
- ConnectionStringsSection.cs
- PropertyPath.cs