blob: 5d90ae7d0420b4a5f37cf98c73e3e934a448f860 [file] [log] [blame]
Davide Pesavento933a5672020-07-03 22:32:43 -04001SafeBag Format for Exported Credentials
2=======================================
Yingdi Yu55ea01a2015-07-21 22:42:17 -07003
Davide Pesavento576c21b2022-11-29 20:00:22 -05004Sometimes it may be necessary to export an identity's credentials (i.e., private key and associated
5certificate) from one machine and import them into another. This requires a secure container to
6carry the sensitive information. For this purpose, we define the **SafeBag** format, which contains
Davide Pesavento02ed3322023-02-23 19:40:22 -05007an `NDN certificate <https://docs.named-data.net/NDN-packet-spec/0.3/certificate.html>`__ and the
Davide Pesavento576c21b2022-11-29 20:00:22 -05008corresponding private key in encrypted form. The private key is formatted as a DER-encoded
9:rfc:`EncryptedPrivateKeyInfo <5208#section-6>` structure as described in PKCS #8.
Yingdi Yu55ea01a2015-07-21 22:42:17 -070010
Davide Pesavento576c21b2022-11-29 20:00:22 -050011The TLV encoding of ``SafeBag`` is defined as follows:
Yingdi Yu55ea01a2015-07-21 22:42:17 -070012
Davide Pesavento933a5672020-07-03 22:32:43 -040013.. code-block:: abnf
Yingdi Yu55ea01a2015-07-21 22:42:17 -070014
Junxiao Shi9a04dda2019-07-02 15:18:20 +000015 SafeBag = SAFE-BAG-TYPE TLV-LENGTH
Davide Pesavento93101df2021-06-15 18:33:09 -040016 Certificate
17 EncryptedKey
Junxiao Shi9a04dda2019-07-02 15:18:20 +000018
Davide Pesavento93101df2021-06-15 18:33:09 -040019 EncryptedKey = ENCRYPTED-KEY-TYPE TLV-LENGTH
20 *OCTET ; PKCS #8 EncryptedPrivateKeyInfo
Yingdi Yu55ea01a2015-07-21 22:42:17 -070021
Davide Pesaventocad94b02021-04-09 21:23:03 -040022+---------------------------------------------+------------------+-----------------+
23| Type | Assigned number | Assigned number |
24| | (decimal) | (hexadecimal) |
25+=============================================+==================+=================+
26| SafeBag | 128 | 0x80 |
27+---------------------------------------------+------------------+-----------------+
Davide Pesavento93101df2021-06-15 18:33:09 -040028| EncryptedKey | 129 | 0x81 |
Davide Pesaventocad94b02021-04-09 21:23:03 -040029+---------------------------------------------+------------------+-----------------+