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
8
votes
2 answers
Decrypting with private key from .pem file in c# with .NET crypto library
I know this is a similar question to this one but before I head down the Bouncey Castle route, does anyone know if its possible to load an RSA KeyPair from a .pem file, e.g.:
-----BEGIN RSA PRIVATE KEY-----
…

Tim Jarvis
- 18,465
- 9
- 55
- 92
8
votes
3 answers
.Net: Will my RSA keys still function after August 2012?
I just read this article RSA keys under 1024 bits are blocked, and in my .NET software I make extensive use of 384bit keys. Will my program still be able to generate/store/read keys from the MachineKeyStore using the RSACryptoServiceProvider? Or…

Maestro
- 9,046
- 15
- 83
- 116
7
votes
5 answers
Implementing RSA in C#
I'm currently trying to implement a class to handle secure communications between instances of my app using RSACrytoServiceProveider class.
First question : is it a good idea implement a single class to handle sender/reciever roles or should i…

gogole
- 151
- 1
- 2
- 10
7
votes
3 answers
CryptographicException intermittently occurs when encrypting/decrypting with RSA
I'm trying to encrypt and decrypt data using RSA in C#. I have the following MSTest unit test:
const string rawPassword = "mypass";
// Encrypt
string publicKey, privateKey;
string encryptedPassword = RSAUtils.Encrypt(rawPassword, out publicKey,…

Sarah Vessels
- 30,930
- 33
- 155
- 222
7
votes
1 answer
"Bad Version of provider." while loading the Public key with RSACryptoServiceProvider
I am creating RSA key pair using AsymmetricKeyAlgorithmProvider (Windows.Security.Cryptography.Core) and exporting the keys as shown below:
AsymmetricKeyAlgorithmProvider rsaGenKeys =…

tavier
- 1,744
- 4
- 24
- 53
7
votes
3 answers
How to encrypt Amazon CloudFront signature for private content access using canned policy
Has anyone using .net actually worked out how to successfully sign a signature to use with CloudFront private content? After a couple of days of attempts all I can get is Access Denied.
I have been working with variations of the following code and…

Chet
- 185
- 1
- 8
7
votes
1 answer
"Key does not exist" exception thrown. What am I doing wrong?
I have the below test which isolates a problem I'm running into using System.Security.Cryptograph.RSACryptoServiceProvider. The problem is that r.Decrypt is throwing exception "Key does not exist". If I use privateKeyXml for both the encryption…

Frank Schwieterman
- 24,142
- 15
- 92
- 130
7
votes
1 answer
How to check if a key already exists in container?
I'm building an application for secure messaging between multiple clients. In order to achieve that, I encrypt the message with AES, then I encrypt the AES key with the recipients public RSA key, then I send these two components (RSA-encrypted AES…

Rob
- 11,492
- 14
- 59
- 94
6
votes
1 answer
Encrypting data using RSACryptoServiceProvider has what seems to me as a bizarre feature
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace EncryptionTest
{
class Program
{
static void Main(string[] args)
{
…

Arieh
- 109
- 1
- 5
6
votes
1 answer
Importing RSA public key from XML using RSACryptoServiceProvider sets property PublicOnly to false
I am creating an tool to manage RSA Key Pairs on Windows since there is no built-in functionality for this and we make extensive use of the RSA encryption features in .NET.
The tool provides various functions such as listing existing RSA key pairs,…

CarlR
- 1,718
- 1
- 17
- 21
6
votes
1 answer
Convert RSACryptoServiceProvider RSA XML key to PKCS8
I use RSACryptoServiceProvider in my C# code, and it's working good I could Export RSA XML private and public keys, but for some reason I need to convert this key to *.pem with format (PKCS8 Unencrypted)
my private key like
…

Tarek El-Mallah
- 4,015
- 1
- 31
- 46
6
votes
4 answers
Web.config Encryption Error
Having problem with encryption. I gave full permissions to all users to RSA folders. I did
C:\>aspnet_regiis -pe "appSettings" -location "web.config" -prov "RsaProtectedCo
nfigurationProvider"
Encrypting configuration section...
An error occurred…

BKarms
- 61
- 1
- 1
- 2
6
votes
2 answers
Why does RSACryptoServiceProvider.VerifyHash need an LDAP check?
I recently encountered an odd problem with RSACryptoServiceProvider.VerifyHash.
I have a web application using it for decryption. When users running the web service were doing so over our VPN it became very very slow. When they had no connection or…

Keith
- 150,284
- 78
- 298
- 434
6
votes
2 answers
EncryptedXml DecryptDocument method throws "Bad Data" exception
I wrote a code block for Encrypt/Decrypt Streams.
The code is working in my local machine.
But when I publish my code on web
The Decryption functions throws "Bad Data" exception
Here is the my Encrypton and Decryption functions
private static…

srcnaks
- 243
- 3
- 13
5
votes
1 answer
Generate public-private key pair and show them in textbox in asp.net
any body can explain the parameters of RSAParameters
i had seen the parameters like p,d,e,q,...
i need the private key and public key from it
i got the…

user752303
- 61
- 1
- 1
- 2