Java 类org.bouncycastle.asn1.x509.qualified.QCStatement 实例源码

项目:irma_future_id    文件:QCStatementUnitTest.java   
private void checkConstruction(
     QCStatement mv,
     DERObjectIdentifier statementId,
     ASN1Encodable statementInfo) 
     throws IOException
{
    checkStatement(mv, statementId, statementInfo);

    mv = QCStatement.getInstance(mv);

    checkStatement(mv, statementId, statementInfo);

    ASN1InputStream aIn = new ASN1InputStream(mv.toASN1Object().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    mv = QCStatement.getInstance(seq);

    checkStatement(mv, statementId, statementInfo);
}
项目:irma_future_id    文件:QCStatementUnitTest.java   
private void checkStatement(
    QCStatement         qcs,
    DERObjectIdentifier statementId,
    ASN1Encodable       statementInfo)
    throws IOException
{
    if (!qcs.getStatementId().equals(statementId))
    {
        fail("statementIds don't match.");
    }

    if (statementInfo != null)
    {
        if (!qcs.getStatementInfo().equals(statementInfo))
        {
            fail("statementInfos don't match.");
        }
    }
    else if (qcs.getStatementInfo() != null)
    {
        fail("statementInfo found when none expected.");
    }
}
项目:bc-java    文件:QCStatementUnitTest.java   
private void checkConstruction(
     QCStatement mv,
     DERObjectIdentifier statementId,
     ASN1Encodable statementInfo) 
     throws IOException
{
    checkStatement(mv, statementId, statementInfo);

    mv = QCStatement.getInstance(mv);

    checkStatement(mv, statementId, statementInfo);

    ASN1InputStream aIn = new ASN1InputStream(mv.toASN1Object().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    mv = QCStatement.getInstance(seq);

    checkStatement(mv, statementId, statementInfo);
}
项目:bc-java    文件:QCStatementUnitTest.java   
private void checkStatement(
    QCStatement         qcs,
    DERObjectIdentifier statementId,
    ASN1Encodable       statementInfo)
    throws IOException
{
    if (!qcs.getStatementId().equals(statementId))
    {
        fail("statementIds don't match.");
    }

    if (statementInfo != null)
    {
        if (!qcs.getStatementInfo().equals(statementInfo))
        {
            fail("statementInfos don't match.");
        }
    }
    else if (qcs.getStatementInfo() != null)
    {
        fail("statementInfo found when none expected.");
    }
}
项目:dss    文件:DSSASN1Utils.java   
/**
 * Get the list of all QCStatement Ids that are present in the certificate.
 * (As per ETSI EN 319 412-5 V2.1.1)
 * 
 * @param x509Certificate
 * @return
 */
public static List<String> getQCStatementsIdList(final CertificateToken certToken) {
    final List<String> extensionIdList = new ArrayList<String>();
    final byte[] qcStatement = certToken.getCertificate().getExtensionValue(Extension.qCStatements.getId());
    if (qcStatement != null) {
        final ASN1Sequence seq = getAsn1SequenceFromDerOctetString(qcStatement);
        // Sequence of QCStatement
        for (int ii = 0; ii < seq.size(); ii++) {
            final QCStatement statement = QCStatement.getInstance(seq.getObjectAt(ii));
            extensionIdList.add(statement.getStatementId().getId());
        }
    }
    return extensionIdList;
}
项目:dss    文件:DSSASN1Utils.java   
/**
 * Get the list of all QCType Ids that are present in the certificate.
 * (As per ETSI EN 319 412-5 V2.1.1)
 * 
 * @param certToken
 * @return
 */
public static List<String> getQCTypesIdList(final CertificateToken certToken) {
    final List<String> qcTypesIdList = new ArrayList<String>();
    final byte[] qcStatement = certToken.getCertificate().getExtensionValue(Extension.qCStatements.getId());
    if (qcStatement != null) {
        final ASN1Sequence seq = getAsn1SequenceFromDerOctetString(qcStatement);
        // Sequence of QCStatement
        for (int ii = 0; ii < seq.size(); ii++) {
            final QCStatement statement = QCStatement.getInstance(seq.getObjectAt(ii));
            if (QC_TYPE_STATEMENT_OID.equals(statement.getStatementId().getId())) {
                final ASN1Encodable qcTypeInfo1 = statement.getStatementInfo();
                if (qcTypeInfo1 instanceof ASN1Sequence) {
                    final ASN1Sequence qcTypeInfo = (ASN1Sequence) qcTypeInfo1;
                    for (int jj = 0; jj < qcTypeInfo.size(); jj++) {
                        final ASN1Encodable e1 = qcTypeInfo.getObjectAt(jj);
                        if (e1 instanceof ASN1ObjectIdentifier) {
                            final ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e1;
                            qcTypesIdList.add(oid.getId());
                        } else {
                            throw new IllegalStateException("ASN1Sequence in QcTypes does not contain ASN1ObjectIdentifer, but " + e1.getClass().getName());
                        }
                    }
                } else {
                    throw new IllegalStateException("QcTypes not an ASN1Sequence, but " + qcTypeInfo1.getClass().getName());
                }
            }
        }
    }

    return qcTypesIdList;
}
项目:jtrust    文件:QCStatementsCertificateConstraint.java   
@Override
public void check(X509Certificate certificate) throws TrustLinkerResultException, Exception {
    byte[] extensionValue = certificate.getExtensionValue(Extension.qCStatements.getId());
    if (null == extensionValue) {
        throw new TrustLinkerResultException(TrustLinkerResultReason.CONSTRAINT_VIOLATION,
                "missing QCStatements extension");
    }
    DEROctetString oct = (DEROctetString) (new ASN1InputStream(new ByteArrayInputStream(extensionValue))
            .readObject());
    ASN1Sequence qcStatements = (ASN1Sequence) new ASN1InputStream(oct.getOctets()).readObject();
    Enumeration<?> qcStatementEnum = qcStatements.getObjects();
    boolean qcCompliance = false;
    boolean qcSSCD = false;
    while (qcStatementEnum.hasMoreElements()) {
        QCStatement qcStatement = QCStatement.getInstance(qcStatementEnum.nextElement());
        ASN1ObjectIdentifier statementId = qcStatement.getStatementId();
        LOG.debug("statement Id: " + statementId.getId());
        if (QCStatement.id_etsi_qcs_QcCompliance.equals(statementId)) {
            qcCompliance = true;
        }
        if (QCStatement.id_etsi_qcs_QcSSCD.equals(statementId)) {
            qcSSCD = true;
        }
    }

    if (null != this.qcComplianceFilter) {
        if (qcCompliance != this.qcComplianceFilter) {
            LOG.error("qcCompliance QCStatements error");
            throw new TrustLinkerResultException(TrustLinkerResultReason.CONSTRAINT_VIOLATION,
                    "QCStatements not matching");
        }
    }

    if (null != this.qcSSCDFilter) {
        if (qcSSCD != this.qcSSCDFilter) {
            LOG.error("qcSSCD QCStatements error");
            throw new TrustLinkerResultException(TrustLinkerResultReason.CONSTRAINT_VIOLATION,
                    "QCStatements not matching");
        }
    }
}
项目:xipki    文件:QcStatementOption.java   
public QcStatementOption(QCStatement statement) {
    this.statement = ParamUtil.requireNonNull("statement", statement);
    this.statementId = null;
    this.monetaryValueOption = null;
}
项目:xipki    文件:QcStatementOption.java   
public QCStatement statement() {
    return statement;
}