An image forming apparatus has a replacement part equipped with a storage
device installed therein. The apparatus has a code adding part adding an
error detecting code to target data to be written in the storage device,
and an encrypting part encrypting the data having the error detecting
code added thereto in the code adding part, to generate encrypted data.
In addition, the apparatus has a writing part writing the encrypted data
to the storage device.