473,575 Members | 3,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export and Import certificates with private keys

Hello. Sorry for crossposting, but i didn't have a better idea as to
where to post the question.

I'm using certificates to sign and encrypt SOAP messages, using WSE in .Net.
I want to do the following:
1) Generate a certificate to the system store.
2) Export the certificate from 1) to a file with only the public key, and
then import the file as a certificate into the system store, but on another
3) Export the certificate from 1) to a file/files, with the public AND
private key, and import the file/files as a certificate into the system
store, but on another computer.

I can do 1) with makecert, like this:
makecert -pe -n "CN=myName" -ss my
The certmgr utility (GUI) confirms that a certificate has been created, and
that a private key exists and can be accessed for this certificate.

Now, for 2) i do this:
certmgr -put -c -n myName -s my myName.cer //export to file
certmgr -add -c myName.cer -sm
The certmgr utility (GUI) confirms that a certificate has been added to the
system store, and that a private key does not exist for this certificate.

But, i'm stuck with 3). I tried a few things, but nothing. ;(. Here are a
few things i tried:
a)Certmgr utility (GUI) allows me to export a certificate with a private key
attached to a .pfx file, and then import it back into a store. But this can
only be dont in the GUI mode of the certmgr utility. I need to automatize
this proces, and make it transparent to the user. The user only has to enter
the password for protecting the file which is being exported, and again when
it is imported. This is what i wish to achieve.
b)The makecert utility has options to generate a .pvk file with the private
key. I'm very confused by this. When i generate a private key to a file, the
private key is not associated with the certificate in the store. Why is
that? How do i tell the WSE (or whatever is in charge for this) that a
private key exists, so i can use it? And, when i try to generate a new
certificate using an existing private key .pvk file - the same thing
happens - the certificate "can't see" the private key.

Any other solution to my problem is ok, so that i can move the certificate
with the private key (or the key pair) from
one computer to another (and rebuild the certificate).
Any ideas?

Also, why can't i add certificates to a X509Certificate Store object? I
create a X509Certificate Store object, specifying the CurentUser:Pers onal
store, get the X509Certificate Collection (using the .Certificates property)
and then add a X509Certificate (loaded from a file) - but nothing happens.
The X509Certificate Collection of the X509Certificate Store object is the same
as before calling the Add() method.

Also, when i load a certificate (created with the -pe opetion set, using the
makecert utility) from the system store to a X509Certificate object, i cant
access the private parameters of the .Key property of the X509Certificate
object. An exception is thrown saying that exporting private parameters is
not supported. The private key is there, but i cant access it.

Thanks in advance,
Ivan Zuzak
Jul 21 '05 #1
0 2433

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

Similar topics

by: frankvfox | last post by:
I need a code sample using VB ASP.Net 2003 which exports a tab delimited text file resident on the server into an Excel spreadsheet which will be saved through the browser to the client's local workstation. I don't need examples of a Windows application where everything is local. I've tried KB306022 which doesn't work. I've included...
by: Mattia Saccotelli | last post by:
Hi I would like to encrypt data using AES (Rijndael) algorithm, providing as the key the key from a given certificate. Just for testing I'm using the public key.. Shouldn't I use the private key instead of the public one? Is there a way to get it or to use such algorithm with a specified private key from a certificate (which may...
by: Mike Schilling | last post by:
The certificate we use to sign our assemblies was about to expire, so I contacted Verisign to renew it. The new certificate came, we installed it, we pointed out nightly build at it, the new DLLs got signed, so far so good. The problem is that, when we looked at the with ILDASM, we noticed that the public keys tokens are different from the ones...
by: Leeor Chernov | last post by:
Hi, I am taking this Q from an old message cause I have the same problem: Hi everybody: I want to import the private key of my 1st certificate contained in my Certification store. I create the certificate with the private key exportable, but if I run the code below, I obtain "Export of private parameters is not supported"
by: Ivan Zuzak | last post by:
Hello. Sorry for crossposting, but i didn't have a better idea as to where to post the question. I'm using certificates to sign and encrypt SOAP messages, using WSE in .Net. I want to do the following: 1) Generate a certificate to the system store. 2) Export the certificate from 1) to a file with only the public key, and then import the...
by: pawnee | last post by:
Explanation: I wrote a simple openssl server using code from basic examples. I tried it out with several browsers like firefox, opera, ie and safari. With firefox i get the certificate and then the html site. But with the other browsers I got either no html page at all or got the site just after loading the browser twice. I dont know if the...
by: Harris Kosmidhs | last post by:
Hello there, I have access to a DB2 database through operation navigator. What I would like to do is find a tool to export the database into create table, insert into statements. Like what phpmyadmin does. Is there a free tool for such a job? Thanks
by: ll | last post by:
Currently, I'm exporting a database from production to local (test) machine. I've done this several times without problem, but during the last few days, the primary keys have failed to export. Would anyone know what options might keep the keys from exporting? Thanks, Louis
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i current have a way to read both local and remote machines registry keys and create a textual view (.txt output). i now looking for ways to do export of local and remote mahcine registry keys into ".reg" file format via C#. is this do able? what do i need to research to do this? or is where i need to windows WinApi?
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...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
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...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
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...
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...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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...

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.