Image data encoded in units of a tile is processed to define a
hierarchical structure by repeatedly forming one tile group from adjacent
tiles and another tile group from adjacent tile groups. Plural partially
encoded data a tile located at a terminal of the hierarchical structure
are arranged in ascending order of priority of decryption to define a
tree having as nodes tile groups, tiles, and partially encoded data.
Encryption key information is generated for a node located at an
uppermost layer of the tree and, up to a node located at a terminal,
encryption key information is generated for a node of interest based on
encryption key information for a node at an upper layer. When a node of
partially encoded data is designated as an object to be encrypted,
partially encoded data at a higher layer containing the designated object
is set as an object to be encrypted.