![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e209. Retrieving a Certificate from a Key Storetry { // Load the keystore in the user's home directory FileInputStream is = new FileInputStream(System.getProperty("user.home") + File.separatorChar + ".keystore"); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(is, "my-keystore-password".toCharArray()); // Get certificate java.security.cert.Certificate cert = keystore.getCertificate("myalias"); } catch (KeyStoreException e) { } catch (java.security.cert.CertificateException e) { } catch (NoSuchAlgorithmException e) { } catch (java.io.IOException e) { }
e210. Retrieving a Key Pair from a Key Store e211. Adding a Certificate to a Key Store
© 2002 Addison-Wesley. |