List of usage examples for org.bouncycastle.asn1 ASN1Boolean TRUE
ASN1Boolean TRUE
To view the source code for org.bouncycastle.asn1 ASN1Boolean TRUE.
Click Source Link
From source file:org.cesecore.certificates.certificate.certextensions.BasicCertificateExtension.java
License:Open Source License
private ASN1Encodable parseDERBoolean(String value) throws CertificateExtensionException { ASN1Encodable retval = null;/*from w w w . j ava 2 s .co 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 setting ordering to "true" results in a correct tstInfo sequence. * //from w w w . ja va 2 s. c o m * @throws Exception */ @Test public void test39orderingTrue() throws Exception { // reset ORDERING property workerSession.setWorkerProperty(WORKER1, TimeStampSigner.ORDERING, "true"); workerSession.reloadConfiguration(WORKER1); final byte[] res = getResponseData(WORKER1); final ASN1Sequence seq = extractTstInfoSeq(res); final ASN1Encodable o = seq.getObjectAt(5); try { // when ordering isn't included, the 6:th element in the tstInfo sequence should be the nonce final ASN1Boolean b = ASN1Boolean.getInstance(o); assertEquals("Ordering should be set to true", ASN1Boolean.TRUE, b); } catch (IllegalArgumentException e) { fail("Ordering should be included"); } catch (Exception e) { fail("Unexpected exception"); } finally { workerSession.removeWorkerProperty(WORKER1, TimeStampSigner.ORDERING); workerSession.reloadConfiguration(WORKER1); } }
From source file:org.signserver.module.tsa.TimeStampSignerTest.java
License:Open Source License
/** * Test that the ordering field is included when ORDERING == true and INCLUDEORDERING == true. * //from w w w. j av a 2s.c om * @throws Exception */ @Test public void test42IncludeOrderingOrderingTrue() throws Exception { // reset ORDERING property workerSession.setWorkerProperty(WORKER1, TimeStampSigner.ORDERING, "true"); 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 true", ASN1Boolean.TRUE, 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); } }