Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / InfoCardRSAPKCS1SignatureDeformatter.cs / 1305376 / InfoCardRSAPKCS1SignatureDeformatter.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.IdentityModel.Selectors
{
using System;
using System.Security.Cryptography;
internal class InfoCardRSAPKCS1SignatureDeformatter : RSAPKCS1SignatureDeformatter
{
private RSA m_rsaKey; // RSA Key value to do decrypt operation
private string m_strOID; // OID value for the HASH algorithm
//
// public constructors
//
public InfoCardRSAPKCS1SignatureDeformatter() : base() {}
public InfoCardRSAPKCS1SignatureDeformatter( AsymmetricAlgorithm key ) : base( key )
{
m_rsaKey = (RSA) key;
}
//
// public methods
//
public override void SetKey( AsymmetricAlgorithm key )
{
base.SetKey( key );
m_rsaKey = (RSA) key;
}
public override void SetHashAlgorithm( string strName )
{
base.SetHashAlgorithm( strName );
m_strOID = CryptoConfig.MapNameToOID(strName);
}
public override bool VerifySignature( byte[] rgbHash, byte[] rgbSignature )
{
if ( !( m_strOID == null || m_rsaKey == null || rgbHash == null || rgbSignature == null )
&& m_rsaKey is InfoCardRSACryptoProvider )
{
return ((InfoCardRSACryptoProvider) m_rsaKey).VerifyHash(rgbHash, m_strOID, rgbSignature);
}
else
{
return base.VerifySignature( rgbHash, rgbSignature );
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.IdentityModel.Selectors
{
using System;
using System.Security.Cryptography;
internal class InfoCardRSAPKCS1SignatureDeformatter : RSAPKCS1SignatureDeformatter
{
private RSA m_rsaKey; // RSA Key value to do decrypt operation
private string m_strOID; // OID value for the HASH algorithm
//
// public constructors
//
public InfoCardRSAPKCS1SignatureDeformatter() : base() {}
public InfoCardRSAPKCS1SignatureDeformatter( AsymmetricAlgorithm key ) : base( key )
{
m_rsaKey = (RSA) key;
}
//
// public methods
//
public override void SetKey( AsymmetricAlgorithm key )
{
base.SetKey( key );
m_rsaKey = (RSA) key;
}
public override void SetHashAlgorithm( string strName )
{
base.SetHashAlgorithm( strName );
m_strOID = CryptoConfig.MapNameToOID(strName);
}
public override bool VerifySignature( byte[] rgbHash, byte[] rgbSignature )
{
if ( !( m_strOID == null || m_rsaKey == null || rgbHash == null || rgbSignature == null )
&& m_rsaKey is InfoCardRSACryptoProvider )
{
return ((InfoCardRSACryptoProvider) m_rsaKey).VerifyHash(rgbHash, m_strOID, rgbSignature);
}
else
{
return base.VerifySignature( rgbHash, rgbSignature );
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BrowserDefinitionCollection.cs
- EncryptedType.cs
- PowerModeChangedEventArgs.cs
- BinaryFormatterSinks.cs
- PeerHopCountAttribute.cs
- PrintDialogException.cs
- CodeIdentifier.cs
- EnvelopedSignatureTransform.cs
- KeyFrames.cs
- ELinqQueryState.cs
- DataGridViewColumnEventArgs.cs
- SwitchLevelAttribute.cs
- XsdBuildProvider.cs
- ServerReliableChannelBinder.cs
- MdImport.cs
- Part.cs
- DelegateHelpers.cs
- DateTimeFormatInfo.cs
- DataListCommandEventArgs.cs
- CollectionConverter.cs
- VSDExceptions.cs
- ReadOnlyHierarchicalDataSourceView.cs
- IPipelineRuntime.cs
- HashCodeCombiner.cs
- ColumnResizeUndoUnit.cs
- SafeRegistryHandle.cs
- ParserStack.cs
- GridSplitter.cs
- QilInvokeEarlyBound.cs
- Model3DGroup.cs
- ComponentEditorForm.cs
- GlobalItem.cs
- CalendarDay.cs
- SafeEventLogWriteHandle.cs
- ClipboardProcessor.cs
- ByteKeyFrameCollection.cs
- SyndicationItem.cs
- EdmFunctions.cs
- NameTable.cs
- CultureInfo.cs
- SymbolType.cs
- MobilePage.cs
- ExpressionBuilderContext.cs
- TabPage.cs
- MenuBindingsEditor.cs
- PocoEntityKeyStrategy.cs
- TrustLevelCollection.cs
- LayoutTable.cs
- LongValidatorAttribute.cs
- tooltip.cs
- PeerApplication.cs
- Type.cs
- IndentTextWriter.cs
- ResourcesGenerator.cs
- DifferencingCollection.cs
- SendKeys.cs
- DataRowView.cs
- SharedStatics.cs
- DefaultPrintController.cs
- LeafCellTreeNode.cs
- X509Extension.cs
- Variant.cs
- DataGridRelationshipRow.cs
- RegexGroupCollection.cs
- PersonalizationStateInfo.cs
- QueryExpr.cs
- assemblycache.cs
- GridViewUpdateEventArgs.cs
- TypefaceCollection.cs
- AttributeConverter.cs
- RegularExpressionValidator.cs
- SchemaObjectWriter.cs
- BitmapEffectrendercontext.cs
- NumberFormatter.cs
- DataPointer.cs
- Speller.cs
- UnSafeCharBuffer.cs
- XamlPointCollectionSerializer.cs
- SqlUserDefinedTypeAttribute.cs
- Encoding.cs
- SchemaElementDecl.cs
- AutomationElement.cs
- BitmapSourceSafeMILHandle.cs
- EncoderReplacementFallback.cs
- BinaryReader.cs
- Panel.cs
- SSmlParser.cs
- Stylus.cs
- XmlValueConverter.cs
- ApplicationTrust.cs
- MethodCallConverter.cs
- ComEventsMethod.cs
- EncoderParameter.cs
- JoinSymbol.cs
- ProgressBar.cs
- WebPartCloseVerb.cs
- PermissionRequestEvidence.cs
- AmbiguousMatchException.cs
- AssemblyCache.cs
- CapabilitiesAssignment.cs