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
- HttpDebugHandler.cs
- FixedLineResult.cs
- CategoryAttribute.cs
- ChildTable.cs
- AppDomainShutdownMonitor.cs
- Win32SafeHandles.cs
- ConfigurationSectionCollection.cs
- DocumentReference.cs
- HtmlTableCellCollection.cs
- SQLUtility.cs
- FormsAuthenticationModule.cs
- GlyphCache.cs
- NavigationFailedEventArgs.cs
- DataGridItemCollection.cs
- XmlTypeAttribute.cs
- PropertyChange.cs
- AccessorTable.cs
- PrintDocument.cs
- EntityTypeEmitter.cs
- ObjectSpanRewriter.cs
- PreDigestedSignedInfo.cs
- DragEvent.cs
- StyleSheetComponentEditor.cs
- TaskExtensions.cs
- PriorityQueue.cs
- ApplyTemplatesAction.cs
- TileBrush.cs
- PasswordTextContainer.cs
- SerializationEventsCache.cs
- MenuEventArgs.cs
- DockingAttribute.cs
- Baml2006SchemaContext.cs
- DataGridViewCellParsingEventArgs.cs
- Converter.cs
- IProvider.cs
- SettingsSavedEventArgs.cs
- WsdlBuildProvider.cs
- SqlReferenceCollection.cs
- DllNotFoundException.cs
- Error.cs
- ListViewGroupConverter.cs
- DefaultValueAttribute.cs
- CompositeScriptReferenceEventArgs.cs
- HttpServerUtilityWrapper.cs
- UserControlBuildProvider.cs
- SecurityKeyIdentifier.cs
- Convert.cs
- WebPageTraceListener.cs
- AddInIpcChannel.cs
- SecurityDescriptor.cs
- WebPartVerbCollection.cs
- WinFormsUtils.cs
- ListBase.cs
- FocusWithinProperty.cs
- ChangeBlockUndoRecord.cs
- HttpAsyncResult.cs
- DbProviderFactoriesConfigurationHandler.cs
- VerificationAttribute.cs
- XmlComment.cs
- GPRECTF.cs
- SafePointer.cs
- FactoryMaker.cs
- SourceLineInfo.cs
- TdsParser.cs
- SendMailErrorEventArgs.cs
- CryptoApi.cs
- Clock.cs
- ResourceDescriptionAttribute.cs
- SqlGatherConsumedAliases.cs
- StringExpressionSet.cs
- OutOfMemoryException.cs
- EdmProperty.cs
- mediapermission.cs
- AssemblyBuilder.cs
- Substitution.cs
- SqlDataReaderSmi.cs
- DataServiceQueryException.cs
- QuaternionAnimation.cs
- SingleConverter.cs
- EditingMode.cs
- XmlFormatExtensionAttribute.cs
- HtmlTextArea.cs
- XmlElementAttributes.cs
- _KerberosClient.cs
- SubMenuStyleCollection.cs
- ConfigurationStrings.cs
- CqlIdentifiers.cs
- DataGridViewButtonColumn.cs
- MSAAWinEventWrap.cs
- CodeParameterDeclarationExpression.cs
- XmlEventCache.cs
- CompensationToken.cs
- TableItemProviderWrapper.cs
- Transform3DCollection.cs
- TextTreeInsertElementUndoUnit.cs
- PropertyMapper.cs
- FlowLayoutPanelDesigner.cs
- NameTable.cs
- panel.cs
- RegistryHandle.cs