The RSACryptoServiceProvider object performs asymmetric encryption and decryption using the implementation of the RSA algorithm provided by the cryptographic service provider (CSP).
Questions tagged [rsacryptoserviceprovider]
216 questions
2
votes
1 answer
.net RSA sign data error with PSS padding
I have a question re. the use of Crypto in .net as follows. I have a .pem file which I am able to parse to a private key and would like to sign some data bytes. The code I'm using is below:
byte[] pemkey =…

Kevin Le
- 43
- 1
- 4
2
votes
1 answer
Getting Exception "Invalid Provider type specified" or "Key does not exist" while getting Private key from X509Certificate2 Occasionally
I am getting one of the following Exceptions while trying to get a private key from X509Certificate2 certificate:
System.Security.Cryptography.CryptographicException: Invalid provider type…

Narendra Vaghamshi
- 21
- 1
- 2
2
votes
2 answers
RSA - Encrypting using only(!) Modulus?
We're using an API from another company .
In that API I should generate a key pair using RSACryptoServiceProvider and send the public key so that they can encrypt data for us.
That's not a problem. In their API - the public key is a byte[]…

Royi Namir
- 144,742
- 138
- 468
- 792
2
votes
1 answer
.NET RSACryptoServiceProvider encrypt with 4096 private key, how to decrypt it on Android
I am encrypting the message in .NET with RSACryptoServiceProvider with private key. (PKCS#1 v1.5)
When I try to decrypt in .NET with the following code that uses public key everything works fine:
private static string Decrypt(string key, string…

Brcinho
- 321
- 5
- 10
2
votes
2 answers
RSA_sign and RSACryptoProvider.VerifySignature
I'm trying to get up to speed on how to get some code that uses OpenSSL for cryptography, to play nice with another program that I'm writing in C#, using the Microsoft cryptography providers available in .NET.
More to the point, I'm trying to have…

Mike Dinescu
- 54,171
- 16
- 118
- 151
2
votes
1 answer
Key does not exist when trying to decrypt using RSA
So, I am creating a simple "web chat", using TcpClient and TcpListener class. I want all data sent to be encrpyted, and I am using AES encryption. So first I have to make sure AES key from server is securely sent to client. I am trying to achieve…

n32303
- 831
- 1
- 10
- 25
2
votes
2 answers
Sign and decrypt data using private keys located on a HSM
I have a task to sign and decrypt data, but the private keys are located at a HSM ( Luna SA, / Safenet ). I installed all the client software and connected the Luna SA CSP to the test servers.
Using the PKCS#11 functions provided, I am able to list…

esskar
- 10,638
- 3
- 36
- 57
2
votes
0 answers
How can I import a password protected RSA private key into an RSACryptoServiceProvider
I am looking for the same solution that was found in this question:
How can I import an RSA private key into an RSACryptoServiceProvider?
Unfortunately the actual method of the solution is not provided and I'm having trouble with the last steps. …

Ben Randall
- 1,205
- 10
- 27
2
votes
1 answer
Why does RSACryptoServiceProvider.VerifyHash have a “hash algorithm identifier” parameter?
Since RSACryptoServiceProvider.VerifyHash verifies an already hashed message - why does it need to know which hash algorithm was used?
When asking about the SignHash method , it was suggested that the reason there is for communicating the hash (and…

ispiro
- 26,556
- 38
- 136
- 291
2
votes
0 answers
RSA encrypt a string in C# using pre-existing keys generated by Java library
I need to port to C# a portion of an existing and working Java system which handles encrypting/decrypting a string. My C# solution will encrypt a string, and the existing Java system will need to be able to decrypt that string.
Both systems will…

John L
- 305
- 2
- 3
- 15
2
votes
1 answer
How to define the hash size when encrypting with RSACryptoServiceProvider?
Possible Duplicate:
Can RSACryptoServiceProvider (.NET’s RSA) use SHA256 for encryption (not signing) instead of SHA1?
When using RSACryptoServiceProvider for encryption the default hash algorithm obviously is SHA-1. How can I define another hash…

Jürgen Bayer
- 2,993
- 3
- 26
- 51
2
votes
2 answers
Decrypting a string with private key (RSA)
I have a public key and a private key and also a string which I want to decrypt.
The public key is in this format:
-----BEGIN PUBLIC KEY-----
(key here)
-----END PUBLIC KEY-----
The private key is in this format:
-----BEGIN RSA PRIVATE…

Dan
- 3,879
- 5
- 36
- 50
2
votes
0 answers
Object already exists exception in RSACryptoServiceProvider
First let me start by saying I'm sorry if I posted this question in the wrong place. I saw the entry at Object already exists in RSACryptoServiceProvider. I tried the solutions offered there. But, they did not solve my issue. Also, I didn't see…

Mikutus
- 83
- 1
- 10
1
vote
2 answers
Implement secure communication using RSA encryption in C#
I want to implement a scenario where two endpoints can securely communicate with each other using public/private key encryption. The scenario is following:
For A to send a message to B:
A encrypts the message using A's private key.
A encrypts the…

Sharp.Extensions
- 33
- 1
- 9
1
vote
1 answer
Format of OpenSSH private keys
Can anyone point me towards a file format for OpenSSH keys? Sample code would be fantastic but even a pointer towards the relevant RFC would be a big help.
As background, I have a C# program which needs to generate a ssh key at runtime. The…

simonc
- 41,632
- 12
- 85
- 103