Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / SelfIssuedAuthRSACryptoProvider.cs / 1 / SelfIssuedAuthRSACryptoProvider.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // 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; // // Summary: // This class provides indirect access an RSACryptoServiceProvider - this allows us to // protect the private key better // internal class SelfIssuedAuthRSACryptoProvider : RSA { RSACryptoServiceProvider m_rsa; // // Summary: // Given a pointer to a CryptoHandle create a new instance of this class. // public SelfIssuedAuthRSACryptoProvider( RSACryptoServiceProvider rsa ) : base() { m_rsa = rsa; } public override String SignatureAlgorithm { get { return m_rsa.SignatureAlgorithm; } } public override String KeyExchangeAlgorithm { get { return m_rsa.KeyExchangeAlgorithm; } } public bool IsPublicOnly() { return m_rsa.PublicOnly; } public override byte[ ] EncryptValue( byte[ ] rgb ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public override byte[ ] DecryptValue( byte[ ] rgb ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public byte[ ] Decrypt( byte[ ] inData, bool fAOEP ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public byte[ ] Encrypt( byte[ ] inData, bool fAOEP ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public byte[ ] SignHash( byte[ ] hash, string hashAlgOid ) { IDT.ThrowInvalidArgumentConditional( null == hash || 0 == hash.Length, "hash" ); IDT.ThrowInvalidArgumentConditional( String.IsNullOrEmpty( hashAlgOid ), "hashAlgOid" ); return m_rsa.SignHash( hash, hashAlgOid ); } public bool VerifyHash( byte[ ] hash, string hashAlgOid, byte[ ] sig ) { IDT.ThrowInvalidArgumentConditional( null == hash || 0 == hash.Length, "hash" ); IDT.ThrowInvalidArgumentConditional( String.IsNullOrEmpty( hashAlgOid ), "hashAlgOid" ); IDT.ThrowInvalidArgumentConditional( null == sig || 0 == sig.Length, "sig" ); return m_rsa.VerifyHash( hash, hashAlgOid, sig ); } public override RSAParameters ExportParameters( bool includePrivateParameters ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public override string ToXmlString( bool includePrivateParameters ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public override void FromXmlString( string xmlString ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } public override void ImportParameters( System.Security.Cryptography.RSAParameters parameters ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } protected override void Dispose( bool disposing ) { if( null != m_rsa ) { ( ( IDisposable )m_rsa ).Dispose(); } } } } // 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
- ErrorLog.cs
- ClientRolePrincipal.cs
- ContainerControl.cs
- SecureUICommand.cs
- FrameworkElement.cs
- Encoder.cs
- WebPartConnectVerb.cs
- ConnectionPoolManager.cs
- HttpResponseWrapper.cs
- InfoCardSymmetricAlgorithm.cs
- DocumentApplicationJournalEntry.cs
- IISMapPath.cs
- Timeline.cs
- SQLGuid.cs
- ExtendedProperty.cs
- CopyNodeSetAction.cs
- RelatedPropertyManager.cs
- CodeConditionStatement.cs
- ConnectionConsumerAttribute.cs
- StdValidatorsAndConverters.cs
- ParameterCollection.cs
- MessageSecurityProtocolFactory.cs
- BuildResult.cs
- StorageInfo.cs
- TraceInternal.cs
- SqlLiftWhereClauses.cs
- DocumentsTrace.cs
- WorkflowViewElement.cs
- AssemblyInfo.cs
- LoginView.cs
- WebHostScriptMappingsInstallComponent.cs
- DesignParameter.cs
- HttpRawResponse.cs
- DispatcherProcessingDisabled.cs
- ShaderEffect.cs
- SafeRegistryHandle.cs
- UndirectedGraph.cs
- OracleDataAdapter.cs
- WebPartActionVerb.cs
- ZipIOCentralDirectoryFileHeader.cs
- NativeMethods.cs
- WaitHandleCannotBeOpenedException.cs
- SimpleExpression.cs
- Enum.cs
- ValidationHelpers.cs
- WindowsClaimSet.cs
- SearchForVirtualItemEventArgs.cs
- FtpRequestCacheValidator.cs
- ListItemCollection.cs
- UseAttributeSetsAction.cs
- ConnectionInterfaceCollection.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- ToolStripCustomTypeDescriptor.cs
- codemethodreferenceexpression.cs
- SkinIDTypeConverter.cs
- HttpStreams.cs
- IDReferencePropertyAttribute.cs
- EditorBrowsableAttribute.cs
- GetWinFXPath.cs
- WriteableBitmap.cs
- StylusPointPropertyInfoDefaults.cs
- SystemInformation.cs
- MarkupCompilePass1.cs
- WizardStepBase.cs
- SimpleFileLog.cs
- ToolstripProfessionalRenderer.cs
- XmlDataDocument.cs
- DataGridColumnHeaderAutomationPeer.cs
- OnOperation.cs
- PointKeyFrameCollection.cs
- SafeLocalAllocation.cs
- ParenExpr.cs
- TypeDescriptor.cs
- TextPattern.cs
- ApplicationContext.cs
- MouseWheelEventArgs.cs
- FixedTextContainer.cs
- EngineSite.cs
- StylusCollection.cs
- initElementDictionary.cs
- XmlTextReader.cs
- WpfGeneratedKnownTypes.cs
- OleDbInfoMessageEvent.cs
- ObjectMemberMapping.cs
- InvokeMethodActivityDesigner.cs
- HtmlInputCheckBox.cs
- Part.cs
- CardSpacePolicyElement.cs
- MemberAccessException.cs
- CultureMapper.cs
- InputLanguageManager.cs
- PeerCredentialElement.cs
- SignedXml.cs
- _DisconnectOverlappedAsyncResult.cs
- DesignTimeParseData.cs
- SetStateEventArgs.cs
- ArgumentOutOfRangeException.cs
- WeakEventManager.cs
- StateDesigner.LayoutSelectionGlyph.cs
- InlineCollection.cs