A key device (42, 42') comprising: a registered-network storage adapted to store registered network-based identification corresponding to any of networks; an input unit (423, 423') adapted to receive ciphertext and network-based identification; a response unit (426, 426') adapted to generate response information corresponding to a decrypted value of the ciphertext; and an output unit (424, 424') adapted to output the response information when the network-based identification corresponds to the registered network-based identification, characterized in that: the network-based identification is hierarchical network-based identification x j; the registered network-based identification is information corresponding to any of hierarchical network-based identification; the ciphertext C = enc(x i, m) is obtained by encrypting plaintext m using an identifier x i by a hierarchical ID-based encryption method, the identifier x i including the hierarchical network-based identification x j; the key device (42, 42') further comprises: a storage adapted to store a private key s K corresponding to identifier K which is certain hierarchical network-based identification; and a decryption key acquisition unit adapted to output the identifier x i and the private key s K and obtain a private key s xi which is generated from the identifier x i and the private key s K when ≥ [x j] ≥ [x i] is satisfied, where [x α] > [x β] represents that x α belongs to a level above x β, [x α] = [x α '] represents x α = x α ', and [x α] ≥ [x β] represents that [x α] > [x β] or [x α] = [x β] is satisfied; and the decrypted value is obtained by decrypting the ciphertext C with the private key s xi. a registered-network storage adapted to store registered network-based identification corresponding to any of networks; an input unit (423, 423') adapted to receive ciphertext and network-based identification; a response unit (426, 426') adapted to generate response information corresponding to a decrypted value of the ciphertext; and an output unit (424, 424') adapted to output the response information when the network-based identification corresponds to the registered network-based identification, characterized in that: the network-based identification is hierarchical network-based identification x j; the registered network-based identification is information corresponding to any of hierarchical network-based identification; the ciphertext C = enc(x i, m) is obtained by encrypting plaintext m using an identifier x i by a hierarchical ID-based encryption method, the identifier x i including the hierarchical network-based identification x j; the key device (42, 42') further comprises: a storage adapted to store a private key s K corresponding to identifier K which is certain hierarchical network-based identification; and a decryption key acquisition unit adapted to output the identifier x i and the private key s K and obtain a private key s xi which is generated from the identifier x i and the private key s K when ≥ [x j] ≥ [x i] is satisfied, where [x α] > [x β] represents that x α belongs to a level above x β, [x α] = [x α '] represents x α = x α ', and [x α] ≥ [x β] represents that [x α] > [x β] or [x α] = [x β] is satisfied; and the decrypted value is obtained by decrypting the ciphertext C with the private key s xi. the network-based identification is hierarchical network-based identification x j; the registered network-based identification is information corresponding to any of hierarchical network-based identification; the ciphertext C = enc(x i, m) is obtained by encrypting plaintext m using an identifier x i by a hierarchical ID-based encryption method, the identifier x i including the hierarchical network-based identification x j; the key device (42, 42') further comprises: a storage adapted to store a private key s K corresponding to identifier K which is certain hierarchical network-based identification; and a decryption key acquisition unit adapted to output the identifier x i and the private key s K and obtain a private key s xi which is generated from the identifier x i and the private key s K when ≥ [x j] ≥ [x i] is satisfied, where [x α] > [x β] represents that x α belongs to a level above x β, [x α] = [x α '] represents x α = x α ', and [x α] ≥ [x β] represents that [x α] > [x β] or [x α] = [x β] is satisfied; and the decrypted value is obtained by decrypting the ciphertext C with the private key s xi. a storage adapted to store a private key s K corresponding to identifier K which is certain hierarchical network-based identification; and a decryption key acquisition unit adapted to output the identifier x i and the private key s K and obtain a private key s xi which is generated from the identifier x i and the private key s K when ≥ [x j] ≥ [x i] is satisfied, where [x α] > [x β] represents that x α belongs to a level above x β, [x α] = [x α '] represents x α = x α ', and [x α] ≥ [x β] represents that [x α] > [x β] or [x α] = [x β] is satisfied; and the decrypted value is obtained by decrypting the ciphertext C with the private key s xi.