Code example for KeyStore

Methods: setCertificateEntry

0
		CertificateFactory cf;
		try { 
			cf = CertificateFactory.getInstance("X.509");
			X509Certificate cert =
					(X509Certificate)cf.generateCertificate(inputStream);
			keystore_trusted.setCertificateEntry(provider, cert);
		} catch (CertificateException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} catch (KeyStoreException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
	} 
 
	/** 
	 * Adds a new X509 certificate given in its string from and using its provider name 
	 * @param provider used to store the certificate in the keystore 
	 * @param certificate 
	 */ 
	public static void addTrustedCertificate(String provider, String certificate) {