mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
RsaKeyPair: Improve isValid
This commit is contained in:
@ -72,6 +72,9 @@ class RsaKeyPair {
|
|||||||
|
|
||||||
// Tries to encrypt and decrypt
|
// Tries to encrypt and decrypt
|
||||||
bool isValid() {
|
bool isValid() {
|
||||||
|
if (publicKey == null || privateKey == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var orig = 'word';
|
var orig = 'word';
|
||||||
var enc = publicKey.encrypt(orig);
|
var enc = publicKey.encrypt(orig);
|
||||||
var dec = privateKey.decrypt(enc);
|
var dec = privateKey.decrypt(enc);
|
||||||
|
Reference in New Issue
Block a user