Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / RemoteAsymmetricSignatureFormatter.cs / 1 / RemoteAsymmetricSignatureFormatter.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.ServiceModel; using System.ServiceModel.Security; using System.ServiceModel.Security.Tokens; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary: // Signature formater for use with RemoteCryptoRsaServiceProvider // class RemoteAsymmetricSignatureFormatter : AsymmetricSignatureFormatter { RemoteCryptoRsaServiceProvider m_rsa; string m_hashOidString; int m_nativeHashType; public RemoteAsymmetricSignatureFormatter() : base() { } // // Summary: // Create the new signature. // // Arguments: // rgbHash: the hash value to sign. // // Returns: // The signature value. // public override byte[] CreateSignature(byte[] rgbHash) { if( null == m_rsa ) { throw IDT.ThrowHelperError( new ArgumentException( "m_rsa" ) ); } if( String.IsNullOrEmpty( m_hashOidString ) ) { throw IDT.ThrowHelperError( new ArgumentException( "m_hashOidString" ) ); } if( null == rgbHash ) { throw IDT.ThrowHelperError( new ArgumentNullException( "rgbHash" ) ); } byte[] signature = m_rsa.SignHash( m_nativeHashType, rgbHash ); return signature; } // // Summary: // Sets the hash algorithm // // Arguments: // strName: the string name of the algorithm. // public override void SetHashAlgorithm(string strName) { m_hashOidString = CryptoConfig.MapNameToOID( strName ); m_nativeHashType = NativeMcppMethods.CryptAlgIdFromOid( m_hashOidString ); } // // Summary: // Set the current ket set for use in signing. // // Arguments: // key: The key to use. Must be a RemoteCryptoRsaServiceProvider instance. // public override void SetKey(AsymmetricAlgorithm key) { m_rsa = key as RemoteCryptoRsaServiceProvider; if( null == m_rsa ) { throw IDT.ThrowHelperError( new NotSupportedException() ); } } } } // 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
- TimeZoneInfo.cs
- ZipArchive.cs
- ContentDisposition.cs
- ChameleonKey.cs
- MembershipAdapter.cs
- XMLUtil.cs
- ComboBox.cs
- Form.cs
- loginstatus.cs
- WindowsListViewGroupHelper.cs
- Span.cs
- KeysConverter.cs
- UIElementParagraph.cs
- DataListComponentEditor.cs
- ClientSettingsSection.cs
- BrowserDefinitionCollection.cs
- ReferenceService.cs
- AdapterDictionary.cs
- AttributeProviderAttribute.cs
- Operator.cs
- ComponentResourceManager.cs
- TriState.cs
- XmlEncodedRawTextWriter.cs
- GC.cs
- XamlVector3DCollectionSerializer.cs
- WebOperationContext.cs
- PolicyLevel.cs
- HTTPRemotingHandler.cs
- StorageEntityContainerMapping.cs
- BinaryObjectInfo.cs
- MetadataCache.cs
- SafeNativeMethods.cs
- CodeCommentStatement.cs
- HttpPostProtocolReflector.cs
- EditorPartChrome.cs
- UnsafeNativeMethods.cs
- TraceLog.cs
- ConfigXmlAttribute.cs
- _UriSyntax.cs
- DataColumn.cs
- UserMapPath.cs
- MarkupCompilePass1.cs
- DCSafeHandle.cs
- HttpRequest.cs
- CompilerErrorCollection.cs
- MenuItemStyle.cs
- EntityStoreSchemaFilterEntry.cs
- WhitespaceRuleLookup.cs
- OracleCommandSet.cs
- ResourceContainer.cs
- _AutoWebProxyScriptWrapper.cs
- RepeatButtonAutomationPeer.cs
- CreateUserWizardStep.cs
- CultureInfoConverter.cs
- XamlReaderConstants.cs
- StyleSelector.cs
- sqlpipe.cs
- StylusPoint.cs
- FormViewUpdatedEventArgs.cs
- ProcessHost.cs
- WebEncodingValidator.cs
- Model3D.cs
- StateMachineHelpers.cs
- DesignerUtility.cs
- SafeUserTokenHandle.cs
- ParameterToken.cs
- IteratorFilter.cs
- Slider.cs
- State.cs
- MethodResolver.cs
- TextFormatterImp.cs
- ConfigurationElement.cs
- XmlSignatureManifest.cs
- PageBreakRecord.cs
- CompilationSection.cs
- XmlReaderSettings.cs
- Bitmap.cs
- ScriptReferenceBase.cs
- FrameAutomationPeer.cs
- QueueProcessor.cs
- BamlTreeUpdater.cs
- ThicknessAnimationBase.cs
- ParallelTimeline.cs
- ScopeElementCollection.cs
- CheckedListBox.cs
- ApplicationActivator.cs
- HandledMouseEvent.cs
- EncodingStreamWrapper.cs
- TextBlock.cs
- WindowsUpDown.cs
- ManageRequest.cs
- RoleService.cs
- CodeRemoveEventStatement.cs
- ObjectSpanRewriter.cs
- HandlerBase.cs
- ExecutedRoutedEventArgs.cs
- EmptyEnumerable.cs
- ErrorWebPart.cs
- BitFlagsGenerator.cs
- DataSourceHelper.cs