Skip to content

Commit

Permalink
More improvement on windows distructing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
certaintls committed Jul 26, 2020
1 parent dc81a69 commit 5c33abb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
13 changes: 10 additions & 3 deletions lib/certificate_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ class CertificateDetail extends StatelessWidget {
Text(data.subject[X509Utils.DN['countryName']] ?? ''),
SizedBox(height: 10),
Text('Serial number:'),
Text(data.serialNumber?.toString() ?? ''),
Text(StringUtils.addCharAtPosition(
data.serialNumber?.toRadixString(16)?.toUpperCase() ??
'',
' ',
2,
repeat: true)),
SizedBox(height: 20),
Text('Issued by:',
style: TextStyle(fontWeight: FontWeight.bold)),
Expand Down Expand Up @@ -145,16 +150,18 @@ class CertificateDetail extends StatelessWidget {
_launchAndroidIntent();
} else {
var result = distruster.distrust(cert);
if (result.stderr.isEmpty) {
if (result.stderr.isEmpty && result.exitCode > 0) {
Navigator.pop(ctx);
} else {
showDialog(
context: ctx,
builder: (_) => AlertDialog(
title:
Text('Failed to distrust ' + getTitle(cert.data) + '!'),
content: Text('Error: ' +
content: SelectableText('Error: ' +
result.stderr +
' ' +
result.stdout +
'\n\n' +
distruster.getManualInstruction(cert)),
actions: [
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class _MyAppState extends State<MyApp> {
void _showAboutDialog(BuildContext ctx) {
showAboutDialog(
context: ctx,
applicationVersion: '1.2.0+3',
applicationVersion: '1.3.0+4',
applicationIcon: Image.asset('images/logo.png'),
children: [
Text(
Expand Down
4 changes: 2 additions & 2 deletions lib/windows_certificate_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class WindowsCertificateManager
ProcessResult distrust(X509Certificate cert) {
// Command doc: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil#-revoke
return Process.runSync(
'CertUtil', ['-revoke', cert.data.serialNumber.toString()]);
'CertUtil', ['-revoke', cert.data.serialNumber.toRadixString(16)]);
}

@override
Expand All @@ -177,7 +177,7 @@ class WindowsCertificateManager
'1. Close CertainTLS and re-run it as root or \n'
'2. Execute the below command manually:\n\n'
'CertUtil -revoke ' +
cert.data.serialNumber.toString();
cert.data.serialNumber.toRadixString(16);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.2.0+3
version: 1.3.0+4

environment:
sdk: ">=2.2.0 <3.0.0"
Expand Down

0 comments on commit 5c33abb

Please sign in to comment.