getFingerprintByFile method

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

Implementation

@override
Future<String> getFingerprintByFile(String filepath) async {
  final p = await Process.run('bash', [
    '-c',
    'openssl x509 -noout -fingerprint -sha256 -inform pem -in $filepath',
  ]);
  String fingerprint = '';
  if (p.exitCode == 0) {
    fingerprint = p.stdout
        .toString()
        .replaceAll('sha256 Fingerprint=', '')
        .replaceAll(':', '')
        .toLowerCase();
  }
  return fingerprint.replaceAll('\n', '');
}