@ -16,13 +16,13 @@ const unsigned int WALLET_CRYPTO_IV_SIZE = 16;
/**
/**
* Private key encryption is done based on a CMasterKey ,
* Private key encryption is done based on a CMasterKey ,
* which holds a salt and random encryption key .
* which holds a salt and random encryption key .
*
*
* CMasterKeys are encrypted using AES - 256 - CBC using a key
* CMasterKeys are encrypted using AES - 256 - CBC using a key
* derived using derivation method nDerivationMethod
* derived using derivation method nDerivationMethod
* ( 0 = = EVP_sha512 ( ) ) and derivation iterations nDeriveIterations .
* ( 0 = = EVP_sha512 ( ) ) and derivation iterations nDeriveIterations .
* vchOtherDerivationParameters is provided for alternative algorithms
* vchOtherDerivationParameters is provided for alternative algorithms
* which may require more parameters ( such as scrypt ) .
* which may require more parameters ( such as scrypt ) .
*
*
* Wallet Private Keys are then encrypted using AES - 256 - CBC
* Wallet Private Keys are then encrypted using AES - 256 - CBC
* with the double - sha256 of the public key as the IV , and the
* with the double - sha256 of the public key as the IV , and the
* master key ' s key as the encryption key ( see keystore . [ ch ] ) .
* master key ' s key as the encryption key ( see keystore . [ ch ] ) .
@ -162,28 +162,26 @@ public:
{
{
{
{
LOCK ( cs_KeyStore ) ;
LOCK ( cs_KeyStore ) ;
if ( ! IsCrypted ( ) )
if ( ! IsCrypted ( ) ) {
return CBasicKeyStore : : HaveKey ( address ) ;
return CBasicKeyStore : : HaveKey ( address ) ;
}
return mapCryptedKeys . count ( address ) > 0 ;
return mapCryptedKeys . count ( address ) > 0 ;
}
}
return false ;
return false ;
}
}
bool GetKey ( const CKeyID & address , CKey & keyOut ) const override ;
bool GetKey ( const CKeyID & address , CKey & keyOut ) const override ;
bool GetPubKey ( const CKeyID & address , CPubKey & vchPubKeyOut ) const override ;
bool GetPubKey ( const CKeyID & address , CPubKey & vchPubKeyOut ) const override ;
void GetKeys ( std : : set < CKeyID > & setAddress ) const override
std : : set < CKeyID > GetKeys ( ) const override
{
{
if ( ! IsCrypted ( ) )
LOCK ( cs_KeyStore ) ;
{
if ( ! IsCrypted ( ) ) {
CBasicKeyStore : : GetKeys ( setAddress ) ;
return CBasicKeyStore : : GetKeys ( ) ;
return ;
}
}
setAddress . clear ( ) ;
std : : set < CKeyID > set_address ;
CryptedKeyMap : : const_iterator mi = mapCryptedKeys . begin ( ) ;
for ( const auto & mi : mapCryptedKeys ) {
while ( mi ! = mapCryptedKeys . end ( ) )
set_address . insert ( mi . first ) ;
{
setAddress . insert ( ( * mi ) . first ) ;
mi + + ;
}
}
return set_address ;
}
}
/**
/**