Certificate[] cachain = (Certificate[])signSession.getCertificateChain(administrator, caid).toArray(new Certificate[0]);
// Verify CA-certificate
Certificate rootcert = cachain[cachain.length - 1];
if (CertTools.isSelfSigned(rootcert)) {
try {
rootcert.verify(rootcert.getPublicKey());
} catch (GeneralSecurityException se) {
throw new Exception("RootCA certificate does not verify, issuerDN: "+CertTools.getIssuerDN(rootcert)+", subjectDN: "+CertTools.getSubjectDN(rootcert));
}
} else {
throw new Exception("RootCA certificate not self-signed, issuerDN: "+CertTools.getIssuerDN(rootcert)+", subjectDN: "+CertTools.getSubjectDN(rootcert));