Protecting keys using a TPM

Nikos Mavrogiannopoulos n.mavrogiannopoulos at gmail.com
Fri Mar 8 01:14:14 PST 2013


On Thu, Mar 7, 2013 at 7:44 PM, Ross McIlroy <rmcilroy at google.com> wrote:
> Hi,
> I'm currently looking into improving the end-to-end support for storing and
> accessing private keys / certificates on TPM devices on Linux.  At present
> it is possible to use OpenCryptoKI to provide a PKCS#11 interface to the
> TPM, however, there are a number of issues which make doing so inconvenient:
>    - (i) Applications need to be configured to explicitly dlopen the
> OpenCryptoKI pcsk11 module library
>    - (ii) They need to discover which slot holds the TPM token (if any)
>    - (iii) They need to provide a pin to OpenCryptoKI to login to the TPM
> token to perform any operations (e.g., signing, encryption, etc.) with the
> private keys stored there or to add new keys.  Since this pin is not linked
> to the users login credentials, it's an added complication for them, as well
> as an added complication for developers who need to provide some gui /
> command-line pin input mechanism.

I was looking at the same issue a while ago. The OpenCryptoKI TPM-PKCS
#11 module was so hard to setup for that didn't seem like a solution
one could suggest to its users. I gave up and made a special type of
URI, "tpmkey". It is simple and directly maps into TPM expected
properties. This key type is now supported by gnutls 3.1.x.

> p11-kit seems a good place to start to address (i) - if p11-kit becomes the
> standard for merging the system-wide pkcs11 modules, then apps only need to
> load a single well-known module to have access to all the keys provided,
> including those on the TPM.

That would be good actually, and this was my initial approach, but the issue is:
1. it will not be portable, it will depend on opencryptoki and its
internals (which are complex as hell)
2. as you mention you'll need some hierarchy of the TPM keys somewhere
in the FS. You could not save a key on a usb disk for example.
3. the SRK - normal PIN issue you mention.

> Being new to gnome-keyring / p11-kit / PKCS#11 I'm not sure if these are
> sensible ideas, but please let me know your thoughts.

I think it is more sensible to avoid using the PKCS #11 API to access
TPM keys. While I thought the benefits would exceed any issues, I
changed my mind after working few days with the opencryptoki tpm
pkcs11 module.

Moreover p11-kit cannot provide much to a tpm key, since the TSS API
does not have the issues of PKCS #11...

regards,
Nikos


More information about the p11-glue mailing list