Java 类org.bouncycastle.asn1.esf.CommitmentTypeIndication 实例源码

项目:irma_future_id    文件:CommitmentTypeIndicationUnitTest.java   
private void checkConstruction(
     CommitmentTypeIndication mv,
     DERObjectIdentifier commitmenttTypeId,
     ASN1Encodable qualifier) 
     throws IOException
{
    checkStatement(mv, commitmenttTypeId, qualifier);

    mv = CommitmentTypeIndication.getInstance(mv);

    checkStatement(mv, commitmenttTypeId, qualifier);

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

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

    mv = CommitmentTypeIndication.getInstance(seq);

    checkStatement(mv, commitmenttTypeId, qualifier);
}
项目:irma_future_id    文件:CommitmentTypeIndicationUnitTest.java   
private void checkStatement(
    CommitmentTypeIndication cti,
    DERObjectIdentifier     commitmentTypeId,
    ASN1Encodable           qualifier)
{
    if (!cti.getCommitmentTypeId().equals(commitmentTypeId))
    {
        fail("commitmentTypeIds don't match.");
    }

    if (qualifier != null)
    {
        if (!cti.getCommitmentTypeQualifier().equals(qualifier))
        {
            fail("qualifiers don't match.");
        }
    }
    else if (cti.getCommitmentTypeQualifier() != null)
    {
        fail("qualifier found when none expected.");
    }
}
项目:bc-java    文件:CommitmentTypeIndicationUnitTest.java   
private void checkConstruction(
     CommitmentTypeIndication mv,
     DERObjectIdentifier commitmenttTypeId,
     ASN1Encodable qualifier) 
     throws IOException
{
    checkStatement(mv, commitmenttTypeId, qualifier);

    mv = CommitmentTypeIndication.getInstance(mv);

    checkStatement(mv, commitmenttTypeId, qualifier);

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

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

    mv = CommitmentTypeIndication.getInstance(seq);

    checkStatement(mv, commitmenttTypeId, qualifier);
}
项目:bc-java    文件:CommitmentTypeIndicationUnitTest.java   
private void checkStatement(
    CommitmentTypeIndication cti,
    DERObjectIdentifier     commitmentTypeId,
    ASN1Encodable           qualifier)
{
    if (!cti.getCommitmentTypeId().equals(commitmentTypeId))
    {
        fail("commitmentTypeIds don't match.");
    }

    if (qualifier != null)
    {
        if (!cti.getCommitmentTypeQualifier().equals(qualifier))
        {
            fail("qualifiers don't match.");
        }
    }
    else if (cti.getCommitmentTypeQualifier() != null)
    {
        fail("qualifier found when none expected.");
    }
}
项目:dss    文件:CAdESSignature.java   
@Override
public CommitmentType getCommitmentTypeIndication() {
    final Attribute commitmentTypeIndicationAttribute = getSignedAttribute(PKCSObjectIdentifiers.id_aa_ets_commitmentType);
    if (commitmentTypeIndicationAttribute == null) {
        return null;
    }

    try {
        CommitmentType commitmentType = null;
        final ASN1Set attrValues = commitmentTypeIndicationAttribute.getAttrValues();
        final int size = attrValues.size();
        if (size > 0) {
            commitmentType = new CommitmentType();
            for (int ii = 0; ii < size; ii++) {
                if (attrValues.getObjectAt(ii) instanceof DERSequence) {
                    final DERSequence derSequence = (DERSequence) attrValues.getObjectAt(ii);
                    final CommitmentTypeIndication commitmentTypeIndication = CommitmentTypeIndication.getInstance(derSequence);
                    final ASN1ObjectIdentifier commitmentTypeId = commitmentTypeIndication.getCommitmentTypeId();
                    commitmentType.addIdentifier(commitmentTypeId.getId());
                } else {
                    LOG.warn("Unsupported type for CommitmentType : " + attrValues.getObjectAt(ii).getClass());
                }
            }
        }
        return commitmentType;
    } catch (Exception e) {
        throw new DSSException("Error when dealing with CommitmentTypeIndication!", e);
    }
}