473,666 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.KeyContai nerName = "NewKeyContaine r";
param.Flags = CspProviderFlag s.UseMachineKey Store;
RSACryptoServic eProvider rsaObj = new
RSACryptoServic eProvider(param );

// encrypt
byte[] arEncryptedData ;
arEncryptedData =
rsaObj.Encrypt( Session("myData ToEncrypt"), False);
Session("encryp tedData") = arEncryptedData ;

and to decrypt

// get the parameters from the container
CspParameters param = new CspParameters() ;
param.KeyContai nerName = "NewKeyContaine r";
param.Flags = CspProviderFlag s.UseMachineKey Store;
RSACryptoServic eProvider rsaObj = new
RSACryptoServic eProvider(param );

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

But, this sample assumes that both the encrypt-part and decrypt-part have access to the SAME keyContainer named "NewKeyContaine r" (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.ExportPa rameters(True);
where
rsaParam.Expone nt and rsaParam.Modulu s 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.Expone nt and rsaParam.Modulu s 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 1512

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

Similar topics

3
9831
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 net, freeware, srcdec14.exe. I have tested both, encrypting, decrypting, the source and the final files are identical. But what I met on a certain site is a js file, encoded I think in another way, because I cannot decrypt it using the...
1
3255
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 encryption apply. So memo fields are required because I want to use a couple of 500 or so digit safe primes for the encryption. Note that public key encryption has been around for quite a while so some organizations may have a pretty large prime...
4
1372
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 the same key but an IV of 29384567, it still shows the file mostly unencrypted!.... Is it just me, or does the IV not have too much of a difference on decrypting? Here's my encryption code,,,,,
4
7040
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 like, http://sigin.ebay.com/aw-cgi/pass/$1$69912$1XasURRhQFdYhulVSnJqt. I want to a send a url with ?userID=228 tacked on the end. Instead of the 228 being in clear text I want to encrypt it somehow and then user Request.QueryString("userID") to...
0
1372
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 container Dim param As New CspParameters param.KeyContainerName = "NewKeyContainer" param.Flags = CspProviderFlags.UseMachineKeyStore Dim rsaObj As New RSACryptoServiceProvider(param)
3
3203
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 entries with special characters - namely the '@' symbol. For example I can encrypt and decrypt a name or an address - however, if I try this with an email address that contains the '@' symbol, such as:
2
1631
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 method. I want to use a function that can be decrypted . Please help me. Thanks Amar
3
2877
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: http://msdn2.microsoft.com/en-us/library/ms229746.aspx http://msdn2.microsoft.com/en-us/library/ms229919.aspx The samples I used are the ones near the bottom of the page. (With a slight modification of moving edElement.KeyInfo.AddClause(new KeyInfoEncryptedKey
2
2273
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 items like datasource,password,userid as plain strings in the registry. I'd now like to make these secure against people reading them. I thought of encrypting/decrypting each string when i write to the registry but I wouldnt know where to find a...
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.