blob: bb706f37d14b038fb030319ad950a99bcf48375c [file] [log] [blame]
Alexander Afanasyev6e64ac92018-06-14 17:25:38 -04001NAC Specification
2=================
3
Alexander Afanasyeve96538a2018-06-13 20:32:53 -04004.. figure:: _static/nac-overview.png
5 :alt: Overview of NAC entities
6 :align: center
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -04007
8Terminology
9-----------
10
11+-----------------+------------------------------------------------------------------------------------------+
12| Term | Description |
13+=================+==========================================================================================+
14| KEK | Key Encryption Key (RSA public key) |
15+-----------------+------------------------------------------------------------------------------------------+
16| KDK | Key Decryption Key (RSA private key) |
17+-----------------+------------------------------------------------------------------------------------------+
18| CK | Content Key (AES symmetric key) |
19+-----------------+------------------------------------------------------------------------------------------+
Alexander Afanasyev1a21e102018-06-13 20:33:21 -040020| CK data | Data packet carrying a KDK-encrypted CK as payload |
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -040021+-----------------+------------------------------------------------------------------------------------------+
22| Access Manager | (Data Owner) Entity that control access to the data associated with the namespace |
23+-----------------+------------------------------------------------------------------------------------------+
24| Encryptor | (Producer) Entity that encrypts data based on namespace association |
25+-----------------+------------------------------------------------------------------------------------------+
26| Decryptor | (Consumer) Entity that decrypts data based on namespace association |
27+-----------------+------------------------------------------------------------------------------------------+
28
29EncryptedContent
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040030----------------
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -040031
Junxiao Shidddc19a2020-08-10 13:13:06 -060032The ``EncryptedContent`` element contains encrypted blob, optional Initialization Vector (for AES CBC encryption),
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -040033optional EncryptedPayloadKey, and Name elements.
34
Junxiao Shidddc19a2020-08-10 13:13:06 -060035.. code-block:: abnf
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -040036
Junxiao Shidddc19a2020-08-10 13:13:06 -060037 EncryptedContent = ENCRYPTED-CONTENT-TYPE TLV-LENGTH
38 EncryptedPayload
39 [InitializationVector]
40 [EncryptedPayloadKey]
41 [Name]
Alexander Afanasyev0db0feb2018-06-13 20:33:10 -040042
Junxiao Shidddc19a2020-08-10 13:13:06 -060043 EncryptedPayload = ENCRYPTED-PAYLOAD-TYPE TLV-LENGTH *OCTET
44 InitializationVector = INITIALIZATION-VECTOR-TYPE TLV-LENGTH *OCTET
45 EncryptedPayloadKey = ENCRYPTED-PAYLOAD-KEY-TYPE TLV-LENGTH *OCTET
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040046
47
48Access Manager
49--------------
50
51.. figure:: _static/access-manager.png
52 :alt: Access Manager
53 :align: center
54
Alexander Afanasyev1a21e102018-06-13 20:33:21 -040055Access Manager controls decryption policy by publishing granular per-namespace access policies in the form of key encryption (KEK, plaintext public) and key decryption (KDK, encrypted private key) key pair.
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040056
57KEK is published as a single data packet with name ``/[access-namespace]/NAC/[dataset]/KEK/[key-id]``, following the following format:
58
Junxiao Shidddc19a2020-08-10 13:13:06 -060059.. code-block:: abnf
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040060
Junxiao Shidddc19a2020-08-10 13:13:06 -060061 Kek = DATA-TYPE TLV-LENGTH
Davide Pesavento3c7f6452021-10-02 04:06:26 -040062 Name ; /[access-namespace]/NAC/[dataset]/KEK/[key-id]
Junxiao Shidddc19a2020-08-10 13:13:06 -060063 MetaInfo ; ContentType = KEY, FreshnessPeriod = 1 hour default value
64 KekContent
65 DataSignature
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040066
Junxiao Shidddc19a2020-08-10 13:13:06 -060067 KekContent = CONTENT-TYPE-TLV TLV-LENGTH
68 *OCTET ; = BER of public key /[access-namespace]/NAC/[dataset]/KEY/[key-id]
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040069
70
71Different versions of KDK are published, encrypted by the public key of the individual authorized member, following naming convention: ``/[access-namespace]/NAC/[dataset]/KDK/[key-id]/ENCRYPTED-BY/<authorized-member>/KEY/[member-key-id]``. KDK is published in the following format:
72
Junxiao Shidddc19a2020-08-10 13:13:06 -060073.. code-block:: abnf
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040074
Junxiao Shidddc19a2020-08-10 13:13:06 -060075 Kdk = DATA-TYPE TLV-LENGTH
Davide Pesavento3c7f6452021-10-02 04:06:26 -040076 Name ; /[access-namespace]/NAC/[dataset]/KDK/[key-id]/ENCRYPTED-BY/<authorized-member>/KEY/[member-key-id]
Junxiao Shidddc19a2020-08-10 13:13:06 -060077 MetaInfo ; ContentType = BLOB, FreshnessPeriod = 1 hour default value
78 KdkContent
79 DataSignature
Alexander Afanasyeve96538a2018-06-13 20:32:53 -040080
Junxiao Shidddc19a2020-08-10 13:13:06 -060081 KdkContent = CONTENT-TYPE-TLV TLV-LENGTH
82 EncryptedContent
83
84Within the ``EncryptedContent`` element,
85
Davide Pesavento3c7f6452021-10-02 04:06:26 -040086* ``EncryptedPayload`` contains `SafeBag <https://named-data.net/doc/ndn-cxx/0.7.1/specs/safe-bag.html>`__ of private key ``/[access-namespace]/NAC/[dataset]/KEY/[key-id]``
Junxiao Shidddc19a2020-08-10 13:13:06 -060087* ``EncryptedPayloadKey`` contains password for SafeBag, encrypted by public key ``/<authorized-member>/KEY/[member-key-id]``
88* ``InitializationVector`` and ``Name`` must be omitted
Alexander Afanasyev1a21e102018-06-13 20:33:21 -040089
90Encryptor
91---------
92
93.. figure:: _static/encryptor.png
94 :alt: Encryptor
95 :align: center
96
97Encryptor encrypts (synchronous operation) the requested content and returns an ``EncryptedContent`` element with values:
98
99::
100
101 EncryptedPayload = AES CBC encrypted blob
Junxiao Shidddc19a2020-08-10 13:13:06 -0600102 InitializationVector = Random initial vector for AES CBC encryption
Davide Pesavento3c7f6452021-10-02 04:06:26 -0400103 EncryptedPayloadKey (not set)
Junxiao Shidddc19a2020-08-10 13:13:06 -0600104 Name = Prefix of ContentKey (CK) data packet /[ck-prefix]/CK/[ck-id]
Alexander Afanasyev1a21e102018-06-13 20:33:21 -0400105
106During initialization or when requested by the application, the Encryptor (re-)generates a random key for AES CBC encryption.
107The encrypted version of this key is published (asynchronous operation, contingent on successful retrieval and validation of KEK) as a data packet, following the naming convention: ``/[ck-prefix]/CK/[ck-id]/ENCRYPTED-BY/[access-namespace]/NAC/[dataset]/KEK/[key-id]``. CK data is published in the following format:
108
Junxiao Shidddc19a2020-08-10 13:13:06 -0600109.. code-block:: abnf
Alexander Afanasyev1a21e102018-06-13 20:33:21 -0400110
Junxiao Shidddc19a2020-08-10 13:13:06 -0600111 CkData = DATA-TYPE TLV-LENGTH
Davide Pesavento3c7f6452021-10-02 04:06:26 -0400112 Name ; /[ck-prefix]/CK/[ck-id]/ENCRYPTED-BY/[access-namespace]/NAC/[dataset]/KEK/[key-id]
Junxiao Shidddc19a2020-08-10 13:13:06 -0600113 MetaInfo ; ContentType = BLOB, FreshnessPeriod = 1 hour default value
114 CkContent
115 DataSignature
Alexander Afanasyev1a21e102018-06-13 20:33:21 -0400116
Junxiao Shidddc19a2020-08-10 13:13:06 -0600117 CkContent = CONTENT-TYPE-TLV TLV-LENGTH
118 EncryptedContent
119
120Within the ``EncryptedContent`` element,
121
122* ``EncryptedPayload`` contains ContentKey encrypted by public key ``/[access-namespace]/NAC/[dataset]/KEK/[key-id]``
123* ``EncryptedPayloadKey``, ``InitializationVector``, and ``Name`` must be omitted
124
Alexander Afanasyevff3ee9f2018-06-13 20:33:30 -0400125
126Decryptor
127---------
128
129.. figure:: _static/decryptor.png
130 :alt: Decryptor
131 :align: center
132
133Encryptor decrypts (asynchronous operation, contingent on successful retrieval of CK data, KDK, and decryption of both) the supplied ``EncryptedContent`` element.
Junxiao Shidddc19a2020-08-10 13:13:06 -0600134
135TLV-TYPE number assignments
136---------------------------
137
138+---------------------------------------------+------------------+-----------------+
139| Type | Assigned number | Assigned number |
140| | (decimal) | (hexadecimal) |
141+=============================================+==================+=================+
142| EncryptedContent | 130 | 0x82 |
143+---------------------------------------------+------------------+-----------------+
144| EncryptedPayload | 132 | 0x84 |
145+---------------------------------------------+------------------+-----------------+
146| InitializationVector | 133 | 0x85 |
147+---------------------------------------------+------------------+-----------------+
148| EncryptedPayloadKey | 134 | 0x86 |
149+---------------------------------------------+------------------+-----------------+