country property

String? get country

Returns the Country (C) extracted from the certificate's subject Distinguished Name, or null if no Country is present.

Example: For a subject of CN=Example Root CA, O=Example Org, C=US, this returns US.

Implementation

String? get country {
  final match = RegExp(r'C=([^,]+)').firstMatch(_subject);
  return match?.group(1)?.trim();
}