473,382 Members | 1,329 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,382 software developers and data experts.

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

Expand|Select|Wrap|Line Numbers
  1. private readonly string KeyContainerName = "MyKeyContainer";
  2.  
  3. public void GenerateKeyPair()
  4.         {
  5.  
  6.             Debug.WriteLine("Generating Key Pair");
  7.  
  8.             CspParameters cp = new CspParameters();           
  9.  
  10.             cp.KeyContainerName = KeyContainerName;
  11.  
  12.             cp.Flags = CspProviderFlags.UseDefaultKeyContainer;
  13.  
  14.             RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024,cp);
  15.  
  16.             rsaProvider.PersistKeyInCsp = true;
  17.  
  18.             byte[] pubkey = rsaProvider.ExportCspBlob(false);
  19.  
  20.             string PublicKey = Convert.ToBase64String(pubkey);
  21.  
  22.             if (!x.checkSettingExists("PublicKey"))
  23.                 x.addSetting("PublicKey", PublicKey);
  24.             else
  25.                 x.changeSetting("PublicKey", PublicKey);
  26.  
  27.  
  28.         }
x is a XML Utility class that i created which will save the the Public Key to an XML file.

However my problem is that even if i change the Key Container name, the public key generated is ALWAYS the same... I am under the impression that changing the key container would generate a fresh pair of private/public key pair.

Note that i am using Dot Net Compact Framework 3.5 :)

What am i doing wrong? Any insight to it would be highly appreciated :)

To make it even worse, i tried with a physical device which actually generates the same public key... I really don't know how that is possible...
Aug 16 '10 #1
0 909

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Maziar Aflatoun | last post by:
Hi everyone, I have 2 tables with table A containing an 'email' field and table B containing 2 fields 'primaryemail' and 'secondaryemail'. Now is it possible to issue a query that would return...
2
by: Daniel | last post by:
is it possible to install multiple copys of the same .net web service on the same computer but with different service names specified durring instalation?
6
by: Jim's wife | last post by:
Hi all I need to create a new table based on a source table. The new table is almost the same as the source table in that just some field names must change, and a few new fields added or...
2
by: teresaalmond | last post by:
I routinely have to qry several databases and combine the records for a mailing list. In all of the tables the fiedl names are different. For example: FName First name and FirstName Right not I...
2
by: Greg Merideth | last post by:
Using Visual C# I created two forms such as namespace test { public class SystemTray : System.Windows.Forms.Form { public createwindow() { stuff here; } public fadewindow() { stuff to fade...
2
by: Drolem | last post by:
Hello All, I use the following method to serialize a settings class to a string: '======================================================================= Public Shared Function...
4
by: AB | last post by:
Hi All, I would like to add controls that stored in DB dynamically, and I don't know their names or their number. The names of the controls is important therefore I can't create cmbArr(0),...
3
by: cybernerdsx2 | last post by:
Hi, I notice a function prototype being declared as following: FileStream.h ========= extern void openFile(char *__ident, int __option); But, in the function declaration part shown as...
1
by: Wayne | last post by:
I am trying to import files that start the same but are sequencial. For instance ABC123, ABC124 from C:\FOLDERNAME. These are .dbf files that are created from a Foxpro program. I would like all the...
0
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
I'm using the new ASP.NET web application project and want to deploy my files to the web server. I've set the project to Release mode and have even set the "debug=false" tag in Web.config. Yet...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.