Method for operating keystream generators for secure data transmission, said keystream generators being operated in counter mode, wherein for the transmission of data, in particular payload data, the data (DT, NDT) are encrypted to form a ciphertext using a keystream (SST VS) generated by a keystream generator on the basis of a first control data set, and the data (DT, NDT) in the ciphertext are decrypted using a keystream (SST ES) generated by the keystream generator on the basis of a second control data set, wherein the keystream (SST VS, SST ES) is formed from the encryption of a counter value using a block cipher key, said counter value being determined continuously in the form of control-data-set-related calling (i 1, i 3,...) of the keystream generator, initially being given by an initialization vector contained in the control data set (SDS1, SDS2), wherein IV=i 1, and lying in a delimited counter value range, in particular of the order of magnitude of greater than 2 32, characterized in that a) in an "encryption" operating mode a1) the sequential use of the counter values is logged and the logging allows recognition of whether the block cipher key has been used erroneously, in particular multiply or sequentially multiply, with the same counter value, wherein a11) in the case of erroneous use, an error message or no keystream (SST VS) is output, or a12) in the case of error-free use, the keystream (SST VS) for the encryption of the data (DT, NDT) is output and a check code (PRC GH) is generated, which, for the "encryption" operating mode, is linked to a generator-specific secret, in particular one generated in the keystream generator or introduced into the latter from outside, and b) in a "decryption" operating mode b1) the erroneous, in particular the multiple or sequentially multiple, use of the block cipher key and counter values is recognized on the basis of the generated check code (PRC GH) as the second control data set in the course of a validity check of the check code (PRC GH) carried out on the basis of the secret, and thus whether the generated check code (PRC GH) representing the second control data set is valid, wherein b11) a further error message (FM') or no keystream (SST ES) is output if the check code validity check turns out to be negative, that is to say that the check code (PRC GH) is incorrect, or b12) the keystream (SST ES) for decrypting the ciphertext is output if the check code validity check turns out to be positive, that is to say that the check code (PRC GH) is correct. a) in an "encryption" operating mode a1) the sequential use of the counter values is logged and the logging allows recognition of whether the block cipher key has been used erroneously, in particular multiply or sequentially multiply, with the same counter value, wherein a11) in the case of erroneous use, an error message or no keystream (SST VS) is output, or a12) in the case of error-free use, the keystream (SST VS) for the encryption of the data (DT, NDT) is output and a check code (PRC GH) is generated, which, for the "encryption" operating mode, is linked to a generator-specific secret, in particular one generated in the keystream generator or introduced into the latter from outside, and a1) the sequential use of the counter values is logged and the logging allows recognition of whether the block cipher key has been used erroneously, in particular multiply or sequentially multiply, with the same counter value, wherein a11) in the case of erroneous use, an error message or no keystream (SST VS) is output, or a12) in the case of error-free use, the keystream (SST VS) for the encryption of the data (DT, NDT) is output and a check code (PRC GH) is generated, which, for the "encryption" operating mode, is linked to a generator-specific secret, in particular one generated in the keystream generator or introduced into the latter from outside, and b) in a "decryption" operating mode b1) the erroneous, in particular the multiple or sequentially multiple, use of the block cipher key and counter values is recognized on the basis of the generated check code (PRC GH) as the second control data set in the course of a validity check of the check code (PRC GH) carried out on the basis of the secret, and thus whether the generated check code (PRC GH) representing the second control data set is valid, wherein b11) a further error message (FM') or no keystream (SST ES) is output if the check code validity check turns out to be negative, that is to say that the check code (PRC GH) is incorrect, or b12) the keystream (SST ES) for decrypting the ciphertext is output if the check code validity check turns out to be positive, that is to say that the check code (PRC GH) is correct. b1) the erroneous, in particular the multiple or sequentially multiple, use of the block cipher key and counter values is recognized on the basis of the generated check code (PRC GH) as the second control data set in the course of a validity check of the check code (PRC GH) carried out on the basis of the secret, and thus whether the generated check code (PRC GH) representing the second control data set is valid, wherein b11) a further error message (FM') or no keystream (SST ES) is output if the check code validity check turns out to be negative, that is to say that the check code (PRC GH) is incorrect, or b12) the keystream (SST ES) for decrypting the ciphertext is output if the check code validity check turns out to be positive, that is to say that the check code (PRC GH) is correct.