ProxyCA { public byte[] getChildTrustStore(String password) throws GeneralSecurityException, IOException { return keyStoreToBytes(childTrustStore, password); } ProxyCA(); void init(); void init(X509Certificate caCert, PrivateKey caPrivateKey); byte[] createChildKeyStore(ApplicationId appId, String ksPassword); byte[] getChildTrustStore(String password); String generateKeyStorePassword(); SSLContext createSSLContext(ApplicationId appId); HostnameVerifier getHostnameVerifier(); @VisibleForTesting X509Certificate getCaCert(); @VisibleForTesting KeyPair getCaKeyPair();  }
@Test public void testGetChildTrustStore() throws Exception { ProxyCA proxyCA = new ProxyCA(); proxyCA.init(); byte[] truststoreBytes = proxyCA.getChildTrustStore("password"); KeyStore truststore = KeyStoreTestUtil.bytesToKeyStore(truststoreBytes, "password"); Assert.assertEquals(1, truststore.size()); X509Certificate caCert = (X509Certificate) truststore.getCertificate("client"); checkCACert(caCert); Assert.assertEquals(proxyCA.getCaCert(), caCert); PublicKey caPublicKey = caCert.getPublicKey(); caCert.verify(caPublicKey); PrivateKey caPrivateKey = proxyCA.getX509KeyManager().getPrivateKey(null); checkPrivatePublicKeys(caPrivateKey, caPublicKey); Assert.assertEquals(proxyCA.getCaKeyPair().getPublic(), caPublicKey); Assert.assertEquals(proxyCA.getCaKeyPair().getPrivate(), caPrivateKey); }