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
- NetworkInformationPermission.cs
- PropertySegmentSerializationProvider.cs
- CompositeScriptReferenceEventArgs.cs
- OracleSqlParser.cs
- OneOfScalarConst.cs
- Comparer.cs
- Label.cs
- TextServicesContext.cs
- BamlWriter.cs
- HitTestParameters3D.cs
- AppDomain.cs
- OneOfConst.cs
- SingleObjectCollection.cs
- PropertyKey.cs
- ProfilePropertySettingsCollection.cs
- SyndicationSerializer.cs
- GZipDecoder.cs
- MethodCallTranslator.cs
- SpStreamWrapper.cs
- BitmapDecoder.cs
- IISUnsafeMethods.cs
- XmlNavigatorFilter.cs
- CodeTypeParameterCollection.cs
- ConfigurationValidatorBase.cs
- ProxySimple.cs
- PrefixQName.cs
- SelectionChangedEventArgs.cs
- ErrorFormatterPage.cs
- ControllableStoryboardAction.cs
- ProfileProvider.cs
- InfoCardClaim.cs
- BitSet.cs
- AssertFilter.cs
- StandardToolWindows.cs
- LedgerEntryCollection.cs
- ResourceReferenceExpressionConverter.cs
- ConfigXmlSignificantWhitespace.cs
- SerializationException.cs
- HashMembershipCondition.cs
- oledbmetadatacollectionnames.cs
- XmlSerializerOperationGenerator.cs
- SchemaElementDecl.cs
- CodeCommentStatementCollection.cs
- PrimaryKeyTypeConverter.cs
- ButtonBaseAutomationPeer.cs
- PenCursorManager.cs
- FixedSOMPageElement.cs
- ContextConfiguration.cs
- XmlBinaryWriter.cs
- AnnouncementEndpointElement.cs
- OdbcConnectionHandle.cs
- AsyncPostBackTrigger.cs
- SqlGatherConsumedAliases.cs
- System.Data_BID.cs
- DataGridRowAutomationPeer.cs
- _SpnDictionary.cs
- EntityDataSourceWrapper.cs
- StackBuilderSink.cs
- SymbolMethod.cs
- SqlDataAdapter.cs
- SchemaImporterExtensionElement.cs
- AdapterUtil.cs
- TextEncodedRawTextWriter.cs
- DependencyPropertyDescriptor.cs
- BitmapEffectDrawing.cs
- ConfigurationSectionCollection.cs
- QilTernary.cs
- PathFigure.cs
- FunctionDescription.cs
- XmlTextReader.cs
- ListBoxItem.cs
- SecurityAppliedMessage.cs
- DiscoveryClientDocuments.cs
- ListMarkerSourceInfo.cs
- DetailsViewDeleteEventArgs.cs
- RSAProtectedConfigurationProvider.cs
- ListSourceHelper.cs
- SessionStateModule.cs
- EtwProvider.cs
- SqlMethodCallConverter.cs
- DateTimeFormatInfoScanner.cs
- CompModHelpers.cs
- RelationshipDetailsRow.cs
- DateTimeUtil.cs
- SerializerProvider.cs
- RoutedEvent.cs
- ProbeDuplexAsyncResult.cs
- XmlElementAttribute.cs
- DynamicILGenerator.cs
- UdpConstants.cs
- StorageAssociationSetMapping.cs
- SecuritySessionSecurityTokenProvider.cs
- XmlSchemaExternal.cs
- PropertyPathConverter.cs
- ValidatingPropertiesEventArgs.cs
- TableLayoutPanel.cs
- EmulateRecognizeCompletedEventArgs.cs
- Helper.cs
- EncryptedPackageFilter.cs
- ConversionHelper.cs