A computer-implemented method for controlling access of a terminal to an attribute stored in an ID token and for granting access to an access-restricted security device, wherein the method comprises an authentication of the terminal by the ID token and an authentication of the ID token by the terminal, wherein the terminal is authenticated by the ID token via an authentication server, which comprises a static private key associated with the terminal, wherein the authentication via the authentication server comprises: - sending a first access token from the terminal to the ID token, - verifying, by the ID token, a first signature of the first access token with a static public key associated with the terminal, - generating and sending a session-specific temporary public key by the terminal to the ID token, - generating and sending a random first secret by the ID token to the terminal, - forwarding the random first secret by the terminal to the authentication server and sending the session-specific temporary public key of the terminal to the authentication server, - creating a second signature of the random first secret by the authentication server with the static private key associated with the terminal and the session-specific temporary public key of the terminal, and sending the second signature to the terminal, - forwarding the second signature by the terminal to the ID token, - verifying the second signature of the random first secret by the ID token with use of the random first secret, the session-specific temporary public key of the terminal and the static public key associated with the terminal, - once the first and second signature have been successfully verified, granting the terminal access to the attribute, wherein the terminal accesses the attribute only on the condition that the ID token has been successfully authenticated by the terminal, - once the terminal has been granted access to the attribute, reading the attribute by the terminal and sending an access request to an access management server, wherein the access request comprises the attribute in encrypted form, - decrypting and verifying the attribute by the access management server, wherein the access management server, grants access to the security device in the event of successful verification. - sending a first access token from the terminal to the ID token, - verifying, by the ID token, a first signature of the first access token with a static public key associated with the terminal, - generating and sending a session-specific temporary public key by the terminal to the ID token, - generating and sending a random first secret by the ID token to the terminal, - forwarding the random first secret by the terminal to the authentication server and sending the session-specific temporary public key of the terminal to the authentication server, - creating a second signature of the random first secret by the authentication server with the static private key associated with the terminal and the session-specific temporary public key of the terminal, and sending the second signature to the terminal, - forwarding the second signature by the terminal to the ID token, - verifying the second signature of the random first secret by the ID token with use of the random first secret, the session-specific temporary public key of the terminal and the static public key associated with the terminal, - once the first and second signature have been successfully verified, granting the terminal access to the attribute, wherein the terminal accesses the attribute only on the condition that the ID token has been successfully authenticated by the terminal, - once the terminal has been granted access to the attribute, reading the attribute by the terminal and sending an access request to an access management server, wherein the access request comprises the attribute in encrypted form, - decrypting and verifying the attribute by the access management server, wherein the access management server, grants access to the security device in the event of successful verification.