Method for performing a cryptographic calculation, which is implemented in a processor device (PR), in a manner protected against attacks, wherein the cryptographic calculation is configured, by applying a cryptographic algorithm (AES) to input values comprising a data item (D) and a cryptographic key (K), to generate a computational result (E) of the cryptographic algorithm, wherein calculations are performed with the key (K) and the complementary key (K) that is complementary to the key; characterized by (a) a calculation measure comprising the following steps: - performing the calculation twice or more times with the data item (D) and the key (K) in order to generate two or more key results (EK1, EK2, ...), - performing the calculation twice or more times with the data item (D) and the complementary key (K') in order to generate two or more complementary key results (EK1', EK2', ...), (b) also, in order to protect the calculation from safe error attacks, a defensive measure which is in the form of a result comparison measure comprising: - comparing the two or more key results (EK1, EK2, ...) for a match with one another, and comparing the two or more complementary key results (EK1', EK2', ...) for a match with one another, - if the two or more key results (EK1, EK2, ...) and the two or more complementary key results (EK1', EK2', ...) match, outputting one or at least one of the key results (EK1, EK2, ...) as the result (E), - otherwise preventing the output of a result (E) and optionally outputting an error code instead of outputting the result. (a) a calculation measure comprising the following steps: - performing the calculation twice or more times with the data item (D) and the key (K) in order to generate two or more key results (EK1, EK2, ...), - performing the calculation twice or more times with the data item (D) and the complementary key (K') in order to generate two or more complementary key results (EK1', EK2', ...), - performing the calculation twice or more times with the data item (D) and the key (K) in order to generate two or more key results (EK1, EK2, ...), - performing the calculation twice or more times with the data item (D) and the complementary key (K') in order to generate two or more complementary key results (EK1', EK2', ...), (b) also, in order to protect the calculation from safe error attacks, a defensive measure which is in the form of a result comparison measure comprising: - comparing the two or more key results (EK1, EK2, ...) for a match with one another, and comparing the two or more complementary key results (EK1', EK2', ...) for a match with one another, - if the two or more key results (EK1, EK2, ...) and the two or more complementary key results (EK1', EK2', ...) match, outputting one or at least one of the key results (EK1, EK2, ...) as the result (E), - otherwise preventing the output of a result (E) and optionally outputting an error code instead of outputting the result. - comparing the two or more key results (EK1, EK2, ...) for a match with one another, and comparing the two or more complementary key results (EK1', EK2', ...) for a match with one another, - if the two or more key results (EK1, EK2, ...) and the two or more complementary key results (EK1', EK2', ...) match, outputting one or at least one of the key results (EK1, EK2, ...) as the result (E), - otherwise preventing the output of a result (E) and optionally outputting an error code instead of outputting the result. <EOS>