473,395 Members | 2,253 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,395 software developers and data experts.

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
computer.
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 X509CertificateStore object? I
create a X509CertificateStore object, specifying the CurentUser:Personal
store, get the X509CertificateCollection (using the .Certificates property)
and then add a X509Certificate (loaded from a file) - but nothing happens.
The X509CertificateCollection of the X509CertificateStore 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 2386

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

Similar topics

1
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...
6
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...
1
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...
0
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...
0
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...
1
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...
5
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...
3
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. ...
12
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...
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: 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...
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,...
0
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,...
0
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...
0
tracyyun
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...
0
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,...

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.