tls_inspector 0.0.2 copy "tls_inspector: ^0.0.2" to clipboard
tls_inspector: ^0.0.2 copied to clipboard

Inspect a server's TLS certificate: issuer, validity dates, days until expiry, subject alternative names, SHA-1 fingerprint, and trust status.

example/main.dart

import 'package:tls_inspector/tls_inspector.dart';

/// Prints the certificate of each host given on the command line:
///
///     dart run example/main.dart seungpyo.online expired.badssl.com
Future<void> main(List<String> args) async {
  final hosts = args.isEmpty ? ['seungpyo.online', 'expired.badssl.com'] : args;
  for (final host in hosts) {
    try {
      final certificate = await inspectTls(host);
      print('$host: ${certificate.trusted ? 'trusted' : 'NOT trusted'}');
      print('  subject: ${certificate.subject}');
      print('  issuer:  ${certificate.issuer}');
      print(
        '  expires: ${certificate.notAfter.toIso8601String()}'
        ' (${certificate.daysUntilExpiry()} days)',
      );
      print('  names:   ${certificate.subjectAltNames.join(', ')}');
      print('  covers $host: ${certificate.coversHost(host)}');
      print('  sha1:    ${certificate.sha1Fingerprint}');
    } on TlsInspectException catch (error) {
      print('$host: ${error.code}: $error');
    }
  }
}
0
likes
160
points
79
downloads

Documentation

API reference

Publisher

verified publisherseungpyo.online

Weekly Downloads

Inspect a server's TLS certificate: issuer, validity dates, days until expiry, subject alternative names, SHA-1 fingerprint, and trust status.

Homepage
Repository (GitHub)
View/report issues

Topics

#tls #ssl #certificate #security #networking

License

MIT (license)

More

Packages that depend on tls_inspector