473,729 Members | 2,099 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
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 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 2447

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

Similar topics

1
3066
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 references to Microsoft.Office.Core and Microsoft Excel 11.0 Object Library. When I try to use the...
6
9214
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 eventually be on a regular file)?
1
1714
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 generated by the older certificate. This is a compatibility problem, of course. It's not...
0
979
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"
0
698
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 file as a certificate into the system store, but on another computer. 3) Export the certificate from...
1
4937
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 problem are the certificates or the c++ code. Platform / OS / Version: IDE: embeddedVisualC++...
5
2502
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
3
3576
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
12
5640
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?
0
8927
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
8764
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
9428
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...
0
9289
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9156
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 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8159
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
6722
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
4534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3242
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

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.