List<TokenCertificateResponseWS> responses = ejbcaraws.genTokenCertificates(tokenUser1, requests, hardTokenDataWS, true, false);
assertTrue(responses.size() == 2);
Iterator<TokenCertificateResponseWS> iter = responses.iterator();
TokenCertificateResponseWS next = iter.next();
assertTrue(next.getType() == HardTokenConstants.RESPONSETYPE_CERTIFICATE_RESPONSE);
Certificate cert = next.getCertificate();
X509Certificate realcert = (X509Certificate) CertificateHelper.getCertificate(cert.getCertificateData());
assertNotNull(realcert);
assertTrue(realcert.getNotAfter().toString(), realcert.getNotAfter().before(new Date(System.currentTimeMillis() + 2 * 24 * 3600 * 1000)));
next = iter.next();
assertTrue(next.getType() == HardTokenConstants.RESPONSETYPE_KEYSTORE_RESPONSE);
KeyStore keyStore = next.getKeyStore();
java.security.KeyStore realKeyStore = KeyStoreHelper.getKeyStore(keyStore.getKeystoreData(), HardTokenConstants.TOKENTYPE_PKCS12, "foo123");
assertTrue(realKeyStore.containsAlias("WSTESTTOKENUSER1"));
assertTrue(((X509Certificate) realKeyStore.getCertificate("WSTESTTOKENUSER1")).getNotAfter().after(
new Date(System.currentTimeMillis() + 48 * 24 * 3600 * 1000)));