@Test
public void testGetPKCS10CertRequestInvalid() throws IOException {

    // first try with empty values
    try {
        Crypto.getPKCS10CertRequest(null);
        fail();
    } catch (CryptoException ex) {
        assertTrue(ex.getMessage().contains("CSR is null"));
    }
    try {
        Crypto.getPKCS10CertRequest("");
        fail();
    } catch (CryptoException ex) {
        assertTrue(ex.getMessage().contains("CSR is null"));
    }
    // now let's try with invalid csr
    Path path = Paths.get("src/test/resources/invalid.csr");
    String certStr = new String(Files.readAllBytes(path));
    try {
        Crypto.getPKCS10CertRequest(certStr);
        fail();
    } catch (CryptoException ex) {
        assertTrue(true, "Caught expected crypto exception");
    }
}