On Jun 22, 10:11 am, Yevgeniy Gubenko
<[EMAIL PROTECTED]> wrote:
> Hello,
> I need to create 2 public private key pairs: one on windows machine in JKS 
> format (by keytool command) and the other on Solaris 10 machine in NSS 
> database (certutil -G), on which NSS db exists.
> Then I have to
> 1.export public key from Solaris to Windows in JKS format
> 2.import public key from Windows to Solaris into NSS database
> The question is: how should I implement the above 2 steps?
> Thanks in advance
> Yevgeniy
>
> ________________________________
> This email and any files transmitted with it are confidential material. They 
> are intended solely for the use of the designated individual or entity to 
> whom they are addressed. If the reader of this message is not the intended 
> recipient, you are hereby notified that any dissemination, use, distribution 
> or copying of this communication is strictly prohibited and may be unlawful.
>
> If you have received this email in error please immediately notify the sender 
> and delete or destroy any copy of this message

This may be the oposite of what you need however:

Java will allow you to get the private key in a JKS and write it out a
PKCS8 key to a file (Base64) like this:

                KeyStore keystore = KeyStore.getInstance(keyStoreType);
                BASE64Encoder encoder = new BASE64Encoder();
                keystore.load(new FileInputStream(keystoreFile), password);
                KeyPair keyPair = getPrivateKey(keystore, alias, password);
                PrivateKey privateKey = keyPair.getPrivate();
                System.out.println("Base64 encoding private key");
                String encoded = encoder.encode(privateKey.getEncoded());
                FileWriter fw = new FileWriter(exportedFile);
                fw.write("-----BEGIN PRIVATE KEY-----\n");
                fw.write(encoded);
                fw.write("\n");
                fw.write("-----END PRIVATE KEY-----");
                fw.close();

I'm not sure how to export private keys from NSS

Thanks,
Gordon~
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to