Instantiate key with user-provided decrypted data.
Subsystems (5)
PATCH v2 1/1 Instantiate key with user-provided decrypted data.
The encrypted.c class supports instantiation of encrypted keys with either an already-encrypted key material, or by generating new key material based on random numbers. To support encryption of user-provided decrypted data, this patch defines a new datablob
format: [<format>] <master-key name> <decrypted data length> <decrypted data>.
---
Notes:
v -> v2: fixed compilation error.
.../security/keys/trusted-encrypted.rst | 25 ++++++-- security/keys/encrypted-keys/encrypted.c | 61 +++++++++++++------ 2 files changed, 62 insertions(+), 24 deletions(-)
Documentation/security/keys/trusted-encrypted.rst +19 -6
@@ -107,12 +107,13 @@ Encrypted Keys -------------- Encrypted keys do not depend on a trust source, and are faster, as they use AES -for encryption/decryption. New keys are created from kernel-generated random -numbers, and are encrypted/decrypted using a specified ‘master’ key. The -‘master’ key can either be a trusted-key or user-key type. The main disadvantage -of encrypted keys is that if they are not rooted in a trusted key, they are only -as secure as the user key encrypting them. The master user key should therefore -be loaded in as secure a way as possible, preferably early in boot. +for encryption/decryption. New keys are created either from kernel-generated +random numbers or user-provided decrypted data, and are encrypted/decrypted +using a specified ‘master’ key. The ‘master’ key can either be a trusted-key or +user-key type. The main disadvantage of encrypted keys is that if they are not +rooted in a trusted key, they are only as secure as the user key encrypting +them. The master user key should therefore be loaded in as secure a way as +possible, preferably early in boot. Usage
@@ -199,6 +200,8 @@ Usage:: keyctl add encrypted name "new [format] key-type:master-key-name keylen" ring + keyctl add encrypted name "new [format] key-type:master-key-name keylen + decrypted-data" ring keyctl add encrypted name "load hex_blob" ring keyctl update keyid "update key-type:master-key-name"
@@ -303,6 +306,16 @@ Load an encrypted key "evm" from saved blob:: 82dbbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0 24717c64 5972dcb82ab2dde83376d82b2e3c09ffc +Instantiate an encrypted key "evm" using user-provided decrypted data:: + + $ keyctl add encrypted evm "new default user:kmk 32 `cat evm.blob`" @u + 794890253 + + $ keyctl print 794890253 + default user:kmk 32 2375725ad57798846a9bbd240de8906f006e66c03af53b1b382d + bbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0247 + 17c64 5972dcb82ab2dde83376d82b2e3c09ffc + Other uses for trusted and encrypted keys, such as for disk and file encryption are anticipated. In particular the new format 'ecryptfs' has been defined in order to use encrypted keys to mount an eCryptfs filesystem. More details
security/keys/encrypted-keys/encrypted.c +43 -18
153 lines not on this page · raw message
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
Hi Yael,
Quoted 8 lines · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys with either an already-encrypted key material, or by generating new key material based on random numbers. To support encryption of user-provided decrypted data, this patch defines a new datablob
format: [<format>] <master-key name> <decrypted data length> <decrypted data>.Signed-off-by Yael Tiomkin <[email protected]>
Other than the comment below,
Could you also provide an LTP test for defining, exporting, and loading an encrypted key based on user provided key data?
thanks,
Mimi
Documentation/security/keys/trusted-encrypted.rst Load an encrypted key "evm" from saved blob:: · line 312
Quoted 10 lines
---
Documentation/security/keys/trusted-encrypted.rst +4
-0@@ -303,6 +306,16 @@ Load an encrypted key "evm" from saved blob:: 82dbbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0 24717c64 5972dcb82ab2dde83376d82b2e3c09ffc +Instantiate an encrypted key "evm" using user-provided decrypted data:: + + $ keyctl add encrypted evm "new default user:kmk 32 `cat evm.blob`" @u + 794890253
The existing references to "evm.blob" refer to the encrypted key data. Here "evm.blob" is unencrypted data. Perhaps name it something like "evm.user-provided-data" data.
Quoted 6 lines
Documentation/security/keys/trusted-encrypted.rst +6
-0+ + $ keyctl print 794890253 + default user:kmk 32 2375725ad57798846a9bbd240de8906f006e66c03af53b1b382d + bbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0247 + 17c64 5972dcb82ab2dde83376d82b2e3c09ffc +
Quoted 38 lines · Mimi Zohar
Hi Yael,
Quoted 8 lines · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys with either an already-encrypted key material, or by generating new key material based on random numbers. To support encryption of user-provided decrypted data, this patch defines a new datablob
format: [<format>] <master-key name> <decrypted data length> <decrypted data>.Signed-off-by Yael Tiomkin <[email protected]>Other than the comment below,
Reviewed-by Mimi Zohar <[email protected]>Could you also provide an LTP test for defining, exporting, and loading an encrypted key based on user provided key data?
thanks,
Mimi
Documentation/security/keys/trusted-encrypted.rst Load an encrypted key "evm" from saved blob:: · line 312
Quoted 10 lines
---
Documentation/security/keys/trusted-encrypted.rst +4
-0@@ -303,6 +306,16 @@ Load an encrypted key "evm" from saved blob:: 82dbbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0 24717c64 5972dcb82ab2dde83376d82b2e3c09ffc +Instantiate an encrypted key "evm" using user-provided decrypted data:: + + $ keyctl add encrypted evm "new default user:kmk 32 `cat evm.blob`" @u + 794890253The existing references to "evm.blob" refer to the encrypted key data. Here "evm.blob" is unencrypted data. Perhaps name it something like "evm.user-provided-data" data.
Quoted 7 lines
Documentation/security/keys/trusted-encrypted.rst Load an encrypted key "evm" from saved blob:: · line 318
Quoted 6 lines
Documentation/security/keys/trusted-encrypted.rst +6
-0+ + $ keyctl print 794890253 + default user:kmk 32 2375725ad57798846a9bbd240de8906f006e66c03af53b1b382d + bbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0247 + 17c64 5972dcb82ab2dde83376d82b2e3c09ffc +
Hi Mimi,
I have posted the ltp test:
https://lore.kernel.org/all/[email protected]/
I will update the documentation per your suggestion.
Thanks,
Yael
Mimi Zohar
maintainerQuoted 47 lines · Yael Tiomkin
Quoted 38 lines · Mimi Zohar
Hi Yael,
Quoted 8 lines · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys with either an already-encrypted key material, or by generating new key material based on random numbers. To support encryption of user-provided decrypted data, this patch defines a new datablob
format: [<format>] <master-key name> <decrypted data length> <decrypted data>.Signed-off-by Yael Tiomkin <[email protected]>Other than the comment below,
Reviewed-by Mimi Zohar <[email protected]>Could you also provide an LTP test for defining, exporting, and loading an encrypted key based on user provided key data?
thanks,
Mimi
Documentation/security/keys/trusted-encrypted.rst Load an encrypted key "evm" from saved blob:: · line 312
Quoted 10 lines
---
Documentation/security/keys/trusted-encrypted.rst +4
-0@@ -303,6 +306,16 @@ Load an encrypted key "evm" from saved blob:: 82dbbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0 24717c64 5972dcb82ab2dde83376d82b2e3c09ffc +Instantiate an encrypted key "evm" using user-provided decrypted data:: + + $ keyctl add encrypted evm "new default user:kmk 32 `cat evm.blob`" @u + 794890253The existing references to "evm.blob" refer to the encrypted key data. Here "evm.blob" is unencrypted data. Perhaps name it something like "evm.user-provided-data" data.
Quoted 7 lines
Documentation/security/keys/trusted-encrypted.rst Load an encrypted key "evm" from saved blob:: · line 318
Quoted 6 lines
Documentation/security/keys/trusted-encrypted.rst +6
-0+ + $ keyctl print 794890253 + default user:kmk 32 2375725ad57798846a9bbd240de8906f006e66c03af53b1b382d + bbc55be2a44616e4959430436dc4f2a7a9659aa60bb4652aeb2120f149ed197c564e0247 + 17c64 5972dcb82ab2dde83376d82b2e3c09ffc +
Quoted 6 lines
Hi Mimi,
I have posted the ltp test:
https://lore.kernel.org/all/[email protected]/I will update the documentation per your suggestion.
Please also prefix the patch title (Subject line) with "KEYS:
encrypted:" and remove the trailing period.
thanks,
Mimi
Jarkko Sakkinen
maintainerQuoted 1 line · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys with
What is "the encrypted.c class"?
/Jarkko
Jarkko Sakkinen
maintainerQuoted 4 lines · Jarkko Sakkinen
Quoted 1 line · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys withWhat is "the
encrypted.cclass"?
[I'm offw work up until end of the year. That's the reason for some latency
in responses.]
/Jarkko
Mimi Zohar
maintainerQuoted 4 lines · Jarkko Sakkinen
Quoted 1 line · Yael Tiomkin
The
encrypted.cclass supports instantiation of encrypted keys withWhat is "the
encrypted.cclass"?
This is the other key type as described in Documentation/security/keys/trusted-encrypted.rst, which is not dependent on a TPM. This patch adds support for userspace provided key data, when the key is created.
thanks,
Mimi