SubjectPublicKeyInfo.ASN1.decode(publicKey.getEncoded());
keyEncoding = subjectPublicKeyInfo.getEncoded();
Extensions exts = new Extensions(Arrays.asList(extensions));
TBSCertificate tbsCertificate =
new TBSCertificate(version, serialNumber,
signature, issuer, validity, subject, subjectPublicKeyInfo,
issuerUniqueID, subjectUniqueID, exts);
tbsCertEncoding = tbsCertificate.getEncoded();
if (signatureValueBytes == null) {
try {
Signature sig= Signature.getInstance("DSA");//new byte[32];
sig.initSign(privateKey);