I was reading this article about serialization.
It was the first time I saw encrypting a serialized object. I'm trying to encrypt some serializable object and then save them into a file. But the article's example uses ECB mode which is known to reveal informations about the encrypted plaintext. I was wondering, how is it possible to encrypt a serialized object by using CBC instead of ECB mode?
In order to use CBC, an initial vector is needed. This vector must be saved with the serialized object, but if the vector gets encrypted then we can't find the vector in order to decrypt the object.
Also, is it possible to say that the initial vector will be saved as plaintext in the file where the serialiazable object is saved. But then wouldn't the file be destroyed?
An example using CBC mode would be very useful.