Patent Publication Number: US-10313855-B2

Title: Method to manage subscriptions in a provisioning server

Description:
FIELD OF THE INVENTION 
     The present invention relates to a method to manage subscriptions in a provisioning server. More precisely, it concerns such provisioning servers able to communicate with a Hardware Security Module (HSM) having an HSM key. 
     The invention also pertains to a hardware security module using said method. 
     BACKGROUND OF THE INVENTION 
     Generally, a secure device, typically a secure element or an eUICC, may contain several subscriptions, loaded by a provisioning server. When the secure device has not enough memory, a customer may want to remove a subscription, to make room, and then reload it later on the same secure device when more memory space will be available. Automatic management profile methods on the secure device can also remove a downloaded profile. 
     However a mandatory requirement from all MNOs is to prevent cloning, i.e. loading the same subscription on more than one secure device. 
     It is currently known to add a simple association in the provisioning server when a subscription is loaded on a secure device, so that the server will refuse loading it on another secure device. 
     But if an attacker alters the provisioning server&#39;s database and removes this association, the provisioning server will not know it and accept loading it on any other secure device. 
     Further alternative and advantageous solutions would, accordingly be desirable in the art. 
     SUMMARY OF THE INVENTION 
     The present invention aims at avoiding any possibility of subscription&#39;s cloning on a plurality of secure devices. 
     The present invention is defined in broadest sense, as a method to manage subscriptions in a provisioning server able to communicate with a Hardware Security Module (HSM) having an HSM key, said method comprising the preliminary steps of:
         storing, in the provisioning server, scripts corresponding to the creation of subscriptions (subscription creation scripts), said scripts being encrypted using a storage key, said scripts being intended to be loaded in secure devices, each of these secure devices being associated with a secure device key,   storing said storage key and said secure device keys encrypted using the HSM key in the provisioning server,       

     said method further comprising a load subscription phase comprising the following steps of, when the provisioning server is requested to load a given subscription on a secure device:
         checking if the given script has been loaded on any secure device,   in the case such a previous loading is not appearing, providing the secure device key and the storage key as encrypted and stored to a load function of the Hardware Security Module in a load request,   retrieving, from the load function of said Hardware Security Module, the storage key encrypted using the provided secure device key and the HSM key K, and an APDU_putkey command, encrypted using the provided secure device key, to put the retrieved storage key Ks also encrypted using the provided secure device key,   overwriting the storage key as stored with the storage key encrypted using the secure device key and the HSM key returned by the Hardware Security Module in the previous step,   forwarding the APDU_putkey command to the secure device,   sending the script as stored to the secure device,       

     said method further comprising a reload subscription phase comprising the following steps of, in the case a previous loading is appearing during the checking step:
         providing the secure device key and the storage key as encrypted and stored to a reload function of the hardware security module in a reload request,   retrieving, from the reload function of said Hardware Security module, the storage key encrypted using the provided secure device key and the HSM key and an APDU_putkey command, encrypted using the provided secure device key, to put the retrieved storage key Ks also encrypted using the provided secure device key,   forwarding the APDU_putkey command to the secure device,   sending the script as stored to the secure device.       

     Therefore, the method according to the present invention prevents any script to be loaded on two different secure devices as the storage key is stored encrypted using the secure device key. If the storage key was previously stored after having been loaded on another secure device, even if the method is applied as if it was not previously loaded, it will not be possible for the secure device to decrypt the storage key. More precisely, the decryption using the secure device key will not give a correct storage key but the storage key encrypted using the other secure device key. 
     The script will remains unreadable and not executable and no cloning of the corresponding subscription will be observed. The usage of the HSM to trans-cipher keys and to build the command APDU_PUTKEY provides a good level of security. 
     In a particular embodiment, the load and reload functions of said Hardware Security Module are such that the APDU_putkey command is encrypted using a session key computed using the secure device key and a random data exchanged with the secure device. 
     This embodiment enables to have different keys for each output of the load and reload functions. 
     In a particular implementation, the secure device key is a keyset comprising at least two static sub-keys, one of them being used, by the load and reload functions, to encrypt the storage key an the other being used, by the load and reload functions, to compute the session key. 
     Such an implementation exploits the structure of the secure element keys as generally provided on such elements. 
     According to a preferred implementation, said secure device key is a keyset comprising at least two sub-keys: encryption sub-key and decryption sub-key, wherein provisioning server and secure devices communicate using a derived session encryption sub-key derived from the encryption sub-key and some pseudo random data known only by the provisioning server and the secure device, 
     wherein the load function of said Hardware Security Module, returns, to overwrite the previously stored key, the storage key after decrypting using the HSM key and encrypting using the provided secure device decryption sub-key and the HSM key used, and, to be sent to the secure device, an APDU_putkey command, encrypted by a derived session secure device encryption sub-key, to put the storage key encrypted using the provided secure device decryption sub-key on the secure device, 
     wherein the reload function of said Hardware Security module returns the storage key encrypted using the secure device decryption sub-key and the HSM key and an APDU_putkey command, encrypted by a derived session encryption sub-key, to put the retrieved storage key encrypted using the secure device decryption sub-key on the secure device. 
     This embodiment exploits a classical type of structure of the secure device key to process the different encryption/decryption according to the invention. Different sub-keys of the secure device key are used along the steps of the method of the invention avoiding always the same key to be used. 
     According to a particular implementation, the step of checking if the given script has been loaded on any secure device uses a history of the scripts&#39; loadings stored in the provisioning server. 
     This implementation enables the provisioning server to locally check if the script has already been loaded on a secure device. 
     According to another particular implementation, the step of checking if the given script has been loaded on any secure device uses a history of the scripts&#39; loadings stored in the targeted secure device. 
     This implementation enables to free the provisioning server of the task to keep in memory all the history but each of the secure device has typically an identifier of the different scripts which have been loaded on it. Each secure device is able to send such an identifier to the provisioning server under request. 
     The present invention also relates to a hardware security module comprising at least an HSM key, a load and a reload function respectively triggered by a load request and a reload request:
         the load function receiving two keys encrypted using the HSM key, encrypting the second key using the first and outputting the thus encrypted key further encrypted using the HSM key and an APDU_putkey command, encrypted using the secure device key, to put the retrieved storage key Ks on the secure device,   the reload function receiving two keys encrypted using the HSM key and outputting the second encrypted key and an APDU_putkey command, encrypted using the secure device key, to put the retrieved storage key Ks encrypted using the secure device decryption sub-key on the secure device.       

     Such a hardware security module enables to implement the invention. It receives the keys as stored in the provisioning server and applies one of the both function to the received keys in order to output the command APDU_PUTKEY and the storage after trans-ciphering. 
     According to a particular embodiment, the load and reload functions are such that the APDU_subkey command is encrypted using a session key computed using the secure device key and a random data exchanged with the secure device. 
     According to a particular implementation, the secure device key is a keyset comprising at least two static sub-keys, one of them being used, by the load and reload functions, to encrypt the storage key and, the other being used, by the load and reload functions, to compute the session key. 
     According to a preferred implementation, the hardware security module of the invention is such that said secure device key is a keyset comprising at least two sub keys: encryption sub-key and decryption sub-key, such that provisioning server and secure devices communicates using a derived session encryption sub-key derived from the encryption sub-key and some pseudo random data known only by the provisioning server and the secure device, such that the load function of said Hardware Security Module returns, to overwrite the previously stored key, the storage keys, after decrypting using the HSM key and encrypting using the secure device decryption sub-key and the HSM key used, and, to be sent to the secure device, an APDU_putkey command, encrypted by a derived session encryption sub-key, to put the retrieved storage key Ks encrypted using the decryption sub-key on the secure device, 
     and such that the reload function of said Hardware Security module returns the storage key encrypted using the secure device decryption sub-key and the HSM key and an APDU_putkey command, encrypted by a derived session encryption sub-key, to put the retrieved storage key Ks encrypted using the secure device decryption sub-key on the secure device. 
     To the accomplishment of the foregoing and related ends, one or more embodiments comprise the features hereinafter fully described and particularly pointed out in the claims. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The following description and the annexed drawings set forth in detail certain illustrative aspects and are indicative of but a few of the various ways in which the principles of the embodiments may be employed, Other advantages and novel features will become apparent from the following detailed description when considered in conjunction with drawings and the disclosed embodiments are intended to include all such aspects and their equivalents. 
         FIG. 1  shows an environment comprising an hardware security module, a provisioning server and at least a secure device and in which the invention is advantageously implemented; 
         FIGS. 2A, 2B and 2C  are sequence diagrams showing the different steps of the invention in different loading situations. 
     
    
    
     DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION 
     For a more complete understanding of the invention, the invention will now be described in detail with reference to the accompanying drawings. The same elements have been designated with the same reference numerals in the different drawings. For clarity, only those elements and steps which are useful to the understanding of the present invention have been shown in the drawings and will be described. 
       FIG. 1  schematically shows the environment in which the invention is advantageously implemented. It comprises a hardware security module HSM, a provisioning server PS and, here, two secure devices SE 1  and SE 2 . Typically SE 1  and SE 2  are secure elements. 
     The HSM, stores at least one HSM key K and has at least two trans-cipher functions Load and Reload according to the invention. 
     The trans-cipher load function returns, given two cryptograms [k 1 ]K and [k 2 ]K, returns an APDU_PUTKEY to put k 2  encrypted by k 1  and K:[[k 2 ]k 1 ]K. The key k 2  encrypted using k 1  end K is also output. The trans-cipher reload function returns, given two cryptograms [k 1 ]K and [[k 2 ]k 1 ]K, returns an APDU_PUTKEY to put k 2  encrypted by k 1  and K:[[k 2 ]k 1 ]K. 
     The provisioning server PS stores scripts (Scr)Ks relative to the creation of different subscriptions. These scripts (Scr)Ks are stored after encryption using a storage key Ks. The provisioning server PS also stores the storage key Ks after its encryption by the HSM using the HSM key K and as many secure elements&#39; keys (Ke 1 )K, (Ke 2 )K as there are secure, elements in the environment in which the invention is implemented, said secure elements&#39; keys being stored after encryption by the HSM using the HSM key K. 
     At last each secure element SEi stores its own secure element key Kei. 
       FIG. 2A  shows the sequence of steps of the invention when the load of a non previously loaded script ScrA of a subscription on a eUICC SE 1  is requested. This eUICC SE 1  is typically a secure element. 
     In a step S 0 , the provisioning server PS that stores the scripts corresponding to the subscriptions checks if the script ScrA has yet been loaded.  FIG. 2A  corresponds to the case N where it has not been previously loaded. 
     In a step S 1 , the provisioning server PS sends the storage key Ks and the secure element key Ke 1  as stored and thus as encrypted using the HSM key K to the function Load of the hardware secure module HSM. 
     When the secure element key is a keyset comprising at least two sub-keys: encryption sub-key Ke 1 -enc and decryption sub-key Ke 1 -dek, the couple of these values (Ke 1 -enc, Ke 1 -dek) are previously encrypted using said HSM key as secure element key Ke 1 . Ke 1 -enc will be used to create Ke 1 -Senc which is a session encryption key. 
     In a step S 2 , the function Load of the HSM trans ciphers the two received encrypted keys. The HSM then outputs the storage key Ks encrypted by the secure element key Ke 1  and by the HSM key K and a command APDU_PUTKEY, the secure element SE 1  to put the storage key Ks encrypted by the secure element key Ke 1 , said command being further encrypted with the secure element key Ke 1 . 
     In the case the secure element key Ke 1  is a keyset, the Load function of the HSM then outputs the storage key Ks encrypted using one of the static sub-key of the key set Ke 1 , for example the secure element decry sub-key Ke 1 -dek, and by the HSM key K and a command APDU_PUTKEY for the secure element SE 1  to put the storage key Ks encrypted by the secure element decryption sub-key Ke 1 -dek, said command being further encrypted by a derived session secure element encryption sub-key Ke 1 -senc on the secure element. 
     In a step S 3 , the encrypted storage key ((Ks)Ke 1 )K and the command APDU_PUTKEY are sent to the provisioning server PS. 
     The provisioning serves PS forwards the APDU_PUTKEY to the secure element SE 1  in a step S 4 . Advantageously, the script (ScrA)Ks is also sent to the secure element SE 1  in step S 4 . The script is the one as stored in provisioning server, unchanged, i.e. still encrypted by the storage key Ks. It is here noted that the script ScrA and the APDU can be sent in distinct messages, so, strictly speaking, in distinct steps. 
     As the secure element SE 1  has the secure element key Ke 1 , it access the APDU_PUTKEY and the storage key Ks. In a step S 5 , the storage key Ks is stored in a register reg after decryption using the secure element key Ke 1  in the secure element SE 1 . 
     The secure element SE 1  then decrypts the scripts using Ks and executes the script ScrA which create the subscription on secure element SE 1 . When keyset is used as secure element key, as the secure element SE 1  has the two sub-keys, it is able to decrypt the storage key as well as, subsequently, the script ScrA. 
     In a step S 6 , the provisioning server PS overwrites in database storing an history of the loads the previously stored storage key as encrypted using HSM key K by the storage key as received from the HSM, i.e. the storage key encrypted using the secure element key and the HSM K ([Ks]Ke 1 )K. 
     In parallel, it advantageously records in database that the script ScrA has been loaded on the secure element SE 1 . This information can also be stored in the secure element that is then asked by the provisioning server PS during the step S 0 . 
       FIG. 2B  shows the sequence of steps of the invention when the load of a previously loaded script ScrA of a subscription on a eUICC SE 1  requested. This figure corresponds to the case Y in step S 0  where the script ScrA is detected as having already been loaded. Then in a step S 7 , it is checked if the load was done on the secure element SE 1 . If yes, case Y, it means that the provisioning server PS receives a request to load the script ScrA again on the secure element SE 1 . 
     In this case, the provisioning server PS sends the storage key Ks and the secure element key Ke 1  as stored to the function Reload of the hardware secure module HSM. Thus the secure element key Ke 1  as encrypted using the HSM key K and the storage key as encrypted using the secure element key Ke 1  and the HSM key K are received by the Reload function in a step S 8 . In a step S 9 , the function Reload of the HSM trans-ciphers the two encrypted keys. The HSM then outputs the storage key Ks encrypted by the secure element key Ke 1  and by the HSM key K as it was indeed previously stored. A command APDU_PUTKEY is also output for the secure element SE 1  to put the storage key Ks encrypted by the secure element key Ke 1 , said command being further encrypted with the secure element key Ke 1 . 
     The secure element key Ke 1  is effectively always used to encrypt the command. However, in practice, Ke 1  is used to generate dynamic keys that are used for the encryption itself. 
     Thus when the secure element key Ke 1  is a key set, each time an APDU command is generated, a new session key: Ke 1 -Senc is computed with a new random data and one static sub-key, typically sub-key Ke 1 -enc. It has thus to be noted that the output of the load and of the reload function are always distinct as different session keys are indeed used for the encryption. 
     In practice the output is constituted of the script encrypted using Ks and [ScrA]Ks and the APDU_PUTKEY command [[APDU_PUTKEY(Ks)]Ke 1 -dek]Ke 1 -Senc. The command APDU_PUTKEY is thus encrypted using the dynamic session key Ke 1 -Senc while the key Ks is itself encrypted using one of the static sub-keys, here the decryption key Ke 1 -dek. 
     In a step S 10 , the output storage key and the output command are sent to the provisioning server PS which lets the previously stored value [Ks]Ke 1  in database and forwards the command APDU_PUTKEY to the secure element SE 1  with, advantageously, the script (ScrA)Ks as encrypted using the storage key. 
     The secure element SE 1  has now the storage key Ks and is able to decrypt the script ScrA. It then executes the script ScrA which creates the corresponding subscription on the secure element SE 1 . 
     Let us now consider the case where, as schematically illustrated on  FIG. 2B  with case N of step S 7 , the script ScrA has already been loaded on another secure element. In a normal functioning, the check step S 7  detects that the script was previously loaded but not on the secure element, case N. The request is thus directly rejected in a step S 12 . 
     The invention particularly solves the situation where an attacker can alter the database where the history of the loads is stored and remove the record that the script has been loaded on the secure element SE 1 . So, as illustrated on  FIG. 2C , let us now consider the case where the database where the history of the loads has been corrupted in such a way that the output of the check implemented in step S 0  is corresponding to the case N where the script ScrA has never been loaded while it was previously loaded on another secure element SE 2  having a key Ke 2 . 
     In a step S 1 , the provisioning server sends the storage key ((Ks)Ke 2 )K as previously stored, i.e. encrypted using the other secure element key Ke 2  with the secure element key Ke 1  as encrypted using the HSM key K to the Load function of the HSM. 
     The Load function of step S 2  outputs the storage key (((Ks)Ke 2 )Ke 1 )K encrypted by the other secure element key Ke 2 , the secure element key Ke 1  and by the HSM key K. The output and forwarded command APDU_PUTKEY has a key that is not Ks but (Ks)Ke 2 . 
     The sent script is unchanged and thus still encrypted by Ks alone to the secure element SE 1 . The secure element cannot decrypt the script with (Ks)Ke 2  and the script fails to execute. The subscription is thus not installed on SE 1 . Thus, with the invention, when the script has been loaded previously on a secure element but the record of this loading has been removed from the history, the subscription cannot be installed in another card because Ks cannot be retrieved. 
     When the script ScrA has been loaded on secure element SE 1 , SE 1  can keep history of the subscription identifier. Each time the provisioning server PS wants to download the same subscription profile, it asks the secure element SE 1  if such profile has already been downloaded on it. 
     If not, a new script ScrB is used. If yes, the secure element SE 1  sends the identifier of the subscription to use. 
     The provisioning server PS then retrieves the script corresponding to the received identifier and reuses the [Ks]Ke 1  previously stored. 
     In the above detailed description, reference is made to the accompanying drawings that show, by way of illustration, specific embodiments in which the invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention. It should of course be understood that various modifications and changes in form or detail could readily be made without departing from the spirit of the invention. It is therefore intended that the invention may not be limited to the exact form and detail shown and described herein, nor to anything less than the whole of the invention disclosed herein and as claimed hereinafter. Further the features described in the description, the drawing and the claims disclosing the invention may be essential for the invention considered alone or in combination. The above detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims, appropriately interpreted, along with the full range of equivalents to which the claims are entitled. 
     In particular, any reference signs in the claims shall not be construed as limiting the scope of the invention. The wording “comprising” does not exclude other elements or steps. The wording “a” or “an” does exclude plurality.