getExpiredByFile method

  1. @override
Future<String> getExpiredByFile(
  1. String filepath
)
override

Implementation

@override
Future<String> getExpiredByFile(String filepath) async {
  final p = await Process.run('bash', [
    '-c',
    'openssl x509 -enddate -noout -in $filepath',
  ]);
  String notAfterStr = '';
  if (p.exitCode == 0) {
    notAfterStr = p.stdout.toString();
    if (notAfterStr.startsWith('notAfter=')) {
      notAfterStr = notAfterStr.substring('notAfter='.length);
    }
  }
  return notAfterStr.replaceAll('\n', '');
}