A data generating device comprising: a variable-length data input means configured to input variable-length data; an embedding means configured to embed identification data corresponding to format information indicating the format of the variable-length data to the variable-length data; an location information acquiring means configured to acquire location information showing locations corresponding to identification data in variable-length data; and an outputting means configured to output the variable-length data in which the identification data is embedded and the location information, wherein the variable-length data comprises a public key certificate, and further comprising: a data generating means configured to generate with a pre-determined length at least one set of data to be input by the variable-length data input means, characterized in that: the data generating means is configured to calculate signature data based on signed data and corrected data and, if the bit length of the signature data is not the pre-determined length, is configured to generate signature data by repeating updating of the corrected data until signature data with the pre-determined length is obtained. a variable-length data input means configured to input variable-length data; an embedding means configured to embed identification data corresponding to format information indicating the format of the variable-length data to the variable-length data; an location information acquiring means configured to acquire location information showing locations corresponding to identification data in variable-length data; and an outputting means configured to output the variable-length data in which the identification data is embedded and the location information, wherein the variable-length data comprises a public key certificate, and further comprising: a data generating means configured to generate with a pre-determined length at least one set of data to be input by the variable-length data input means, characterized in that: the data generating means is configured to calculate signature data based on signed data and corrected data and, if the bit length of the signature data is not the pre-determined length, is configured to generate signature data by repeating updating of the corrected data until signature data with the pre-determined length is obtained. a data generating means configured to generate with a pre-determined length at least one set of data to be input by the variable-length data input means, characterized in that: the data generating means is configured to calculate signature data based on signed data and corrected data and, if the bit length of the signature data is not the pre-determined length, is configured to generate signature data by repeating updating of the corrected data until signature data with the pre-determined length is obtained. the data generating means is configured to calculate signature data based on signed data and corrected data and, if the bit length of the signature data is not the pre-determined length, is configured to generate signature data by repeating updating of the corrected data until signature data with the pre-determined length is obtained.