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
1
vote
1 answer
RSACryptoServiceProvider - where does the seed data is being generated?
I have the following code that generates public and private keys using RSA.
// generate RSA 1024
using (var rsa = new RSACryptoServiceProvider(1024))
{
var publicString =…

VAAA
- 14,531
- 28
- 130
- 253
1
vote
1 answer
Using RSACryptoServiceProvider, how does one store a key exchange key and signature key in the same key container?
I want to use a key pair for encryption and a separate key pair for signing. How can I store them in the same key container using RSACryptoServiceProvider?

Ian Warburton
- 15,170
- 23
- 107
- 189
1
vote
1 answer
How to load CspParams in RSGCng
We are trying to load private key from container Name using cspParams in RSACng object. We don't see a direct way to load this and currently we are performing below workaround to load it from RSACryptoServiceProvider as shown below,
…

TryingStuff
- 35
- 5
1
vote
1 answer
RSA Crypto: Is it require to store keypair after geneating first time
Once public/private key generated then, is this has to store or persist on storage So, when decryption call then same private key (related to public key) is used ?
Basically, there will be two separate endpoints for RSA encrypt and decryption.
…

user3711357
- 1,425
- 7
- 32
- 54
1
vote
2 answers
Create RSACryptoServiceProvider from public key ONLY
I am using the key-pair to sign my XML (using SignedXml) and I embed the public key in my app as embedded resources.
Here how I create the key pair
sn -k Warehouse.snk
sn -p Warehouse.snk WarehousePublic.snk
When I tried to read the…

Sam
- 1,826
- 26
- 58
1
vote
1 answer
How to extract the prime numbers generated by RSACryptoServiceProvider?
The below code is attempting to get the two RSA prime numbers generated by RSACryptoServiceProvider. I'm testing primeq for primality and it always turns up to be non prime. What am I doing wrong here ?
RSACryptoServiceProvider rsa = new…

ivymike
- 1,511
- 2
- 20
- 27
1
vote
1 answer
Keyset does not exist /r /n
I was tasked to create a integration service between our SharePoint app and one service provider. One requirement of the service provider I'm going to integrate with is to provide them a public key which they will use to verify my request which was…

lem.mallari
- 1,274
- 12
- 25
1
vote
2 answers
Why is SHA256 and invalid hash algorithm when signing with RSA?
I am trying to sign a stream using the method below but I always get a Cryptographic Exception saying that it is not a valid hash algorithm even though it is listed in the documentation:
byte[] SignData(RSACryptoServiceProvider rsa, Stream stream,…

Lord of Scripts
- 3,579
- 5
- 41
- 62
1
vote
1 answer
Add TimeStamp to digital signature
I have a code to sign a string with A1 certificate successfull usin C#.
I need to add a TimeStamp to this signature. This TimeStamp need went from a TimeStamp server like http://www.cryptopro.ru/tsp/tsp.srf
I can't figure out how to put the…

ric3ca
- 11
- 1
- 4
1
vote
0 answers
CryptographicException in CSP components under Temporary or Mandatory user profile
I have a .Net component which I am maintaining which makes use of the FromXmlString method of the DSA class. This works fine, most of the time. Under certain circumstances, it fails with this exception: "CryptographicException: The profile for…

William
- 690
- 5
- 13
1
vote
1 answer
Encypting code from C# to php (with phpseclib)
I have a encryption C# code, that i'm trying to implement in PHP and phpseclib and get exactly same results. It's RSA. But I cannot get it done. It gives me empty string in PHP as encoded.
Public key is in this format:

Simos Fasouliotis
- 1,383
- 2
- 16
- 35
1
vote
0 answers
Create Key Container by aspnet_regiis and Sign Message by RSACryptoServiceProvider in .NET
I am studying the proper way to sign message in Windows and .NET.
I planned to use aspnet_regiis to create a key pair in server's machine key container, export the public key and import it in client's machine key container. I tested both server and…

ggiraffe
- 36
- 4
1
vote
2 answers
Generate random RSA keys with RSACryptoServiceProvider
How do I generate random RSA public and private keys (RSAParameters) using RSACryptoServiceProvider class?
Each time I create a new instance of RSACryptoServiceProvider, I end up exporting the same keys.
Thanks

Maksim Skurydzin
- 10,301
- 8
- 40
- 53
1
vote
2 answers
Import openssl public key to C# RSACryptoServiceProvider
I am create server side program in c++, program create RSA public and private key with openssl library and then public key distribute over the network for clients. in clients side i wrote c# program first get public key and then encrypt data. but i…

Khalil
- 238
- 2
- 15
1
vote
1 answer
What is the ruby equivalant of this C# RSACryptoServiceProvider methods
int dwKeySize = 1024;
rsaCryptoServiceProvider = new RSACryptoServiceProvider(dwKeySize);
rsaCryptoServiceProvider.FromXmlString(strxmlString);
byte[] bytes = Encoding.UTF8.GetBytes(strInPut);
byte[] encryptedBytes =…

Shiv Kumar
- 11
- 1