assertEquals(1, cachain.size());
Certificate cert1 = (Certificate) cachain.iterator().next();
CardVerifiableCertificate cvcert1 = (CardVerifiableCertificate) cert1;
assertEquals("SETESTCVCA00001", cvcert1.getCVCertificate().getCertificateBody().getHolderReference().getConcatenated());
byte[] request = caAdminSession.makeRequest(admin, cvcainfo.getCAId(), cachain, false, false, false, null);
CVCObject obj = CertificateParser.parseCVCObject(request);
// We should have created an authenticated request signed by the default
// key, we intended to have it signed by the old key,
// but since the CVCA is not renewed, and no old key exists, it will be
// the "defaultKey", but we won't know the difference in this test.
CVCAuthenticatedRequest authreq = (CVCAuthenticatedRequest) obj;
CVCertificate reqcert = authreq.getRequest();
assertEquals("SETESTCVCA00001", reqcert.getCertificateBody().getHolderReference().getConcatenated());
assertEquals("SETESTCVCA00001", reqcert.getCertificateBody().getAuthorityReference().getConcatenated());
// Make a certificate request from a DV, regenerating keys
cachain = dvdcainfo.getCertificateChain();
request = caAdminSession.makeRequest(admin, dvdcainfo.getCAId(), cachain, true, false, true, "foo123");
obj = CertificateParser.parseCVCObject(request);
// We should have created an authenticated request signed by the old
// certificate
authreq = (CVCAuthenticatedRequest) obj;
reqcert = authreq.getRequest();
assertEquals("SETESTDV-D00002", reqcert.getCertificateBody().getHolderReference().getConcatenated());
// This request is made from the DV targeted for the DV, so the old DV
// certificate will be the holder ref.
// Normally you would target an external CA, and thus send in it's
// cachain. The caRef would be the external CAs holderRef.
assertEquals("SETESTDV-D00001", reqcert.getCertificateBody().getAuthorityReference().getConcatenated());
// Get the DVs certificate request signed by the CVCA
byte[] authrequest = caAdminSession.signRequest(admin, cvcainfo.getCAId(), request, false, false);
CVCObject parsedObject = CertificateParser.parseCVCObject(authrequest);
authreq = (CVCAuthenticatedRequest) parsedObject;
assertEquals("SETESTDV-D00002", authreq.getRequest().getCertificateBody().getHolderReference().getConcatenated());
assertEquals("SETESTDV-D00001", authreq.getRequest().getCertificateBody().getAuthorityReference().getConcatenated());
assertEquals("SETESTCVCA00001", authreq.getAuthorityReference().getConcatenated());