GeneralName          genName = new GeneralName(PrincipalUtil.getSubjectX509Principal(certificate));
GeneralName          genName = new GeneralName(PrincipalUtil.getIssuerX509Principal(certificate));
    private static ASN1Sequence fromCertificate(        X509Certificate certificate)        throws CertificateParsingException    {        try        {            if (certificate.getVersion() != 3)            {                GeneralName          genName = new GeneralName(PrincipalUtil.getSubjectX509Principal(certificate));                SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(                        (ASN1Sequence)new ASN1InputStream(certificate.getPublicKey().getEncoded()).readObject());                                return (ASN1Sequence)new AuthorityKeyIdentifier(                               info, new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();            }            else            {                GeneralName             genName = new GeneralName(PrincipalUtil.getSubjectX509Principal(certificate));                                byte[]                  ext = certificate.getExtensionValue(X509Extensions.SubjectKeyIdentifier.getId());                                if (ext != null)                {                    ASN1OctetString     str = (ASN1OctetString)X509ExtensionUtil.fromExtensionValue(ext);                                    return (ASN1Sequence)new AuthorityKeyIdentifier(                                    str.getOctets(), new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();                }                else                {                    SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(                            (ASN1Sequence)new ASN1InputStream(certificate.getPublicKey().getEncoded()).readObject());                                        return (ASN1Sequence)new AuthorityKeyIdentifier(                            info, new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();                }            }        }        catch (Exception e)        {            throw new CertificateParsingException("Exception extracting certificate details: " + e.toString());        }    }