Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // open the file
  2. fileName = "my_output.p12";
  3. OutputStream outFile = new FileOutputStream (fileName);
  4.  
  5. // get privatekey and cert details ...
  6. // ...
  7.  
  8. // initialize
  9. // note: I have also tried: KeyStore.getInstance("PKCS12", "BC");
  10. KeyStore keyStore = KeyStore.getInstance("PKCS12");
  11. keyStore.load(null, null);
  12.  
  13. // this line doesn't add my password "test_pass" !
  14. keyStore.setKeyEntry("test_alias", myExistingPrivateKey, "key_pass".toCharArray(), myExistingCertChain);
  15.  
  16.  
  17. // store keystore and close file
  18. keyStore.store(outFile, "container_pass".toCharArray());
  19. outFile.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement