| 178 | return _decrypted_master_key == fc::sha512(); |
| 179 | } |
| 180 | bool Wallet::unlock(QString password) |
| 181 | { |
| 182 | try { |
| 183 | if( !isLocked() ) return true; |
| 184 | auto pw_str = password.toStdString(); |
| 185 | auto password_hash = fc::sha512::hash(pw_str.c_str(), pw_str.size()); |
| 186 | auto plain_txt = fc::aes_decrypt(password_hash, _data.encrypted_master_key); |
| 187 | _decrypted_master_key = fc::raw::unpack<fc::sha512>(plain_txt); |
| 188 | if( _data.master_key_digest != fc::sha512::hash(_decrypted_master_key) ) |
| 189 | _decrypted_master_key = fc::sha512(); |
| 190 | |
| 191 | Q_EMIT isLockedChanged(isLocked()); |
| 192 | return !isLocked(); |
| 193 | } catch (const fc::exception& e) { |
| 194 | elog(e.to_detail_string()); |
| 195 | return false; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | bool Wallet::lock() |
| 200 | { |