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
- SpecialTypeDataContract.cs
- IBuiltInEvidence.cs
- StrokeRenderer.cs
- BooleanFacetDescriptionElement.cs
- _ProxyChain.cs
- RadioButton.cs
- EncryptedPackage.cs
- TextBoxLine.cs
- ChildrenQuery.cs
- GenericTypeParameterBuilder.cs
- ResizeGrip.cs
- Hashtable.cs
- UnsafeNativeMethodsMilCoreApi.cs
- MergeFilterQuery.cs
- FixedPage.cs
- DbReferenceCollection.cs
- EditorZoneBase.cs
- ProvidePropertyAttribute.cs
- backend.cs
- CacheModeConverter.cs
- MessageQueuePermissionEntryCollection.cs
- HandlerBase.cs
- ControlBuilderAttribute.cs
- AnimationClockResource.cs
- FacetDescription.cs
- XmlAutoDetectWriter.cs
- SecureUICommand.cs
- XamlClipboardData.cs
- RowType.cs
- DataGridViewRowCollection.cs
- X509Certificate2Collection.cs
- InputGestureCollection.cs
- precedingquery.cs
- _SSPIWrapper.cs
- GridViewUpdateEventArgs.cs
- WpfKnownMember.cs
- WindowHideOrCloseTracker.cs
- Component.cs
- ConfigurationStrings.cs
- TitleStyle.cs
- XmlTextReader.cs
- GraphicsContainer.cs
- LayoutInformation.cs
- DataGridViewLinkCell.cs
- StylusPointPropertyInfo.cs
- SqlUserDefinedTypeAttribute.cs
- WebCodeGenerator.cs
- FunctionDetailsReader.cs
- httpapplicationstate.cs
- FileDialog_Vista_Interop.cs
- InkCanvasSelection.cs
- PenThread.cs
- Point4D.cs
- EntityViewContainer.cs
- GcSettings.cs
- CurrentTimeZone.cs
- ClientRuntimeConfig.cs
- SignatureHelper.cs
- NativeMethods.cs
- Stylesheet.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- BufferBuilder.cs
- XsdDuration.cs
- QueryCacheKey.cs
- Exceptions.cs
- SecurityAlgorithmSuiteConverter.cs
- CustomAttributeSerializer.cs
- OraclePermissionAttribute.cs
- Rotation3D.cs
- TableAutomationPeer.cs
- AssemblyInfo.cs
- NativeMethods.cs
- FileIOPermission.cs
- Serializer.cs
- DecoderFallbackWithFailureFlag.cs
- Bidi.cs
- DigitShape.cs
- AdornerDecorator.cs
- ChunkedMemoryStream.cs
- TokenCreationParameter.cs
- MsmqBindingElementBase.cs
- CallbackTimeoutsElement.cs
- RequestNavigateEventArgs.cs
- ClientFormsAuthenticationCredentials.cs
- BindingMAnagerBase.cs
- RtType.cs
- ToolStripOverflow.cs
- SecurityContext.cs
- BrushValueSerializer.cs
- DataSourceViewSchemaConverter.cs
- PeerContact.cs
- SqlSelectStatement.cs
- httpapplicationstate.cs
- OperationFormatStyle.cs
- ParameterCollection.cs
- DataGridViewBand.cs
- ScrollData.cs
- SortAction.cs
- WizardStepBase.cs
- Vars.cs