Code example for X509Certificate

Methods: getEncodedgetSerialNumber

0
    } 
 
    static IssuerAndSerialNumber getIssuerAndSerialNumber(X509Certificate cert)
        throws CertificateEncodingException 
    { 
        Certificate certStruct = Certificate.getInstance(cert.getEncoded());
 
        return new IssuerAndSerialNumber(certStruct.getIssuer(), cert.getSerialNumber());
    } 
 
 
    static byte[] getSubjectKeyId(X509Certificate cert)
    { 
        byte[] ext = cert.getExtensionValue(X509Extension.subjectKeyIdentifier.getId());
 
        if (ext != null)
        { 
            return ASN1OctetString.getInstance(ASN1OctetString.getInstance(ext).getOctets()).getOctets();
        } 
        else 
        {