Am 13.11.2019 um 22:11 schrieb Predrag Stojković:
protected static String getCrlUrlFromExtensionValue(byte[] extensionValue) 
throws IOException

Please use this (this one doesn't abort) instead and retry. I will work on this 
topic again tonight, hopefully.


    protected static String getCrlUrlFromExtensionValue(byte[] extensionValue) 
throws IOException
    {
        ASN1Sequence asn1Seq = (ASN1Sequence) 
JcaX509ExtensionUtils.parseExtensionValue(extensionValue);
        Enumeration<?> objects = asn1Seq.getObjects();

        while (objects.hasMoreElements())
        {
            DLSequence obj = (DLSequence) objects.nextElement();

            ASN1TaggedObject taggedObject = (ASN1TaggedObject) 
obj.getObjectAt(0);
            taggedObject = (ASN1TaggedObject) taggedObject.getObject();
            if (taggedObject.getObject() instanceof ASN1TaggedObject)
            {
                taggedObject = (ASN1TaggedObject) taggedObject.getObject();
            }
            else if (taggedObject.getObject() instanceof ASN1Sequence)
            {
                // multiple URLs (we take the first)
                ASN1Sequence seq = (ASN1Sequence) taggedObject.getObject();
                taggedObject = (ASN1TaggedObject) seq.getObjectAt(0);
            }
            else
            {
                continue;
            }
            if (!(taggedObject.getObject() instanceof ASN1OctetString))
            {
                // happens with 
http://blogs.adobe.com/security/SampleSignedPDFDocument.pdf
                continue;
            }
            ASN1OctetString uri = (ASN1OctetString) taggedObject.getObject();
            String url = new String(uri.getOctets());

            // return first http(s)-Url for crl
            if (url.startsWith("http"))
            {
                return url;
            }
        }
        return null;
    }


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to