@Test
public void testTrustStore() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {

    File caPem = getTempFile("ca/cert.pem");
    KeyStore keystore = createKeyStore();
    KeyStoreUtil.updateWithCaPem(keystore, caPem);
    List<String> aliases = asList(keystore.aliases());
    assertEquals(aliases.size(), 1);
    String alias = aliases.get(0);
    assertTrue(alias.contains("ca.test.jolokia.org"));
    X509Certificate cert = (X509Certificate) keystore.getCertificate(alias);
    assertTrue(cert.getSubjectDN().getName().contains(CA_CERT_SUBJECT_DN_CN));
    RSAPublicKey key = (RSAPublicKey) cert.getPublicKey();
    assertEquals(key.getAlgorithm(),"RSA");
}