A device , comprising: a processor and a memory , an operating system stored in the memory , the operating system comprising a secure environment including a trusted application , two or more device certificates , each associated with a device key pair, enrolled to the device during manufacturing and stored in the memory , wherein, when the operating system is run on the processor , the trusted application is configured to: receive a key pair generation request, generate a key pair in response to the key pair generation request, receive a key pair attestation request with an indication of a preferred device certificate, generate an attestation certificate in response to the key pair attestation request, sign the attestation certificate using one of the two or more device certificates with its associated device key pair based on the indication of a preferred device certificate, and activate a secure mode of operation of the processor to access a secure segment of the memory to generate and/or sign the attestation certificate; further comprising an application stored in the memory , wherein the application is configured to send to the operating system the key pair generation request and the key pair attestation request with an indication of a preferred device certificate, and the trusted application is configured to receive the key pair generation request and the attestation request with the indication of the preferred device certificate from the application; wherein the key pair attestation request sent by the application comprises a challenge message which includes a prefix indicating a preferred device certificate. a processor and a memory , an operating system stored in the memory , the operating system comprising a secure environment including a trusted application , two or more device certificates , each associated with a device key pair, enrolled to the device during manufacturing and stored in the memory , wherein, when the operating system is run on the processor , the trusted application is configured to: receive a key pair generation request, generate a key pair in response to the key pair generation request, receive a key pair attestation request with an indication of a preferred device certificate, generate an attestation certificate in response to the key pair attestation request, sign the attestation certificate using one of the two or more device certificates with its associated device key pair based on the indication of a preferred device certificate, and activate a secure mode of operation of the processor to access a secure segment of the memory to generate and/or sign the attestation certificate; receive a key pair generation request, generate a key pair in response to the key pair generation request, receive a key pair attestation request with an indication of a preferred device certificate, generate an attestation certificate in response to the key pair attestation request, sign the attestation certificate using one of the two or more device certificates with its associated device key pair based on the indication of a preferred device certificate, and activate a secure mode of operation of the processor to access a secure segment of the memory to generate and/or sign the attestation certificate; further comprising an application stored in the memory , wherein the application is configured to send to the operating system the key pair generation request and the key pair attestation request with an indication of a preferred device certificate, and the trusted application is configured to receive the key pair generation request and the attestation request with the indication of the preferred device certificate from the application; wherein the key pair attestation request sent by the application comprises a challenge message which includes a prefix indicating a preferred device certificate. <EOS>