}
if ( isEncrypted( ) )
{
InputStream plaintext = file.getStreamToStore( );
BufferedCipherStream ciphertext = _encryptor
.encryptStream( plaintext );
file.setStreamToStore( ciphertext );
// we need to set two important pieces of meta-data:
// the salt value used for encrypting this file, and
// an MD5 hash of the key used to encrypt it.
String salt = ciphertext.getSaltAsString( );
String keyMD5 = ciphertext.getKeyMD5( );
CloudStoreObjectMetadata meta = file.getMetadata( );
meta.setEncryptionSalt( salt );
meta.setDecryptionKeyHash( keyMD5 );
file.setDirtyMetadata( meta );
}