Pkcs10Csr { public Optional<Boolean> getBasicConstraints() { return getExtensions() .map(BasicConstraints::fromExtensions) .map(BasicConstraints::isCA); } Pkcs10Csr(PKCS10CertificationRequest csr); X500Principal getSubject(); List<SubjectAlternativeName> getSubjectAlternativeNames(); Optional<Boolean> getBasicConstraints(); List<String> getExtensionOIds(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void can_read_basic_constraints() { X500Principal subject = new X500Principal("CN=subject"); KeyPair keypair = KeyUtils.generateKeypair(KeyAlgorithm.EC, 256); Pkcs10Csr csr = Pkcs10CsrBuilder.fromKeypair(subject, keypair, SignatureAlgorithm.SHA512_WITH_ECDSA) .setBasicConstraints(true, true) .build(); assertTrue(csr.getBasicConstraints().isPresent()); assertTrue(csr.getBasicConstraints().get()); }