473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

RSA - encrypting/decrypting ???

Hi,

Using the RSA-crypto algorithm in .NET , when actually encrypting/decrypting, all the code samples I ran into always used something like, to encrypt :

// create keypair and store in container
CspParameters param = new CspParameters();
param.KeyContainerName = "NewKeyContainer";
param.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsaObj = new
RSACryptoServiceProvider(param);

// encrypt
byte[] arEncryptedData;
arEncryptedData =
rsaObj.Encrypt(Session("myDataToEncrypt"), False);
Session("encryptedData") = arEncryptedData;

and to decrypt

// get the parameters from the container
CspParameters param = new CspParameters();
param.KeyContainerName = "NewKeyContainer";
param.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsaObj = new
RSACryptoServiceProvider(param);

// decrypt
byte[] arDecryptedData;
arDecryptedData =
rsaObj.Decrypt(Session("encryptedData"), False)

But, this sample assumes that both the encrypt-part and decrypt-part have access to the SAME keyContainer named "NewKeyContainer" (located on the same machine ???) THIS IS NO REAL-LIFE SCENARIO I would say.

I would like to implement following scenario :
The client encrypts data using ONLY the public-key of the generated keypair and the server decrypts the data using ONLY the private-key and where the client does not the private-key stored on his machine nowhere !!!

How do you do that ???

I think, I'm not sure though, I know how to obtain the separate keys namely using (correct me if I'm wrong)
RSAParameters rsaParam;
rsaParam = rsaObj.ExportParameters(True);
where
rsaParam.Exponent and rsaParam.Modulus are used to encrypt and represent the public key (is this correct what I pretend ?)
and rsaParam.D represents the private key.

But how to use only rsaParam.Exponent and rsaParam.Modulus to encrypt on the client and rsaParam.D on the server ??

thanks very much for any help !!

greetings
Chris
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 17 '05 #1
0 1475

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Piotr | last post by:
MS has published on its sites javascript encoder, which enables "encrypting" javascript code. It allows hiding js code from being seen as a text file. There is a decoder for it, available in the...
1
by: jimfortune | last post by:
This idea is still in the process of formulation. I'm considering the idea of storing encrypted data in memo fields. Since the data is for internal use only I don't think the legal limits on...
4
by: John Young | last post by:
Hi, I have been trying to encrypt and decrypt a filestream. I have a problem where if I encrypt a file a set key and iv (eg. key is 'polomint' and the IV is '12345678'), and then decrypt it with...
4
by: Andy G | last post by:
If users forget there passwords I want to send a link to them through email so they can click on a link and go to a change password page. eBay does this by sending you a url that looks something...
0
by: cmrchs | last post by:
Hi, Using the RSA-crypto algorithm in .NET , when actually encrypting/decrypting, all the code samples I ran into always used something like, to encrypt : ' create keypair and store in...
3
by: neil | last post by:
Hi, I'm not sure whether this is a known or documented issue (I could'nt turn anything up, but maybe I'm not looking hard enough), but I seem to be have a problem encrypting and decrypting...
2
by: Amar | last post by:
Hi All, I want to insert my password into the mysql database by encrypting it so that I can also retrieve the password. Before I was using sha1() for encrypting password,but it is an one way...
3
by: dfa_geko | last post by:
Hi All, I had a question about encrypting and decrypting XML files using asymmetric keys. I copied some sample code from MSDN, here are the samples: ...
2
by: SeeSharp Bint | last post by:
Visual Studio 2005, dotnet, c#. Microsoft SQL Server. Windows XP forms application. Temporarily, for my database application, I have been storing the various elements of database connection...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.