Questions tagged [rsacryptoserviceprovider]

The RSACryptoServiceProvider object performs asymmetric encryption and decryption using the implementation of the RSA algorithm provided by the cryptographic service provider (CSP).

216 questions
3
votes
0 answers

RSACryptoServiceProvider.ImportParameters ObjectDisposedException

We have a webservice we would like to sign an incoming request and send it further. We are using the static object of System.Security.Cryptography.RSACryptoServiceProvider and every instance is using the same static object to sign it. I read on…
sandeep
  • 996
  • 2
  • 11
  • 22
3
votes
0 answers

Decrypting the signature created by RSACryptoServiceProvider.SignData() to get the hash

I'm trying to retrieve the hash created with the RSACryptoServiceProvider class' SignData and SignHash methods. I need this to be able to store encrypted hashes that must be retrieved later because they're part of a hash chain. Initially I wanted to…
Matej
  • 625
  • 7
  • 14
3
votes
1 answer

Verifying PHP OpenSSL signature in C# with RSACryptoProvider

I am attempting to verify an OpenSSL signature (created using openssl_sign with SHA1 in PHP) using C# RSACryptoProvider.VerifyData. It is returning false using the correct public key certificate. Any idea about how to do this successfully? EDIT: I…
theringostarrs
  • 11,940
  • 14
  • 50
  • 63
3
votes
2 answers

RSACryptoServiceProvider(RSACryptoServiceProvider) constructor crashing in .NET 3.5 for certain key names

If you look at the code below it is doing nothing but creating a new instance of an RSACryptoServiceProvider. The key container name is initialized from a property that creates a name based on various parameters. I have added hardcoded values in…
Krumelur
  • 32,180
  • 27
  • 124
  • 263
3
votes
2 answers

PyCrypto Sign Message and Verify Signature in .NET RSACryptoServiceProvider

I'm trying to create a signature verification system that uses my website which runs on the Google API with PyCrypto Engine. The program that generates signature is quite simple: from Crypto.PublicKey import RSA from Crypto.Hash import MD5 def…
2
votes
2 answers

.Net Simple RSA encryption

I'm trying to encrypt something simple, like int or long. Simplest way I found looks like: int num = 2; RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); byte[] numBytes = BitConverter.GetBytes(num); byte[] encryptedBytes =…
user97889
  • 113
  • 1
  • 5
2
votes
2 answers

Microsoft RSA CSP key size

From what I can see, Microsoft's RSA CSP always generates identical bitlength pseudo prime numbers. So if the key size is 1024, the P and Q values seem to be (?) guaranteed to be 512 bits each? Does anyone know for sure if this, in fact, is the…
2
votes
0 answers

.NET RSA data signing, are my assumptions correct?

I've been digging into the .NET System.Security.Cryptography namespace, specifically the RSACryptoServiceProvider class. It has two methods using in signing data, SignHash() and VerifyHash() and I have a few questions regarding the usage of this…
Per
  • 1,074
  • 6
  • 19
2
votes
2 answers

Strong name export from a key container

We do have a build server, which contains our private key, used to sign the delay-signed assemblies, in a key container. We are now creating another build server and no one seems to know, where the original key file is, so we're trying to export the…
Hassan
  • 2,603
  • 2
  • 19
  • 18
2
votes
2 answers

Using RSACryptoServiceProvider in C# to encrypt/decrypt an excel file?

How can I use private/public keys for encryption/decryption of an an excel file in C#.NET? The article RSA Encryption in C# describes a way of doing this encryption, but this example only works for encrypting/decrypting text, not for an excel…
2
votes
1 answer

Encryption in Java with RSA/ECB/OAEPWithSHA-256AndMGF1Padding could not be decrypted in .NET

We have a requirement where in Java does the encryption and .NET does the decryption. The issue is with Asymmetric decryption in .NET, the algorithm, mode and padding used in Java while encryption is "RSA/ECB/OAEPWithSHA-256AndMGF1Padding". On .NET,…
2
votes
1 answer

Override default algorithm in RSA object to support OaepSHA256 padding

Creating RSA or RSACryptoServiceProvider object in .Net 4.6 is defaulting KeyExchangeAlgorithm RSA-PKCS1-KeyEx which supports only OaepSHA1 padding. Getting "Specified padding mode is not valid for this algorithm" on trying to use other padding…
2
votes
1 answer

How to persist public key created by RSACng to Local machine or Key Storage provider(KSP)?

I have a Public key and private key pair generated by RSACng class. I am able to persist private key into my KSP(MicrosoftSoftwareKeyStorageProvider) under local machine->(Program Data-> Crypto->RSA->Keys) .But, i am unable to persist public key…
2
votes
1 answer

How to decrypt data using RSACng that is previously encrypted with RSACryptoServiceProvider

I am migrating on RSACng for new version release from RSACryptoServiceProvider. However, as RSACryptoserviceProvider that is CAPI uses Little Endian Architecture and RSACng that is CNG API is using Big Endian Architecture, question is how can i…
2
votes
1 answer

"Bad Data" when decrypting using RSACryptoProvider from string encrypted in PHP

I am trying to decrypt a string in C# that was encrypted in PHP using RSA, and for the life of me, I can't get it right. I have condensed the problem to two sample test apps in .NET and PHP: In C#: class Program { static void Main(string[]…
michael_erasmus
  • 906
  • 1
  • 9
  • 17