clevis-encrypt-tpm2.1.adoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. CLEVIS-ENCRYPT-TPM2(1)
  2. ======================
  3. :doctype: manpage
  4. == NAME
  5. clevis-encrypt-tpm2 - Encrypts using a TPM2.0 chip binding policy
  6. == SYNOPSIS
  7. *clevis encrypt tpm2* CONFIG < PT > JWE
  8. == OVERVIEW
  9. The *clevis encrypt tpm2* command encrypts using a Trusted Platform Module 2.0
  10. (TPM2) chip. Its only argument is the JSON configuration object.
  11. When using the tpm2 pin, we create a new, cryptographically-strong, random key.
  12. This key is encrypted using the TPM2 chip.
  13. Then at decryption time, the key is decrypted again using the TPM2 chip.
  14. $ clevis encrypt tpm2 '{}' < PT > JWE
  15. The pin has reasonable defaults for its configuration, but a different hierarchy,
  16. hash, and key algorithms can be chosen if the defaults used are not suitable:
  17. $ clevis encrypt tpm2 '{"hash":"sha1","key":"rsa"}' < PT > JWE
  18. To decrypt the data, simply provide the ciphertext (JWE):
  19. $ clevis decrypt < JWE > PT
  20. Note that like other pins no configuration is used for decryption, this is due
  21. clevis storing the public and private keys to unseal the TPM2 encrypted object
  22. in the JWE so clevis can fetch that information from there.
  23. The pin also supports sealing data to a Platform Configuration Registers (PCR)
  24. state. That way the data can only be unsealed if the PCRs hashes values match
  25. the policy used when sealing.
  26. For example, to seal the data to the PCR with index 0 and 1 for the SHA1 bank:
  27. $ clevis encrypt tpm2 '{"pcr_bank":"sha1","pcr_ids":"0,1"}' < PT > JWE
  28. The PCR digest values are looked up from the current hash values for the PCRs,
  29. but a digest can also be provided if the data needs to be sealed with values
  30. different to the current ones, by passing the binary hash encoded in base64:
  31. $ clevis encrypt tpm2 '{"pcr_ids":"0","pcr_digest":"xy7J5svCtqlfM03d1lE5gdoA8MI"}' < PT > JWE
  32. == Threat model
  33. The Clevis security model relies in the fact that an attacker will not be able to
  34. access both the encrypted data and the decryption key.
  35. For most Clevis pins, the decryption key is not locally stored, so the decryption
  36. policy is only satisfied if the decryption key can be remotely accessed. It could
  37. for example be stored in a remote server or in a hardware authentication device
  38. that has to be plugged into the machine.
  39. The tpm2 pin is different in this regard, since a key is wrapped by a TPM2 chip
  40. that is always present in the machine. This does not mean that there are not use
  41. cases for this pin, but it is important to understand the fact that an attacker
  42. that has access to both the encrypted data and the local TPM2 chip will be able
  43. to decrypt the data.
  44. == CONFIG
  45. This command uses the following configuration properties:
  46. * *hash* (string) :
  47. Hash algorithm used in the computation of the object name (default: sha256)
  48. It must be one of the following:
  49. - *sha1*
  50. - *sha256*
  51. - *sha384*
  52. - *sha512*
  53. - *sm3_256*
  54. * *key* (string) :
  55. Algorithm type for the generated key (default: ecc)
  56. It must be one of the following:
  57. - *rsa*
  58. - *keyedhash*
  59. - *ecc*
  60. - *symcipher*
  61. * *pcr_bank* (string) :
  62. PCR algorithm bank to use for policy (default: sha1)
  63. It must be one of the following:
  64. - *sha1*
  65. - *sha256*
  66. * *pcr_ids* (string) :
  67. Comma separated list of PCR used for policy. If not present, no policy is used
  68. * *pcr_digest* (string) :
  69. Binary PCR hashes encoded in base64. If not present, the hash values are looked up
  70. == SEE ALSO
  71. link:clevis-decrypt.1.adoc[*clevis-decrypt*(1)]