95 Date result = null;
96
97 List<String> args = new ArrayList<>();
98 args.add("/usr/bin/openssl");
99 args.add("x509");
100 args.add("-noout");
101 args.add("-enddate");
102 args.add("-in");
103 args.add(filename);
104
105 try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
106 PrintStream ps = new PrintStream(baos)) {
107 ProcessBuilder security = new ProcessBuilder(args);
108 IOUtils.exec(security, false, ps);
109 String output = baos.toString();
110 output = output.substring(output.indexOf("=") + 1);
111 DateFormat df = new SimpleDateFormat(
112 "MMM dd kk:mm:ss yyyy z", Locale.ENGLISH);
113 result = df.parse(output);
114 } catch (IOException | ParseException ex) {
115 Log.debug(ex);
116 }
117
118 return result;
119 }
120
121 private static boolean verifyCertificate(
122 String certificate, boolean verbose) {
123 boolean result = false;
124
125 try {
126 File file = null;
127 Date certificateDate = null;
128
129 try {
130 file = findCertificate(certificate, verbose);
131
132 if (file != null) {
133 certificateDate = findCertificateDate(
134 file.getCanonicalPath(), verbose);
135 }
|
95 Date result = null;
96
97 List<String> args = new ArrayList<>();
98 args.add("/usr/bin/openssl");
99 args.add("x509");
100 args.add("-noout");
101 args.add("-enddate");
102 args.add("-in");
103 args.add(filename);
104
105 try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
106 PrintStream ps = new PrintStream(baos)) {
107 ProcessBuilder security = new ProcessBuilder(args);
108 IOUtils.exec(security, false, ps);
109 String output = baos.toString();
110 output = output.substring(output.indexOf("=") + 1);
111 DateFormat df = new SimpleDateFormat(
112 "MMM dd kk:mm:ss yyyy z", Locale.ENGLISH);
113 result = df.parse(output);
114 } catch (IOException | ParseException ex) {
115 Log.verbose(ex);
116 }
117
118 return result;
119 }
120
121 private static boolean verifyCertificate(
122 String certificate, boolean verbose) {
123 boolean result = false;
124
125 try {
126 File file = null;
127 Date certificateDate = null;
128
129 try {
130 file = findCertificate(certificate, verbose);
131
132 if (file != null) {
133 certificateDate = findCertificateDate(
134 file.getCanonicalPath(), verbose);
135 }
|