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
- MsmqInputChannelBase.cs
- AssociationTypeEmitter.cs
- SafeUserTokenHandle.cs
- RegistrationServices.cs
- BoolExpression.cs
- Ref.cs
- NamespaceInfo.cs
- CachedPathData.cs
- TypedMessageConverter.cs
- DnsPermission.cs
- ComponentResourceKey.cs
- HashCoreRequest.cs
- BinaryWriter.cs
- LabelLiteral.cs
- Ticks.cs
- VisemeEventArgs.cs
- CursorConverter.cs
- DigestComparer.cs
- OleCmdHelper.cs
- BindingMemberInfo.cs
- HiddenFieldPageStatePersister.cs
- XAMLParseException.cs
- RtfControls.cs
- HebrewCalendar.cs
- AssemblyCache.cs
- SrgsItemList.cs
- AccessibleObject.cs
- DataGridViewBindingCompleteEventArgs.cs
- SessionPageStatePersister.cs
- BuildProvider.cs
- XmlSchemaObject.cs
- XmlSchemaInclude.cs
- SimpleBitVector32.cs
- LogManagementAsyncResult.cs
- MailAddress.cs
- IdnElement.cs
- ReflectionServiceProvider.cs
- Odbc32.cs
- ByteFacetDescriptionElement.cs
- CodeChecksumPragma.cs
- XmlAnyAttributeAttribute.cs
- Int16AnimationBase.cs
- SubMenuStyleCollection.cs
- IndexedString.cs
- DoubleUtil.cs
- ProviderBase.cs
- PerformanceCountersElement.cs
- UdpDiscoveryMessageFilter.cs
- CompressionTracing.cs
- TraceEventCache.cs
- StorageTypeMapping.cs
- CapabilitiesPattern.cs
- TraceXPathNavigator.cs
- Point3DCollectionConverter.cs
- SaveFileDialogDesigner.cs
- Util.cs
- MailAddress.cs
- ControlUtil.cs
- ExpressionEditor.cs
- ProjectedSlot.cs
- Convert.cs
- InkSerializer.cs
- OleDbRowUpdatingEvent.cs
- DesignerActionVerbList.cs
- BinaryConverter.cs
- Rect3D.cs
- HyperLink.cs
- MetricEntry.cs
- SafeIUnknown.cs
- Stopwatch.cs
- EventSinkHelperWriter.cs
- TypeDependencyAttribute.cs
- PostBackTrigger.cs
- DataGridViewColumn.cs
- HttpCacheVaryByContentEncodings.cs
- TabItemAutomationPeer.cs
- Models.cs
- WindowsStartMenu.cs
- PropertyCondition.cs
- NamedPipeTransportSecurityElement.cs
- AssemblyNameEqualityComparer.cs
- GeometryHitTestResult.cs
- UnsafeNativeMethods.cs
- CodeParameterDeclarationExpression.cs
- PeerCollaborationPermission.cs
- RoleGroup.cs
- OleDbPermission.cs
- SettingsPropertyValueCollection.cs
- MenuItem.cs
- ExtenderProvidedPropertyAttribute.cs
- WebSysDescriptionAttribute.cs
- LoginView.cs
- StopStoryboard.cs
- UdpSocketReceiveManager.cs
- ResourceDescriptionAttribute.cs
- AffineTransform3D.cs
- UserPreferenceChangingEventArgs.cs
- EnumCodeDomSerializer.cs
- QueueException.cs
- NamedPipeTransportElement.cs