Re: Exception applying Digital Signature in VS.NET
- From: alexpicchio@xxxxxxxxxx
- Date: 9 Mar 2007 00:49:25 -0800
Thanks for your cooperation.
I changed the code and declared the two Byte array in the same way (to
be sure I tried one time with dim XXX() as byte and another time with
dim XXX as byte()).
Unfortunately, I receive the same exception.
Alexpicchio
DXRick ha scritto:
I am not a VB pro, but this looks fishy:
Dim originalData As Byte() = ByteConverter.GetBytes(dataString)
Dim signedData() As Byte
You have declared a Byte array in two different ways.
"alexpicchio@xxxxxxxxxx" wrote:
Hi!
I'm trying to apply a digital signature using a SYSGILLO CSP Provider
in the Visual Studio .NET environment (framework 1.1/2.0).
When I run the following code, the program prompts me for PIN and then
I receive the following
exception at the last line of the code below (rsa.SignData).
An unhandled exception of type
'System.Security.Cryptography.CryptographicException' occurred in
mscorlib.dll
Additional information: The operation completed successfully.
This is my code:
' Create a new CspParameters object that identifies a
type_provider = 1
name_provider = "SysGillo Cryptographic Service Provider"
Dim csp As New CspParameters(type_provider, name_provider)
csp.Flags = CspProviderFlags.UseDefaultKeyContainer
' Specify a signature key (digital signature)
csp.KeyNumber = 2
' Initialize an RSACryptoServiceProvider object using the
CspParameters object.
Dim rsa As New RSACryptoServiceProvider(csp)
' Create a UnicodeEncoder to convert between byte array and
string.
Dim ByteConverter As New ASCIIEncoding()
Dim dataString As String = "Data to Sign"
' Create byte arrays to hold original, encrypted, and decrypted
data.
Dim originalData As Byte() = ByteConverter.GetBytes(dataString)
Dim signedData() As Byte
' Hash and sign the data.
signedData = rsa.SignData(originalData, New
SHA1CryptoServiceProvider())
Can anyone help me?
Thanks to all.
Alexpicchio
.
- References:
- Exception applying Digital Signature in VS.NET
- From: alexpicchio
- Exception applying Digital Signature in VS.NET
- Prev by Date: Re: .NET CAS vs OS security
- Next by Date: RSACryptoServiceProvider minimum key-length
- Previous by thread: Exception applying Digital Signature in VS.NET
- Next by thread: Re: .NET CAS vs OS security
- Index(es):
Relevant Pages
|