Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / X509CertificateTokenFactoryCredential.cs / 1 / X509CertificateTokenFactoryCredential.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.IO; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.Xml; using System.Text; internal class X509CertificateTokenFactoryCredential : TokenFactoryCredential { X509Certificate2 m_cert; string m_contextKey; string m_portName; UIAgentRequest m_request; bool m_disposed = false; object m_sync = new object(); public X509CertificateTokenFactoryCredential( UIAgentRequest request ) : base( TokenFactoryCredentialType.X509CertificateCredential ) { m_request = request; } // // Get/Set the context key for the credential. // public string ContextKey { get{ return m_contextKey; } } // // Summary: // Get/Set the Rpc Port name // public string PortName { get{ return m_portName; } } // // Summary: // Get/Set certificate // public X509Certificate2 Certificate { get{ return m_cert; } } // // Summary: // Populate class members from reader // protected override void DeserializeData( BinaryReader reader ) { m_portName = Utility.DeserializeString( reader ); m_contextKey = Utility.DeserializeString( reader ); byte[] certBytes = new byte[ reader.ReadInt32() ]; reader.Read( certBytes, 0, certBytes.Length ); m_cert = new X509Certificate2( certBytes ); m_cert.PrivateKey = new RemoteCryptoRsaServiceProvider( this, m_request ); } public override void Dispose( bool disposing ) { if ( m_disposed ) { return; } lock( m_sync ) { if( m_disposed ) { return; } try { if( disposing ) { // // Dispose managed resources // // // This internall calls PrivateKey.Dispose which in turn closes the // smartcard context // this.m_cert.PrivateKey.Clear(); this.m_cert.PublicKey.Key.Clear(); } // // Dispose unmanaged resources // m_disposed = true; } finally { base.Dispose( disposing ); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewCellLinkedList.cs
- ImageIndexEditor.cs
- indexingfiltermarshaler.cs
- MenuAdapter.cs
- RIPEMD160.cs
- PropertyValueChangedEvent.cs
- DataGridViewRowCollection.cs
- IIS7UserPrincipal.cs
- PictureBox.cs
- UrlMappingCollection.cs
- HashCodeCombiner.cs
- SspiWrapper.cs
- GeneratedCodeAttribute.cs
- RoleServiceManager.cs
- DataGrid.cs
- MouseEventArgs.cs
- IntSumAggregationOperator.cs
- Bitmap.cs
- SettingsPropertyValueCollection.cs
- DirectoryObjectSecurity.cs
- SmtpNtlmAuthenticationModule.cs
- RunClient.cs
- FacetValues.cs
- ServiceDesigner.cs
- WorkflowIdleBehavior.cs
- XmlSequenceWriter.cs
- XPathDocumentBuilder.cs
- ConstraintStruct.cs
- ProfileInfo.cs
- PaintEvent.cs
- SimpleHandlerBuildProvider.cs
- KeyEventArgs.cs
- AdobeCFFWrapper.cs
- ParameterDataSourceExpression.cs
- IgnoreFileBuildProvider.cs
- HostedElements.cs
- ContextMarshalException.cs
- ColumnClickEvent.cs
- QueryCacheManager.cs
- BufferedWebEventProvider.cs
- SQLSingleStorage.cs
- TransportSecurityHelpers.cs
- HttpException.cs
- FileRegion.cs
- BackoffTimeoutHelper.cs
- EnvironmentPermission.cs
- AnnotationResource.cs
- ProfileInfo.cs
- GridViewItemAutomationPeer.cs
- ForEachDesigner.xaml.cs
- DBSqlParserColumn.cs
- StrokeFIndices.cs
- TextEmbeddedObject.cs
- COM2IPerPropertyBrowsingHandler.cs
- ActivityTrace.cs
- WorkflowPersistenceService.cs
- WebZoneDesigner.cs
- ZeroOpNode.cs
- PathFigureCollection.cs
- HtmlTextViewAdapter.cs
- DataGridViewElement.cs
- KeySpline.cs
- MarkupCompiler.cs
- HttpRequestCacheValidator.cs
- InternalConfigConfigurationFactory.cs
- ExceptionHelpers.cs
- MeshGeometry3D.cs
- WebPartsPersonalizationAuthorization.cs
- TextRunProperties.cs
- UnsafeNetInfoNativeMethods.cs
- BrowserDefinitionCollection.cs
- HwndHostAutomationPeer.cs
- Section.cs
- XmlReaderSettings.cs
- DataBindingExpressionBuilder.cs
- UserPreferenceChangedEventArgs.cs
- ObjectViewQueryResultData.cs
- SymbolEqualComparer.cs
- TabPanel.cs
- SvcMapFileSerializer.cs
- AsyncStreamReader.cs
- FontUnitConverter.cs
- PrintController.cs
- FlagsAttribute.cs
- COM2TypeInfoProcessor.cs
- Endpoint.cs
- WebDescriptionAttribute.cs
- DeflateEmulationStream.cs
- EntityProxyFactory.cs
- BasicViewGenerator.cs
- BigInt.cs
- EntityDataSourceContainerNameItem.cs
- BinaryObjectInfo.cs
- CodeGeneratorOptions.cs
- ScriptControl.cs
- MultiAsyncResult.cs
- TextTreeExtractElementUndoUnit.cs
- LinkButton.cs
- WindowsRichEditRange.cs
- SignatureDescription.cs