Example usage for org.bouncycastle.asn1.x509 X509Extension qCStatements

List of usage examples for org.bouncycastle.asn1.x509 X509Extension qCStatements

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 X509Extension qCStatements.

Prototype

ASN1ObjectIdentifier qCStatements

To view the source code for org.bouncycastle.asn1.x509 X509Extension qCStatements.

Click Source Link

Document

QCStatements

Usage

From source file:eu.europa.ec.markt.dss.DSSUtils.java

License:Open Source License

public static List<String> getQCStatementsIdList(final X509Certificate x509Certificate) {

    final List<String> extensionIdList = new ArrayList<String>();
    final byte[] qcStatement = x509Certificate.getExtensionValue(X509Extension.qCStatements.getId());
    if (qcStatement != null) {

        ASN1InputStream input = null;
        try {//from  w  w w . j  ava 2s.  c o m

            input = new ASN1InputStream(qcStatement);
            final DEROctetString s = (DEROctetString) input.readObject();
            final byte[] content = s.getOctets();
            input.close();
            input = new ASN1InputStream(content);
            final ASN1Sequence seq = (ASN1Sequence) input.readObject();
            /* Sequence of QCStatement */
            for (int ii = 0; ii < seq.size(); ii++) {

                final QCStatement statement = QCStatement.getInstance(seq.getObjectAt(ii));
                extensionIdList.add(statement.getStatementId().getId());
            }
        } catch (IOException e) {

            throw new DSSException(e);
        } finally {

            DSSUtils.closeQuietly(input);
        }
    }
    return extensionIdList;
}