Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / RemoteCryptoTokenProvider.cs / 1 / RemoteCryptoTokenProvider.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Security.Cryptography.X509Certificates; using System.IdentityModel.Tokens; using System.IdentityModel.Selectors; using System.ServiceModel; using System.ServiceModel.Security; using System.ServiceModel.Security.Tokens; using IDT=Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary: // Creates a token with remotely hosted keys. // sealed class RemoteCryptoTokenProvider : SecurityTokenProvider, IDisposable { RemoteX509Token m_token; X509Certificate2 m_certificate; object m_sync; public RemoteCryptoTokenProvider( X509Certificate2 cert ) { m_sync = new object(); m_certificate = cert; } public void Dispose() { // // We must dispose this handle explicitly. // IDisposable disposable = m_token as IDisposable; if( null != disposable ) { disposable.Dispose(); m_token = null; } } // // Summary: // Returns the SecurityToken generated. // // Arguments: // timeout: the timeout remaing // protected override SecurityToken GetTokenCore(TimeSpan timeout) { return InnerGetToken(); } // // Summary: // Syncronized get the current token // X509SecurityToken InnerGetToken() { if( null == m_token ) { lock( m_sync ) { if( null == m_token ) { m_token = new RemoteX509Token( m_certificate ); } } } return m_token; } } } // 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
- Win32PrintDialog.cs
- SpeechSeg.cs
- HttpListenerContext.cs
- OperationDescription.cs
- TimeStampChecker.cs
- AssemblyResourceLoader.cs
- TraceContextEventArgs.cs
- HelpPage.cs
- MetadataArtifactLoaderCompositeResource.cs
- XmlNavigatorFilter.cs
- ApplicationId.cs
- CheckBox.cs
- TransformerTypeCollection.cs
- EncodingConverter.cs
- DataListItemCollection.cs
- SparseMemoryStream.cs
- DesignerFrame.cs
- XsltInput.cs
- TypedTableGenerator.cs
- PreviewKeyDownEventArgs.cs
- TimerEventSubscription.cs
- DictionaryGlobals.cs
- Mutex.cs
- PathGradientBrush.cs
- UIElementAutomationPeer.cs
- BinaryObjectWriter.cs
- SecurityNegotiationException.cs
- TableItemPattern.cs
- ExtensionSimplifierMarkupObject.cs
- XmlWriterDelegator.cs
- ProgressBar.cs
- X509Extension.cs
- ReflectionUtil.cs
- NativeMethods.cs
- TableHeaderCell.cs
- UnorderedHashRepartitionStream.cs
- oledbmetadatacolumnnames.cs
- InternalsVisibleToAttribute.cs
- TransformCollection.cs
- ContextMenuStrip.cs
- WebServiceMethodData.cs
- AlphabeticalEnumConverter.cs
- XmlSchemaImport.cs
- SchemaTypeEmitter.cs
- SqlGatherConsumedAliases.cs
- LayoutTable.cs
- HttpListenerPrefixCollection.cs
- HashHelper.cs
- HostedHttpRequestAsyncResult.cs
- UrlAuthFailedErrorFormatter.cs
- HandlerWithFactory.cs
- WebException.cs
- RecordBuilder.cs
- MatcherBuilder.cs
- AsyncStreamReader.cs
- GradientStopCollection.cs
- XsltArgumentList.cs
- SafeArchiveContext.cs
- Viewport3DAutomationPeer.cs
- XmlSchemaSimpleTypeRestriction.cs
- ConfigPathUtility.cs
- DataSourceCacheDurationConverter.cs
- TableItemProviderWrapper.cs
- Trace.cs
- Int16.cs
- OracleParameterBinding.cs
- HttpListenerResponse.cs
- AnnotationObservableCollection.cs
- ProfileGroupSettings.cs
- XmlConvert.cs
- ThreadExceptionEvent.cs
- LogExtent.cs
- CodeExpressionCollection.cs
- RequestTimeoutManager.cs
- HandleCollector.cs
- validationstate.cs
- XmlWriterTraceListener.cs
- SEHException.cs
- _TransmitFileOverlappedAsyncResult.cs
- VectorAnimationUsingKeyFrames.cs
- TypeConverterHelper.cs
- OutputCacheProfile.cs
- NamespaceEmitter.cs
- HttpCapabilitiesBase.cs
- Literal.cs
- Comparer.cs
- LineSegment.cs
- TransportSecurityProtocolFactory.cs
- ViewBase.cs
- EntityDataSourceWrapper.cs
- Column.cs
- ApplicationManager.cs
- RoutedEventConverter.cs
- RoutedPropertyChangedEventArgs.cs
- MailMessageEventArgs.cs
- TextTreeUndo.cs
- ResourcesBuildProvider.cs
- CompatibleIComparer.cs
- ByteConverter.cs
- ConnectionStringsExpressionBuilder.cs