I want to implement a dutch payment system (iDeal Professional - Rabobank) in my ASP.NET 4.0 website. For communication I have to send an XML message with an encrypted string in it.
First I had to create a private key, using the following command (OpenSSL):
openssl genrsa -des3 –out
openssl req -x509 -new -key
1. Create an SHA1 digest message based on a specific string (http://www.itl.nist.gov/fipspubs/fip180-1.htm)
2. Encrypt the digest using the private key and RSA (http://www.rsasecurity.com/rsalabs/node.asp?id=2146 / http://www.rsasecurity.com/rsalabs/node.asp?id=2124)
3. Base64 encode the encrypted message
Step 1 and 3 are no problem, bu does anybody know how to perform step 2?
Thanks in advance for your answer,
Dennieku
Mike FifPosted Oct 14, 2011, 1:16 PM
Thanks for your respons.
Cheers
MikeFIF
Javeed M ShaikhPosted Oct 13, 2011, 3:25 PM
denniekuPosted Oct 13, 2011, 2:51 PM
I bought the Chilkat RSA component, which solved my problem. Check http://www.chilkatsoft.com/rsa-dotnet.asp
Javeed M ShaikhPosted Oct 13, 2011, 2:43 PM
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
pProcess.StartInfo.FileName = "YourOpenSSLCommand";
pProcess.StartInfo.Arguments = "anyargumentstoopenssl";
pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WorkingDirectory = "workingdirectory";
pProcess.Start();
string strOutput = pProcess.StandardOutput.ReadToEnd();
pProcess.WaitForExit();
Please do not forget to mark "Accepted Answer"
Mike FifPosted Oct 13, 2011, 2:13 PM
Did you figure out how to solve that problem? I kind of have the same issue atthe moment. Your reply would be much appreciated.
Kind regards
mike
denniekuPosted Apr 22, 2011, 5:34 AM
Tanks four your reply. I already tried some code like this, but the problem is that my private key file is not an XML file, so the code crashes at the line FromXmlString. The content of the file looks like:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,1595C9C7A54AC3E8
nvd6z9g5r4d72jWDuQoeye/9vRVf3aIrP5x/P92D7yLuBPdA90uUh9jd4DiwLuDm
fU2xIAWIp....
Do you know how I can use a file like this?
Thanks,
Dennieku
Sahil JaniPosted Apr 21, 2011, 12:47 AM
Hi,
Here i have written some code to encrypt the mesage using RSA. And normally in RSA message encryption is done using Private key it self.
class Program
{
static void Main(string[] args)
{
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
StreamReader sr = File.OpenText("myKey.xml");
string rsaXml = sr.ReadToEnd();
sr.Close();
rsa.FromXmlString(rsaXml);
string messageToJane = "this is a test";
byte[] encrypted = rsa.Encrypt(System.Text.ASCIIEncoding.ASCII.GetBytes(messageToJane), false);
FileStream fs = new FileStream("Message.dat", FileMode.Create);
fs.Write(encrypted, 0, encrypted.Length);
fs.Close();
}
}
for writting tis code you have to import some file here as under ::
using System;
using System.IO;
using System.Security;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;