Code example for KeyStore

Methods: setCertificateEntry, store

0
			 
			if (cert instanceof X509CertificateEx)
				ks.setKeyEntry(alias, ((X509CertificateEx)cert).getPrivateKey(),
						privateKeyPassword == null ? null : privateKeyPassword.toCharArray(), new Certificate[] {cert});
			else 
				ks.setCertificateEntry(alias, cert);
			 
			// persist 
			FileOutputStream outStream = new FileOutputStream(keyStoreFile);
			ks.store(outStream, keyStorePassword == null ? null : keyStorePassword.toCharArray());	
			outStream.close();
		} 
		catch (Throwable e)
		{ 
			throw new NHINDException(e);
		}     		 
    } 
     
    /** 
     * Updates/replaces a certificate into the keystore with a given alias name. 
     * @param cert The certificate to update in the keystore.