public void verifySignature(Certificate caCert) throws SignatureException { String[] args; if (caCert != null) { try { Certificate.loadCertificateFromBuffer(caCert.getBlob()); } catch (CertificateException e) { throw new SignatureException("Invalid certificate (" + e.getMessage() + ")"); } args = new String[] { "python", "scripts/pkcs7_verifyier.py", "-in", getContentsFilename(), "-ca", caCert.getFilename() }; } else { args = new String[] {"python", "scripts/pkcs7_verifyier.py", "-in", getContentsFilename()}; } BashReader br = BashReader.read(args); if (br == null) { throw new SignatureException("Invalid command."); } if (br.getExitValue() == 0) { return; } throw new SignatureException("The signature verification has failed."); }