Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / RSATokenProvider.cs / 1 / RSATokenProvider.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
//
// Presharp uses the c# pragma mechanism to supress its warnings.
// These are not recognised by the base compiler so we need to explictly
// disable the following warnings. See http://winweb/cse/Tools/PREsharp/userguide/default.asp
// for details.
//
#pragma warning disable 1634, 1691 // unknown message, unknown pragma
namespace Microsoft.InfoCards
{
using System;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using System.ServiceModel;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.IdentityModel;
using System.Security.Cryptography.Xml;
using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
using System.Collections.ObjectModel;
using System.Collections.Generic;
//
// This class is used to provide a custom token provider for adding an endorsing signature token to the RST
// message sent to a managed card STS. The endorsing signature must be added if the UseKey field is present
// in the RST.
//
internal class RSATokenProvider : SecurityTokenProvider, IDisposable
{
InfoCardPolicy m_policy;
InfoCard m_card;
SelfIssuedAuthProofToken m_RSAToken;
public RSATokenProvider( InfoCardPolicy policy, InfoCard card )
{
IDT.ThrowInvalidArgumentConditional( null == policy, "policy" );
IDT.ThrowInvalidArgumentConditional( null == card, "card" );
m_policy = policy;
m_card = card;
}
public void Dispose()
{
//
// We must dispose this token explicitly.
//
if ( null != m_RSAToken )
{
m_RSAToken.Dispose();
m_RSAToken = null;
}
}
//
// Summary
// Retrieves a token from the system
//
// Parameters
// timeout - The time span till the call times out
//
// Returns
// The security token.
//
protected override SecurityToken GetTokenCore(TimeSpan timeout)
{
if( null == m_RSAToken )
{
//
// The SelfIssuedAuthProofToken should be renamed. In this case it's just acting as a generic
// wrapper for an RSA key.
//
m_RSAToken = new SelfIssuedAuthProofToken( m_card.GetPrivateCryptography( m_policy.Recipient.GetIdentifier() ),
DateTime.UtcNow + timeout );
}
return m_RSAToken;
}
}
}
// 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
- Identity.cs
- XmlNodeChangedEventManager.cs
- CompModSwitches.cs
- Marshal.cs
- PrintDocument.cs
- MenuItem.cs
- InvokeBase.cs
- RegularExpressionValidator.cs
- HostedHttpTransportManager.cs
- FileNotFoundException.cs
- GlobalizationAssembly.cs
- DesignerSerializerAttribute.cs
- EntityWithKeyStrategy.cs
- HttpCookiesSection.cs
- TraceHelpers.cs
- NonBatchDirectoryCompiler.cs
- Expr.cs
- ScrollPatternIdentifiers.cs
- ReachDocumentReferenceSerializer.cs
- ActivityCodeDomSerializer.cs
- BrowserCapabilitiesFactory.cs
- DataPagerFieldItem.cs
- X509DefaultServiceCertificateElement.cs
- SortedDictionary.cs
- ToolStripLocationCancelEventArgs.cs
- MetabaseReader.cs
- TextBox.cs
- FullTextState.cs
- JoinElimination.cs
- DataGridViewHitTestInfo.cs
- DataServiceConfiguration.cs
- ObjectFullSpanRewriter.cs
- TypeLibConverter.cs
- Qualifier.cs
- CharEntityEncoderFallback.cs
- CommandID.cs
- TdsParserStaticMethods.cs
- Panel.cs
- StaticResourceExtension.cs
- Merger.cs
- AssociationSet.cs
- DataException.cs
- DebugView.cs
- SqlDataReaderSmi.cs
- LayoutTable.cs
- ProcessManager.cs
- COM2TypeInfoProcessor.cs
- RequestSecurityTokenResponseCollection.cs
- XmlQueryCardinality.cs
- Monitor.cs
- _FtpDataStream.cs
- METAHEADER.cs
- Drawing.cs
- DetailsViewDeletedEventArgs.cs
- TextTreeTextElementNode.cs
- ImageAutomationPeer.cs
- SafeRightsManagementQueryHandle.cs
- RangeValidator.cs
- AuthenticatedStream.cs
- InternalsVisibleToAttribute.cs
- SqlTrackingWorkflowInstance.cs
- CrossAppDomainChannel.cs
- OleDbParameterCollection.cs
- SamlNameIdentifierClaimResource.cs
- xmlfixedPageInfo.cs
- WebException.cs
- DataSourceCacheDurationConverter.cs
- SharedUtils.cs
- SystemShuttingDownException.cs
- HttpCapabilitiesBase.cs
- FullTrustAssemblyCollection.cs
- TemplatePagerField.cs
- TrustManagerPromptUI.cs
- ValidationErrorCollection.cs
- ForeignKeyConstraint.cs
- DataViewManager.cs
- CodeFieldReferenceExpression.cs
- ForceCopyBuildProvider.cs
- AutomationElement.cs
- ColumnWidthChangingEvent.cs
- UdpDiscoveryEndpointElement.cs
- DataGridViewAccessibleObject.cs
- HttpRawResponse.cs
- TransactionFlowOption.cs
- ContentTextAutomationPeer.cs
- DetailsViewUpdateEventArgs.cs
- DetailsViewRow.cs
- CaretElement.cs
- VoiceInfo.cs
- Graphics.cs
- BitArray.cs
- ExpressionParser.cs
- LinqDataSourceUpdateEventArgs.cs
- TreeChangeInfo.cs
- Rotation3DAnimationBase.cs
- OutputCacheSettings.cs
- SpellerStatusTable.cs
- MessageQueue.cs
- PageTheme.cs
- CompositeScriptReference.cs