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
- RadioButtonBaseAdapter.cs
- PolyLineSegment.cs
- AddInEnvironment.cs
- WebPageTraceListener.cs
- ConnectivityStatus.cs
- LocalBuilder.cs
- DataViewSettingCollection.cs
- UnlockInstanceCommand.cs
- ImageCodecInfo.cs
- XmlProcessingInstruction.cs
- ContentType.cs
- MarkedHighlightComponent.cs
- XsdBuildProvider.cs
- CreateSequenceResponse.cs
- ToolStripContentPanelRenderEventArgs.cs
- DataErrorValidationRule.cs
- RemotingConfigParser.cs
- CharEnumerator.cs
- XmlTextReaderImpl.cs
- HttpCachePolicyElement.cs
- XmlSchemaInclude.cs
- SimpleType.cs
- CookieProtection.cs
- InProcStateClientManager.cs
- CopyAction.cs
- infer.cs
- DefaultPropertiesToSend.cs
- RestHandler.cs
- FieldBuilder.cs
- BooleanConverter.cs
- LinkClickEvent.cs
- AssemblyBuilder.cs
- RegionInfo.cs
- CodeDirectiveCollection.cs
- SourceElementsCollection.cs
- SkipQueryOptionExpression.cs
- EventLogInformation.cs
- SendMailErrorEventArgs.cs
- Ray3DHitTestResult.cs
- WorkItem.cs
- ElementUtil.cs
- SafeRegistryHandle.cs
- Ref.cs
- Span.cs
- TextDataBindingHandler.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- CaseInsensitiveHashCodeProvider.cs
- EncodingTable.cs
- Int64Animation.cs
- CounterCreationData.cs
- PointLightBase.cs
- Signature.cs
- TargetException.cs
- RecordManager.cs
- UseManagedPresentationElement.cs
- VersionValidator.cs
- NamespaceMapping.cs
- XmlSerializerFactory.cs
- TypeHelper.cs
- VerificationException.cs
- EntitySetBase.cs
- DataGridPagerStyle.cs
- AllMembershipCondition.cs
- FamilyMapCollection.cs
- httpapplicationstate.cs
- DataControlFieldHeaderCell.cs
- UIPropertyMetadata.cs
- DebuggerAttributes.cs
- EngineSite.cs
- DesignerUtility.cs
- ResourceDefaultValueAttribute.cs
- EastAsianLunisolarCalendar.cs
- SQLMembershipProvider.cs
- SerialErrors.cs
- HashAlgorithm.cs
- XmlTextReaderImplHelpers.cs
- ApplicationBuildProvider.cs
- OutputCacheSettings.cs
- AnnotationResource.cs
- ProgressBarHighlightConverter.cs
- TextSpan.cs
- CrossContextChannel.cs
- DataTemplateSelector.cs
- WmlLabelAdapter.cs
- Variant.cs
- XmlCompatibilityReader.cs
- WebPartTracker.cs
- Light.cs
- AssertFilter.cs
- DocumentEventArgs.cs
- DecoderExceptionFallback.cs
- ListViewContainer.cs
- SemanticKeyElement.cs
- ExtensionWindow.cs
- Point3DKeyFrameCollection.cs
- HebrewCalendar.cs
- ping.cs
- ProtocolsConfigurationHandler.cs
- DataTableNewRowEvent.cs