views:

171

answers:

1

Hi

I want to export a RSA 1024 private-public exchange key pair from Machine-1 to Machine-2. I am using cryptoAPI in XP.

In Machine-1, i generated the key pair. I wrapped a session key which actually encrypts some real data. The key container name is "PAIR1".

In Machine-2, i wanted to unwrap the session key with the private key(which i generated in Machine-1). For this purpose, i wanted to export the key pair from Machine-1 to Machine-2.

I am aware of security flaws of exporting the persistent keys.

What i have tried?

I exported the keypair as a PKCS#12 -pfx file from Machine_1. When i imported it to Machine-2, the key container name has changed from "PAIR1" to nothing. My application requires the same container name to pick the right private key in the exchange key pair. Is it possible to change the key container name?

Will this work?

Wrap the exchange key pair with Machine-2's public key and import it to Machine-2. In this case, do think, the key container name will remain the same or will it change? I feel that this might be the right approach.

Please give your comments.

Thanks

Edited: The reason i asked this query is because I wrapped a session key with an exchange key pair (public key) and put the wrapped key along with the encrypted data in a medium at the server. This medium will go-around different clients and will come back to the server. At this point, I will be decrypting my data with the unwrapped session key. This unwrapping needs the exchange private key. I am doing this for a demo purpose and I cannot expect our marketing guys to perform key exchange etc. We wanted to show the client the security aspects and reduce the hassle of setting up things with our marketing guys.

Finally i exported the key pair and imported the same where ever i wanted though Ramsus approach is the right way of doing it.

+1  A: 

The right way to do this, is to generate the keypair on machine-2, export the public key only, transport this to machine-1 and use it to wrap the session key.

How did you export and import the PKCS#12-file? Windows will usually add the key container name as a proprietary extension inside the PKCS#12-file, so it should have been transported together with the rest of the key pair.

Rasmus Faber
Keep the private key on one machine only. If you are going to export the private key then use symmetric encryption
Patrick
@Ramsus - I used the KeyPal utility to export the existing exchange key pair to a PKCS#12 file. But when i reimported the pfx file, the key container name has gone. The key pair values remain the same. This si the reason why i asked about how i can change the container name?@Patrick - I did this to demonstrate the functionality and architecture that's this dirty way.
Raj