parameters: (self, secureOldKey, secureNewKey)
docstring: We will use None to specify "no encryption", either for old or new.  Of
        course we throw an error is old key is "None" but the address is actually
        encrypted.
docstring_summary: We will use None to specify "no encryption", either for old or new.  Of
        course we throw an error is old key is "None" but the address is actually
        encrypted.
docstring_tokens: We will use None to specify no encryption either for old or new . Of course we throw an error is old key is None but the address is actually encrypted .
function: def changeEncryptionKey(self, secureOldKey, secureNewKey):
        """
        We will use None to specify "no encryption", either for old or new.  Of
        course we throw an error is old key is "None" but the address is actually
        encrypted.
        """
        if not self.hasPrivKey():
           raise KeyDataError, 'No private key available to re-encrypt'
  
        if not secureOldKey and self.useEncryption and self.isLocked:
           raise WalletLockError, 'Need old encryption key to unlock private keys'
  
        wasLocked = self.isLocked
  
        # Decrypt the original key
        if self.isLocked:
           self.unlock(secureOldKey, skipCheck=False)
  
        # Keep the old IV if we are changing the key.  IV reuse is perfectly
        # fine for a new key, and might save us from disaster if we otherwise
        # generated a new one and then forgot to take note of it.
        self.keyChanged = True
        if not secureNewKey:
           # If we chose not to re-encrypt, make sure we clear the encryption
           self.binInitVect16     = SecureBinaryData()
           self.binPrivKey32_Encr = SecureBinaryData()
           self.isLocked          = False
           self.useEncryption     = False
        else:
           # Re-encrypt with new key (using same IV)
           self.useEncryption = True
           self.lock(secureNewKey)  # do this to make sure privKey_Encr filled
           if wasLocked:
              self.isLocked = True
           else:
              self.unlock(secureNewKey)
              self.isLocked = False
function_tokens: def changeEncryptionKey ( self , secureOldKey , secureNewKey ) : if not self . hasPrivKey ( ) : raise KeyDataError , 'No private key available to re-encrypt' if not secureOldKey and self . useEncryption and self . isLocked : raise WalletLockError , 'Need old encryption key to unlock private keys' wasLocked = self . isLocked # Decrypt the original key if self . isLocked : self . unlock ( secureOldKey , skipCheck = False ) # Keep the old IV if we are changing the key.  IV reuse is perfectly # fine for a new key, and might save us from disaster if we otherwise # generated a new one and then forgot to take note of it. self . keyChanged = True if not secureNewKey : # If we chose not to re-encrypt, make sure we clear the encryption self . binInitVect16 = SecureBinaryData ( ) self . binPrivKey32_Encr = SecureBinaryData ( ) self . isLocked = False self . useEncryption = False else : # Re-encrypt with new key (using same IV) self . useEncryption = True self . lock ( secureNewKey ) # do this to make sure privKey_Encr filled if wasLocked : self . isLocked = True else : self . unlock ( secureNewKey ) self . isLocked = False