Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 1 | SafeBag Format for Exported Credentials |
| 2 | ======================================= |
Yingdi Yu | 55ea01a | 2015-07-21 22:42:17 -0700 | [diff] [blame] | 3 | |
Davide Pesavento | 93101df | 2021-06-15 18:33:09 -0400 | [diff] [blame] | 4 | Sometimes it may be necessary to export an identity's credentials (i.e., private key and |
| 5 | associated certificate) from one machine and import them into another. This requires a |
| 6 | secure container to carry the sensitive information. We define **SafeBag**, which contains |
| 7 | an :doc:`NDN certificate </specs/certificate>` and the corresponding private key in encrypted |
| 8 | form. The private key is formatted as a DER-encoded |
| 9 | `EncryptedPrivateKeyInfo <https://datatracker.ietf.org/doc/html/rfc5208#section-6>`__ |
| 10 | structure as described in PKCS #8. |
Yingdi Yu | 55ea01a | 2015-07-21 22:42:17 -0700 | [diff] [blame] | 11 | |
Davide Pesavento | 93101df | 2021-06-15 18:33:09 -0400 | [diff] [blame] | 12 | The TLV-based format of ``SafeBag`` is defined as follows: |
Yingdi Yu | 55ea01a | 2015-07-21 22:42:17 -0700 | [diff] [blame] | 13 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame] | 14 | .. code-block:: abnf |
Yingdi Yu | 55ea01a | 2015-07-21 22:42:17 -0700 | [diff] [blame] | 15 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 16 | SafeBag = SAFE-BAG-TYPE TLV-LENGTH |
Davide Pesavento | 93101df | 2021-06-15 18:33:09 -0400 | [diff] [blame] | 17 | Certificate |
| 18 | EncryptedKey |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 19 | |
Davide Pesavento | 93101df | 2021-06-15 18:33:09 -0400 | [diff] [blame] | 20 | EncryptedKey = ENCRYPTED-KEY-TYPE TLV-LENGTH |
| 21 | *OCTET ; PKCS #8 EncryptedPrivateKeyInfo |
Yingdi Yu | 55ea01a | 2015-07-21 22:42:17 -0700 | [diff] [blame] | 22 | |
Davide Pesavento | cad94b0 | 2021-04-09 21:23:03 -0400 | [diff] [blame] | 23 | +---------------------------------------------+------------------+-----------------+ |
| 24 | | Type | Assigned number | Assigned number | |
| 25 | | | (decimal) | (hexadecimal) | |
| 26 | +=============================================+==================+=================+ |
| 27 | | SafeBag | 128 | 0x80 | |
| 28 | +---------------------------------------------+------------------+-----------------+ |
Davide Pesavento | 93101df | 2021-06-15 18:33:09 -0400 | [diff] [blame] | 29 | | EncryptedKey | 129 | 0x81 | |
Davide Pesavento | cad94b0 | 2021-04-09 21:23:03 -0400 | [diff] [blame] | 30 | +---------------------------------------------+------------------+-----------------+ |