return new X509CertificateObject( X509CertificateStructure.getInstance( sData.getCertificates().getObjectAt(sDataObjectCount++)));
return getCertificate();
    public Certificate engineGenerateCertificate(        InputStream in)         throws CertificateException    {        if (currentStream == null)        {            currentStream = in;            sData = null;            sDataObjectCount = 0;        }        else if (currentStream != in)        {            currentStream = in;            sData = null;            sDataObjectCount = 0;        }        try        {            if (sData != null)            {                if (sDataObjectCount != sData.getCertificates().size())                {                    return new X509CertificateObject(                                X509CertificateStructure.getInstance(                                        sData.getCertificates().getObjectAt(sDataObjectCount++)));                }                else                {                    sData = null;                    sDataObjectCount = 0;                    return null;                }            }                        if (!in.markSupported())            {                in = new BufferedInputStream(in);            }            in.mark(10);            int    tag = in.read();                        if (tag == -1)            {                return null;            }                        if (tag != 0x30)  // assume ascii PEM encoded.            {                in.reset();                return readPEMCertificate(in);            }            else if (in.read() == 0x80)    // assume BER encoded.            {                in.reset();                return readPKCS7Certificate(in);            }            else            {                in.reset();                return readDERCertificate(in);            }        }        catch (Exception e)        {            throw new CertificateException(e.toString());        }    }