/** * Check whether the password can decrypt the first key in the wallet. * This can be used to check the validity of an entered password. * * @return boolean true if password supplied can decrypt the first private key in the wallet, false otherwise. * @throws IllegalStateException if the wallet is not encrypted. */ public boolean checkPassword(CharSequence password) { keyChainGroupLock.lock(); try { return keyChainGroup.checkPassword(password); } finally { keyChainGroupLock.unlock(); } }
/** * Check whether the password can decrypt the first key in the wallet. * This can be used to check the validity of an entered password. * * @return boolean true if password supplied can decrypt the first private key in the wallet, false otherwise. * @throws IllegalStateException if the wallet is not encrypted. */ public boolean checkPassword(CharSequence password) { keyChainGroupLock.lock(); try { return keyChainGroup.checkPassword(password); } finally { keyChainGroupLock.unlock(); } }
/** * Check whether the password can decrypt the first key in the wallet. * This can be used to check the validity of an entered password. * * @return boolean true if password supplied can decrypt the first private key in the wallet, false otherwise. * @throws IllegalStateException if the wallet is not encrypted. */ public boolean checkPassword(CharSequence password) { keyChainGroupLock.lock(); try { return keyChainGroup.checkPassword(password); } finally { keyChainGroupLock.unlock(); } }
/** * Check whether the password can decrypt the first key in the wallet. * This can be used to check the validity of an entered password. * * @return boolean true if password supplied can decrypt the first private key in the wallet, false otherwise. * @throws IllegalStateException if the wallet is not encrypted. */ public boolean checkPassword(CharSequence password) { keyChainGroupLock.lock(); try { return keyChainGroup.checkPassword(password); } finally { keyChainGroupLock.unlock(); } }
group = KeyChainGroup.fromProtobufEncrypted(PARAMS, protoKeys3, scrypt); assertTrue(group.isEncrypted()); assertTrue(group.checkPassword("password")); group.decrypt(aesKey);
group.checkPassword("foo"); // Cannot check password of an unencrypted group. fail(); } catch (IllegalStateException e) { group.encrypt(scrypt, aesKey); assertTrue(group.isEncrypted()); assertTrue(group.checkPassword("password")); assertFalse(group.checkPassword("wrong password")); final ECKey ea = group.findKeyFromPubKey(a.getPubKey()); assertTrue(checkNotNull(ea).isEncrypted());