rsacryptoserviceprovider

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 the C# program verify an RSA message signature generated by the OpenSSL code. The code tha...

The RSA key container could not be opened

Hi, I've been developing an ASP.NET site on an older machine running XP home. I recently got a new Win 7 PC and moved all my project files across. When I try and run the project, I get this error message: "Failed to decrypt using provider 'MyRsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container cou...

Attempt to set permissions on a KeyContainer in C# is having no effect

I'm using the following code in an attempt to programatically allow the NetworkService account to have access to a key: var RSA = new RSACryptoServiceProvider( new CspParameters() { KeyContainerName = "MyEncryptionKey", Flags = CspProviderFlags.UseExistingKey | CspProviderFlags.UseMachineKeyStore }); RSA.CspKeyContainer...

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, out privateKey); Assert.AreNotEqual(rawPassword, encryptedPassword, "Raw password and e...

High performance RSA implementation for C# or C

Hi! I have an webservice that performs many RSA-signature operations. I use the CryptograhyProvider from .net. This uses the unmanaged CyptoAPI from Windows. I often have this error: System.Security.Cryptography.CryptographicException: Der RPC-Server ist für diesen Vorgang zu stark ausgelastet. [=The rpc server is too busy to complet...

Can another application access a private key stored in a key container using RSACryptoServiceProvider?

I am using RSACryptoServiceProvider to generate public/private key pair and using cspParameters object to store it in a key container. My problem is that after i store the private key in a key container, can another application access the key container and retrieve the private key i generated? If yes, the security of the key is compro...

encrypt/decrypt file by RSACryptoServiceProvider

I need to encrypt/decrypt files (type pdf,txt,doc) by using RSA algorithm in c# I import keys from XMl file I use this method public byte[] DecryptData(byte[] encrypted) { int nBytes = encrypted.Length; byte[] ByteArray = new byte[nBytes]; RSACryptoServiceProvider rsa=new RSACryptoServiceProvider(); StreamReader read...

Why is the same Public Key generated even with different key container names?

private readonly string KeyContainerName = "MyKeyContainer"; public void GenerateKeyPair() { Debug.WriteLine("Generating Key Pair"); CspParameters cp = new CspParameters(); cp.KeyContainerName = KeyContainerName; cp.Flags = CspProviderFlags.UseDefaultKeyContainer; ...

RSACryptoServiceProvider KeyContainer appears to time out?

I am using the RSACryptoServiceProvider like this... private byte[] RSAEncrypt(byte[] DataToEncrypt, string ContainerName, bool DoOAEPPadding) { try { byte[] encryptedData; // Create a new instance of CspParameters. Pass // 13 to specify a DSA container or 1 to specify ...

How to specify public key in RSACryptoServiceProvider .NET class

Hello everybody. I need to sign an xml-doc with digital signature. I know that there is a way to do this in .NET but i cannot understand how to specify my own puplic key in RSACryptoServiceProvider. I need for the public key based on the special keyword. How can i do this? Help me please. ...