Example usage for org.bouncycastle.asn1 ASN1Boolean FALSE

List of usage examples for org.bouncycastle.asn1 ASN1Boolean FALSE

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 ASN1Boolean FALSE.

Prototype

ASN1Boolean FALSE

To view the source code for org.bouncycastle.asn1 ASN1Boolean FALSE.

Click Source Link

Usage

From source file:org.cesecore.certificates.certificate.certextensions.BasicCertificateExtension.java

License:Open Source License

private ASN1Encodable parseDERBoolean(String value) throws CertificateExtensionException {
    ASN1Encodable retval = null;/*ww w  .j  a  v  a2s  .  c  o  m*/
    if (value.equalsIgnoreCase("TRUE")) {
        retval = ASN1Boolean.TRUE;
    }

    if (value.equalsIgnoreCase("FALSE")) {
        retval = ASN1Boolean.FALSE;
    }

    if (retval == null) {
        throw new CertificateExtensionException(intres.getLocalizedMessage("certext.basic.illegalvalue", value,
                Integer.valueOf(getId()), getOID()));
    }

    return retval;
}

From source file:org.signserver.module.tsa.TimeStampSignerTest.java

License:Open Source License

/**
 * Test that the ordering field is included when ORDERING == false and INCLUDEORDERING == true.
 * //  w  ww .java2 s.  c o m
 * @throws Exception
 */
@Test
public void test41IncludeOrderingOrderingFalse() throws Exception {
    // reset ORDERING property
    workerSession.setWorkerProperty(WORKER1, TimeStampSigner.ORDERING, "false");
    workerSession.setWorkerProperty(WORKER1, TimeStampSigner.INCLUDEORDERING, "true");
    workerSession.reloadConfiguration(WORKER1);

    final byte[] res = getResponseData(WORKER1);
    final ASN1Sequence seq = extractTstInfoSeq(res);
    final ASN1Encodable o = seq.getObjectAt(5);

    try {
        final ASN1Boolean b = ASN1Boolean.getInstance(o);
        assertEquals("Ordering should be set to false", ASN1Boolean.FALSE, b);
    } catch (IllegalArgumentException e) {
        fail("Ordering should be included");
    } catch (Exception e) {
        fail("Unexpected exception");
    } finally {
        workerSession.removeWorkerProperty(WORKER1, TimeStampSigner.ORDERING);
        workerSession.removeWorkerProperty(WORKER1, TimeStampSigner.INCLUDEORDERING);
        workerSession.reloadConfiguration(WORKER1);
    }
}