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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RuleValidation.cs
- Soap.cs
- IsolatedStorageFileStream.cs
- RulePatternOps.cs
- DbDeleteCommandTree.cs
- CodeDomConfigurationHandler.cs
- DataSet.cs
- NavigatorInvalidBodyAccessException.cs
- AnnotationComponentChooser.cs
- GridViewRowCollection.cs
- PassportAuthentication.cs
- SRef.cs
- ListView.cs
- ActivityTypeResolver.xaml.cs
- Win32.cs
- SerialStream.cs
- DataGridLinkButton.cs
- XmlChildNodes.cs
- Point3DAnimation.cs
- DefaultValidator.cs
- WebServiceHandlerFactory.cs
- ChildTable.cs
- AddValidationError.cs
- DesignerLoader.cs
- UserMapPath.cs
- AggregatePushdown.cs
- GeneralTransform3D.cs
- CallbackValidator.cs
- TabControl.cs
- AuthorizationSection.cs
- Repeater.cs
- ItemPager.cs
- DataStreams.cs
- DataContractSerializerElement.cs
- NotifyCollectionChangedEventArgs.cs
- XhtmlBasicSelectionListAdapter.cs
- DataGridToolTip.cs
- EventPropertyMap.cs
- InputProviderSite.cs
- WCFServiceClientProxyGenerator.cs
- RuleDefinitions.cs
- DesignerVerb.cs
- DbConnectionStringBuilder.cs
- TraceHandlerErrorFormatter.cs
- TTSEngineProxy.cs
- ToolStripLabel.cs
- MappingItemCollection.cs
- NetworkInformationPermission.cs
- XMLSchema.cs
- TreeNodeCollection.cs
- HttpCacheVaryByContentEncodings.cs
- TextWriterTraceListener.cs
- MapPathBasedVirtualPathProvider.cs
- UserNamePasswordValidator.cs
- EventlogProvider.cs
- SqlDependencyListener.cs
- NavigationPropertyEmitter.cs
- OrthographicCamera.cs
- LayoutEvent.cs
- SingleKeyFrameCollection.cs
- cookie.cs
- CardSpaceSelector.cs
- ScaleTransform.cs
- ExtentKey.cs
- WebPartPersonalization.cs
- CompletedAsyncResult.cs
- StateValidator.cs
- BooleanAnimationBase.cs
- TypeSchema.cs
- TdsParserStaticMethods.cs
- TaiwanLunisolarCalendar.cs
- NamespaceInfo.cs
- PositiveTimeSpanValidator.cs
- CircleHotSpot.cs
- SingleAnimation.cs
- Substitution.cs
- WsatServiceCertificate.cs
- SecurityPermission.cs
- Table.cs
- ZipIORawDataFileBlock.cs
- TaskHelper.cs
- URI.cs
- PageAsyncTaskManager.cs
- TextCollapsingProperties.cs
- TreeNodeCollection.cs
- Closure.cs
- PeerNameRecordCollection.cs
- DbUpdateCommandTree.cs
- WebScriptEndpointElement.cs
- QuadraticBezierSegment.cs
- GetPageCompletedEventArgs.cs
- DataSvcMapFileSerializer.cs
- EditorPartCollection.cs
- SecureStringHasher.cs
- TextBoxAutoCompleteSourceConverter.cs
- XmlSerializableServices.cs
- EventProviderClassic.cs
- IndicShape.cs
- NativeMethods.cs
- IPAddressCollection.cs