final ByteArrayInputStream in =
new ByteArrayInputStream(pubkey.getEncoded());
final SubjectPublicKeyInfo spki =
new SubjectPublicKeyInfo(
(ASN1Sequence)new DERInputStream(in).readObject());
final SubjectKeyIdentifier ski = new SubjectKeyIdentifier(spki);
final ByteArrayInputStream in2 =
new ByteArrayInputStream(newprincipal.getEncoded());
final GeneralNames generalNames = new GeneralNames(
(ASN1Sequence)new DERInputStream(in2).readObject());
final AuthorityKeyIdentifier aki =
new AuthorityKeyIdentifier(spki, generalNames, BigInteger.ZERO);
this.certGen.addExtension(X509Extensions.BasicConstraints,