Skip to contentSkip to conversation

Recommended way to encrypt a credential

tpm2 Tim K 2 participants 4 messages Jul 16, 2022 – Jul 19, 2022

lore
Share & tools
lore

Tim K

author
#0 lore raw

Let's assume I have a credential for some other remote system that I'd like to store somewhat protected so it can be used in a cron job. What is the recommended way? I see a few possibilities:

1. Create a primary key, an encryption key and seal the credential (it's small, less than 128 bytes)
2. Use an encryption key to encrypt something like a GPG passphrase (or maybe the GPG private key without a passphrase) and then gpg-encrypt a file that holds my credential
3. Use tpm2_encryptdecrypt which looks like some form of simplifying #2 above and may also work with files that may slightly exceed 128 bytes
4. Just store the credential directly at an NV index

Thanks!

#1 lore raw
Quoted 4 lines · Tim K

Let's assume I have a credential for some other remote system that I'd like to store somewhat protected so it can be used in a cron job. What is the recommended way? I see a few possibilities:

Quoted 9 lines

1. Create a primary key, an encryption key and seal the credential (it's small, less than 128 bytes)
2. Use an encryption key to encrypt something like a GPG passphrase (or maybe the GPG private key without a passphrase) and then gpg- encrypt a file that holds my credential
3. Use tpm2_encryptdecrypt which looks like some form of simplifying #2 above and may also work with files that may slightly exceed 128 bytes
4. Just store the credential directly at an NV index

I would create a seal object, so example 1. As you point out the limitation is size.

Quoted 6 lines

Thanks!
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#3 lore raw

No, all roads lead to Rome. Using gnupg or openssl are great alternatives to using raw tpm commands directly. they often hide some of the complexities of dealing with the TPM as well.
________________________________
From: Tim K <tpm2(a)bitzap.e4ward.com>
Sent: Monday, July 18, 2022 9:44 PM
To: tpm2(a)lists.01.org <tpm2(a)lists.01.org>
Subject: [tpm2] Re: Recommended way to encrypt a credential

For method #3: any benefit to using tpm2_encryptdecrypt vs gpg --symmetric? just more streamlined in a single command?

Looks like newer GPG versions integrate with the TPM
https://gnupg.org/blog/20210315-using-tpm-with-gnupg-2.3.html
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s