code: synchronized KeyAndCertificateFactory buildAndSaveCertificateAuthorityCertificates() throws Exception {
          KeyPair caKeyPair = generateKeyPair(ROOT_KEYSIZE);
  
          saveCertificateAsPEMFile(createCACert(caKeyPair.getPublic(), caKeyPair.getPrivate()), "CertificateAuthorityCertificate.pem", false);
          saveCertificateAsPEMFile(caKeyPair.getPublic(), "CertificateAuthorityPublicKey.pem", false);
          saveCertificateAsPEMFile(caKeyPair.getPrivate(), "CertificateAuthorityPrivateKey.pem", false);
  
          return this;
      }
docs: Regenerate Certificate Authority public/private keys and X.509 certificate
  <p>
  Note: X.509 certificate should be stable so this method should rarely be used