getFingerprintByDomain method

  1. @override
Future<String> getFingerprintByDomain(
  1. String domain
)
override

Implementation

@override
Future<String> getFingerprintByDomain(String domain) async {
  final p = await Process.run('bash', [
    '-c',
    'openssl s_client -servername $domain -connect $domain:443 < /dev/null 2>/dev/null | openssl x509 -noout -fingerprint -sha256'
  ]);
  String fingerprint = '';
  if (p.exitCode == 0) {
    fingerprint = p.stdout
        .toString()
        .replaceAll('sha256 Fingerprint=', '')
        .replaceAll(':', '')
        .toLowerCase();
  }
  return fingerprint.replaceAll('\n', '');
}