From 568e9a407f12b47476f07afcbc873af5fe08032c Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Sun, 15 Nov 2020 00:50:33 +0100 Subject: [PATCH] RsaKeyPair: Improve isValid --- lib/ssh/rsa_key_pair.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ssh/rsa_key_pair.dart b/lib/ssh/rsa_key_pair.dart index f7ce45ef..12473bc6 100644 --- a/lib/ssh/rsa_key_pair.dart +++ b/lib/ssh/rsa_key_pair.dart @@ -72,6 +72,9 @@ class RsaKeyPair { // Tries to encrypt and decrypt bool isValid() { + if (publicKey == null || privateKey == null) { + return false; + } var orig = 'word'; var enc = publicKey.encrypt(orig); var dec = privateKey.decrypt(enc);