A gateway device comprising: a communications interface configured to receive a gateway application from a relying system, RS; a memory configured to store the gateway application; and a processor coupled to the memory and the communication interface, and configured to control, by executing the gateway application in a trusted execution environment, TEE, to: establish a first secure communication link with a personal medical device, PMD, by: sending a self-signed certificate to the PMD; in response to said sending a self-signed certificate to the PMD, receiving a message containing a public key of the PMD from the PMD; and sending a certificate signed by the public key of the PMD to the PMD; establish a second secure communication link with the RS; aggregate information from the PMD via the first secure communication link; sign a packet of the aggregated information with a private key of the gateway application executed in the TEE; and transmit the signed packet of the aggregated information to the RS via the second secure communication link, wherein the private key of the gateway application and a public key of the gateway application corresponding to the private key of the gateway application is generated by the gateway application executed in the TEE and the public key of the gateway application is provided to the RS after the gateway application is initialized. a communications interface configured to receive a gateway application from a relying system, RS; a memory configured to store the gateway application; and a processor coupled to the memory and the communication interface, and configured to control, by executing the gateway application in a trusted execution environment, TEE, to: establish a first secure communication link with a personal medical device, PMD, by: sending a self-signed certificate to the PMD; in response to said sending a self-signed certificate to the PMD, receiving a message containing a public key of the PMD from the PMD; and sending a certificate signed by the public key of the PMD to the PMD; establish a second secure communication link with the RS; aggregate information from the PMD via the first secure communication link; sign a packet of the aggregated information with a private key of the gateway application executed in the TEE; and transmit the signed packet of the aggregated information to the RS via the second secure communication link, wherein the private key of the gateway application and a public key of the gateway application corresponding to the private key of the gateway application is generated by the gateway application executed in the TEE and the public key of the gateway application is provided to the RS after the gateway application is initialized. sending a self-signed certificate to the PMD; in response to said sending a self-signed certificate to the PMD, receiving a message containing a public key of the PMD from the PMD; and sending a certificate signed by the public key of the PMD to the PMD; establish a second secure communication link with the RS; aggregate information from the PMD via the first secure communication link; sign a packet of the aggregated information with a private key of the gateway application executed in the TEE; and transmit the signed packet of the aggregated information to the RS via the second secure communication link, wherein the private key of the gateway application and a public key of the gateway application corresponding to the private key of the gateway application is generated by the gateway application executed in the TEE and the public key of the gateway application is provided to the RS after the gateway application is initialized.