Skip to content


Security 2020


Android and Chromebooks

Configuration guides

Roots of Trust

Secure Boot


yubico-piv-tool -s 9c -a generate -o pubkey.pem # will take a while and overwrite any existing private keys
yubico-piv-tool -s 9c -a verify-pin -a selfsign-certificate -S '/OU=test/' -i pubkey.pem -o cert.pem
yubico-piv-tool -s 9c -a import-certificate -i cert.pem
openssl x509 -outform der -in cert.pem -out cert.crt
openssl x509 -in cert.pem -text -noout # display the contents of the PEM file

The DER format cert.crt is suitable for installing in the UEFI PK/KEK/DB. The cert.pem will be used for sbsign to make valid EFI images. This is not the same as the one used to sign kernel modules, which is generated at build time.

The sbsign tool needs to be built from source to have support for the smart card signing.

sudo apt install libbfd-dev gnu-efi help2man libengine-pkcs11-openssl1.1
git clone
cd sbsigntools
make -j8

Although this has trouble with pkcs11 keys in the yubikey. It seems that they have to be specified in a weird format:

./src/sbsign \
      --engine pkcs11 \
      --key 'pkcs11:manufacturer=piv_II;id=%02' \
      --cert ../boot/cert.pem \
      --output bzImage.signed \

Testing secure boot

Build UEFI firmware for qemu with secure boot enabled:

git clone --recursive
cd edk2/OvmfPkg

Test it with:

qemu-system-x86_64 \
      -pflash ../Build/OvmfX64/DEBUG_GCC5/FV/OVMF_CODE.fd \
      -pflash ../Build/OvmfX64/DEBUG_GCC5/FV/OVMF_VARS.fd \
      -serial stdio \
      -drive fat:ro:/boot

You can hit Escape while it is booting to go to the setup screen and select the EFI shell.


  • enrolling keys works (same key for pk, kek and db; need to try hierarchical keys)
  • signing bzimage works
  • uefi secure boot does not validate signatures on separate initrd, have to bundle it into the bzimage
  • not sure yet about kernel command line parameters
  • have to enable lockdown, etc for proper protection
  • kvm in initrd works, need to figure out pcie pass through
  • module signing: should it use the same key? can be specified with

Last update: November 8, 2020