int keySize = 2048;
String algorithm = "rsa";
KeyPair keyPair = KeyPairs.generateKeyPair(algorithm, keySize);
Csr csr = helper.buildCsr(keyPair, subject);
List<X509Certificate> certChain = helper.selfSign(csr, keyPair);
StringBuilder sb = new StringBuilder();
for (X509Certificate cert : certChain) {