*/
public void setEncryptionKey(byte[] rKey) throws InvalidKeyException,
CryptoException,
StorageException
{
CryptoHandler aNewCrypto = null;
if (rKey != null)
{
aNewCrypto = new CryptoHandler(rKey);
aNewCrypto.setProgressMonitor(rProgressMonitor);
}
if (((aNewCrypto == null) && (aCryptoHandler != null)) ||
((aNewCrypto != null) && !aNewCrypto.equals(aCryptoHandler)))
{
if ((aCryptoHandler == null) && (aKeyVerificationData != null))
{
verifyKey(aNewCrypto);
return;
}
changeEncryption(aNewCrypto);
// generate key verification data for the new key or reset it
if (aNewCrypto != null)
{
aKeyVerificationData = aNewCrypto.generateKeyVerification(KEY_VERIFY_ITERATIONS);
}
else
{
aKeyVerificationData = null;
}