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
- FixedDocumentPaginator.cs
- TripleDES.cs
- DataObject.cs
- XmlSchemaProviderAttribute.cs
- ProfileInfo.cs
- DifferencingCollection.cs
- COM2ColorConverter.cs
- SqlProviderServices.cs
- AppearanceEditorPart.cs
- CodeConstructor.cs
- ScriptManager.cs
- IteratorDescriptor.cs
- DataGridViewRow.cs
- TextDocumentView.cs
- AdornerLayer.cs
- PolicyException.cs
- LinearGradientBrush.cs
- GeneratedView.cs
- OperandQuery.cs
- BasePattern.cs
- ImageConverter.cs
- fixedPageContentExtractor.cs
- SHA256Cng.cs
- KnownTypesProvider.cs
- LineProperties.cs
- Propagator.cs
- ListenerUnsafeNativeMethods.cs
- IApplicationTrustManager.cs
- Int64Storage.cs
- ChtmlPageAdapter.cs
- Int32CAMarshaler.cs
- BasicDesignerLoader.cs
- DrawingAttributes.cs
- ResourceWriter.cs
- ScriptManagerProxy.cs
- NavigationHelper.cs
- InvariantComparer.cs
- CryptographicAttribute.cs
- QueryCacheEntry.cs
- UpdateTranslator.cs
- TextServicesPropertyRanges.cs
- Bind.cs
- BezierSegment.cs
- SrgsRulesCollection.cs
- RoutingBehavior.cs
- FormView.cs
- EditorZoneBase.cs
- controlskin.cs
- SelectionWordBreaker.cs
- SessionEndedEventArgs.cs
- XmlDocumentType.cs
- BitConverter.cs
- BufferBuilder.cs
- XmlDataProvider.cs
- RequestCachePolicy.cs
- OleDbRowUpdatedEvent.cs
- NativeCompoundFileAPIs.cs
- StorageSetMapping.cs
- UnauthorizedAccessException.cs
- KnownBoxes.cs
- MatrixAnimationUsingKeyFrames.cs
- AspNetHostingPermission.cs
- handlecollector.cs
- _SecureChannel.cs
- DelayLoadType.cs
- HttpProfileGroupBase.cs
- SortedList.cs
- HttpCachePolicy.cs
- MethodRental.cs
- SiteMapNodeItemEventArgs.cs
- TextEffect.cs
- WebRequestModulesSection.cs
- StringCollection.cs
- XmlSchemaAnnotation.cs
- XmlLinkedNode.cs
- CatalogPart.cs
- configsystem.cs
- RemoteWebConfigurationHostStream.cs
- WmlValidatorAdapter.cs
- CapabilitiesPattern.cs
- FacetDescription.cs
- SafeNativeMethodsMilCoreApi.cs
- TextHidden.cs
- RemotingSurrogateSelector.cs
- ToolStripSeparator.cs
- OracleSqlParser.cs
- TreeNodeConverter.cs
- FontStretchConverter.cs
- XmlNotation.cs
- SystemPens.cs
- EnumerationRangeValidationUtil.cs
- XmlSubtreeReader.cs
- DataContractJsonSerializerOperationFormatter.cs
- WSDualHttpSecurityElement.cs
- LongValidator.cs
- ModelTreeEnumerator.cs
- GZipUtils.cs
- RC2CryptoServiceProvider.cs
- OutputScope.cs
- ManipulationDevice.cs