Examples of Re-Keying and Key Rotation
For example, here is a token vault before a re-key operation:
| MACVALUE | TOKEN | CIPHERTEXT | CREATION DATE | KEYROTATION DATE | 
|---|---|---|---|---|
| 1EECA... | 1575153856 | ...8B5B5C034B12D8010CD7D87DC | 10-NOV-11 | 13-NOV-11 | 
| 52BEC... | 9984367974 | ...49E3BD64A3E81943A4024A5C7 | 10-NOV-11 | 13-NOV-11 | 
| 1EEB9... | 6904456196 | ...7ABE52DD89B22E7D6CC0C18EE | 10-NOV-11 | 13-NOV-11 | 
| A6B09... | 9495007899 | ...398AA8E65700F20AEBED2E693 | 10-NOV-11 | 13-NOV-11 | 
| 37590... | 1073306484 | ...FE0129FEFEBB46DE15659CEB5 | 10-NOV-11 | 13-NOV-11 | 
| D0214... | 1623647955 | ...D5FDB71D1E485517827B29B77 | 10-NOV-11 | 13-NOV-11 | 
| AD70C... | 7720493415 | ...40C34C3E527A3CD85CEA805C8 | 10-NOV-11 | 13-NOV-11 | 
| EB1EB... | 4246117986 | ...6F5A99301099210393141DB17 | 10-NOV-11 | 13-NOV-11 | 
| B8754... | 4401826653 | ...F83DD8558AA4FD52900D56606 | 10-NOV-11 | |
| 5304E... | 1591213345 | ...57D4692E498D903A57C73A2FF | 10-NOV-11 | |
| 52D2D... | 6368332426 | ...1961CCEBAF83DFE55594F00F9 | 10-NOV-11 | |
| 4F45C... | 6387625517 | ...5CB59EC8F83720FEF4A75756D | 10-NOV-11 | 
The mac and ciphertext values have been truncated to fit the page.
The KEYROTATIONDATE column indicates that the table was last re-keyed on 13-NOV-11. The rows with no value in the KEYROTATIONDATE column were added after the last re-key.
Here is sfnt_key_table:
TABLENAME       ENCKEY      HMAC        KEYKEYROTATIONDATE
-----------------------------------------------------------------------------
SOME_VAULT      encKey      macKey
Notice that there is no value for KEYROTATIONDATE in sfnt_key_table. The value is removed when the re-key process ends.
Rotate the encryption key (here, it’s encKey) from the Key Manager.
Run the re-key operation from the command line:
java -cp C:\Tokenization\lib\ext\SafeNetTokenService-8.13.2.000.jar
com.safenet.token.ReKey SOME_VAULT YourKeyManagerUser YourDatabaseUser
The system prompts you for the NAE and database user passwords. These passwords will be masked.
Enter NAE password: Enter database password:
ReKey Operation Parameters: Table Name= SOME_VAULT
NAE User Name= YourKeyManagerUser Database User Name = YourDatabaseUser
Run the ReKey operation? [Yes|No] Yes STARTING KEY ROTATION
TOKEN VAULT INFO HAS BEEN SET FOR TOKEN VAULT SOME_VAULT 5000 TOTAL ROW(S).
5000 ROW(S) WILL BE RE-KEYED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
REKEY SOME_VAULT STARTED: 2011-11-15 12:13:47.925
5000 TOTAL ROWS(S) COMMITTED.
REKEY SOME_VAULT ENDED: 2011-11-15 12:13:48.16
TOKEN VAULT INFO HAS BEEN SET FOR TOKEN VAULT SOME_VAULT KEY ROTATION COMPLETION HAS BEEN RECORDED
After the key rotation and re-key operations, the entries in the sfnt_key_table remain the same. This is because only the encryption key version has changed - it’s name remains the same.
If the process is interrupted before if completes, it will resume correctly when restarted. You can test this by pressing control-c to interrupt the process.
STARTING KEY ROTATION
TOKEN VAULT INFO HAS BEEN SET FOR TOKEN VAULT SOME_VAULT 36628 TOTAL ROW(S).
26628 ROW(S) WILL BE RE-KEYED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
1000 ROW(S) PROCESSED.
Press Control-C to interrupt the process.
If you look at the sfnt_key_table at this point, you’ll see a value in the KEYROTATIONDATE column.
TABLENAME       ENCKEY      HMACKEY         KEYROTATIONDATE
-------------------------------------------------------------------------------------
SOME_VAULT      encKey      macKey          16-NOV-11
If you look at the token vault at this point, you’ll see a value in the KEYROTATIONDATE column for those rows that have been re-keyed.
| MACVALUE | TOKEN | CIPHERTEXT | CREATION DATE | KEYROTATION DATE | 
|---|---|---|---|---|
| 1EECA... | 1575153856 | ...66386975B320140C40E9D00E8 | 10-NOV-11 | 16-NOV-11 | 
| 52BEC... | 9984367974 | ...0E8457180A90F8A78783EEA6D | 10-NOV-11 | 16-NOV-11 | 
| 1EEB9... | 6904456196 | ...FA18B65B24C27DA79F066DD6E | 10-NOV-11 | 16-NOV-11 | 
| A6B09... | 9495007899 | ...09E573690513A4CBA37DFCCF8 | 10-NOV-11 | 16-NOV-11 | 
| 37590... | 1073306484 | ...FE0129FEFEBB46DE15659CEB5 | 10-NOV-11 | 13-NOV-11 | 
| D0214... | 1623647955 | ...D5FDB71D1E485517827B29B77 | 10-NOV-11 | 13-NOV-11 | 
| AD70C... | 7720493415 | ...40C34C3E527A3CD85CEA805C8 | 10-NOV-11 | 13-NOV-11 | 
| EB1EB... | 4246117986 | ...6F5A99301099210393141DB17 | 10-NOV-11 | 13-NOV-11 | 
| B8754... | 4401826653 | ...F83DD8558AA4FD52900D56606 | 10-NOV-11 | |
| 5304E... | 1591213345 | ...57D4692E498D903A57C73A2FF | 10-NOV-11 | |
| 52D2D... | 6368332426 | ...1961CCEBAF83DFE55594F00F9 | 10-NOV-11 | |
| 4F45C... | 6387625517 | ...5CB59EC8F83720FEF4A75756D | 10-NOV-11 | 
When the re-key process resumes, a row is re-keyed if one of the following is true:
- There is no value in the KEYROTATIONDATE column. This means that the row was added after the last rekey. 
- The row’s KEYROTATIONDATE value is earlier than the KEYROTATIONDATE value set for the token vault in the sfnt_key_table. This means that the last re-key was interrupted and the column was not re-keyed. 
To resume the process, simply execute the re-key operations as normal:
java -cp C:\Tokenization\lib\ext\SafeNetTokenService-8.13.2.000.jar com.safenet.token.ReKey SOME_VAULT YourKeyManagerUser YourDatabaseUser
When the process completes, note that the CIPHERTEXT and KEYROTATIONDATE fields change, but the token value remains the same.
| MACVALUE | TOKEN | CIPHERTEXT | CREATION DATE | KEYROTATION DATE | 
|---|---|---|---|---|
| 1EECA... | 1575153856 | ...66386975B320140C40E9D00E8 | 10-NOV-11 | 16-NOV-11 | 
| 52BEC... | 9984367974 | ...0E8457180A90F8A78783EEA6D | 10-NOV-11 | 16-NOV-11 | 
| 1EEB9... | 6904456196 | ...FA18B65B24C27DA79F066DD6E | 10-NOV-11 | 16-NOV-11 | 
| A6B09... | 9495007899 | ...09E573690513A4CBA37DFCCF8 | 10-NOV-11 | 16-NOV-11 | 
| 37590... | 1073306484 | ...C50AD8DFB57BF616AE63B7D01 | 10-NOV-11 | 16-NOV-11 | 
| D0214... | 1623647955 | ...505BF6FBE1DBB4449C2183CBD | 10-NOV-11 | 16-NOV-11 | 
| AD70C... | 7720493415 | ...03FDB91EEDAC35C0050E43AAF | 10-NOV-11 | 16-NOV-11 | 
| EB1EB... | 4246117986 | ...060B7F0183DD930AB1C95D3AF | 10-NOV-11 | 16-NOV-11 | 
| B8754... | 4401826653 | ...EF69D2D12C2074BD04CA40C2E | 10-NOV-11 | 16-NOV-11 | 
| 5304E... | 1591213345 | ...B3E40204B240A421F665E8818 | 10-NOV-11 | 16-NOV-11 | 
| 52D2D... | 6368332426 | ...F480DEFC3192915FBC624A0FE | 10-NOV-11 | 16-NOV-11 | 
| 4F45C... | 6387625517 | ...A4569F8DD0F5FB0FB11C2141D | 10-NOV-11 | 16-NOV-11 | 
Tip
If you view this in your own database, a keen observer will notice that the first few digits of the ciphertext actually remain the same. This header information indicates which key version was used so that the CT-V knows how to decrypt the data.