@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");
  // check CA cert
  checkCACert(caCert);
  Assert.assertEquals(proxyCA.getCaCert(), caCert);
  // verify signature on CA cert
  PublicKey caPublicKey = caCert.getPublicKey();
  caCert.verify(caPublicKey);
  // verify CA public key matches private key
  PrivateKey caPrivateKey =
      proxyCA.getX509KeyManager().getPrivateKey(null);
  checkPrivatePublicKeys(caPrivateKey, caPublicKey);
  Assert.assertEquals(proxyCA.getCaKeyPair().getPublic(), caPublicKey);
  Assert.assertEquals(proxyCA.getCaKeyPair().getPrivate(), caPrivateKey);
}