Problem with decrypting data

From: Tomek (tpiotr_at_op.pl)
Date: 10/08/04


Date: 8 Oct 2004 02:39:26 -0700

Hi,
I'm trying to encrypt and decrypt data using a smart card. I encrypted
data with RSACryptoServiceProvider.Encrypt function. The problem is
that decrypting data fails. I'm getting a CryptographicException and a
message: "Bad key".
When I encrypt I import to RSACryptoServiceProvider only an
information about exponent and modulus of a public key and it works.
When I decrypt I pass to RSACryptoServiceProvider all the parameters
of CspParams: provider type code, provider name, container name, it
fails (I used RSACryptoServiceProvider created in the same way when I
was signing XML files and everything was OK). In both cases I use the
same certificate. I also tried to use during the encryption process
RSACryptoServiceProvider created in the secend way but it didn't work.
I was getting a CryptographicException and a message: "An Internal
Error has occured". I'm in desperate. Can anybody help me?



Relevant Pages

  • Re: Use my your own HashAlgorithm Class
    ... Rather than use the EncryptValue / DecryptValue methods (which RSACryptoServiceProvider doesn't support), ... the Encrypt and Decrypt methods. ... >> doesn't know about your new algorithm. ... But CAPI doesn't work with OIDs directly, ...
    (microsoft.public.dotnet.security)
  • RSA Encryption: Saving keys as files, and size of encrypted data
    ... Could I ask for some help with RSACryptoServiceProvider class. ... files, and the other 2 apps encrypt and decrypt, using those xml strings. ... Dim RSA As RSACryptoServiceProvider = New ... Dim PubKey as string = RSA.ToXmlString ...
    (microsoft.public.dotnet.security)
  • Strong encryption with RSACryptoServiceProvider..?
    ... Does anyone know how to encrypt more than 16 bytes with the ... RSACryptoServiceProvider on Windows 98? ... Byte array is too large. ... I suspect that the RSACryptoServiceProvider uses the Microsoft Base CSP on ...
    (microsoft.public.platformsdk.security)
  • Strong encryption with RSACryptoServiceProvider..?
    ... Does anyone know how to encrypt more than 16 bytes with the ... RSACryptoServiceProvider on Windows 98? ... Byte array is too large. ... I suspect that the RSACryptoServiceProvider uses the Microsoft Base CSP on ...
    (microsoft.public.dotnet.security)
  • Re: Public Key Encryption with RSACryptoServiceProvider
    ... >> When it's time to encrypt a license number, I create a new instance of the ... > RSACryptoServiceProvider object and read in the public key using its FromXml ... I then call the Encrypt function, passing it the license number ...
    (microsoft.public.dotnet.security)