> I don't think that will work because you can't read the key out of the > keystore.
The keystore API has the getKey(alias,keypass) method that should give you the key. copying the entry could be: KeyStore newks = KeyStore.getInstance("JKS"); newks.load(null, null); newks.setKeyEntry(alias, ks.getKey(alias, keypass), keypass, ks.getCertificateChain(alias)); hth, Frank