Nerves Key#

A NervesKey is a cryptographic hardware module that is configured to work with NervesHub. Its primary responsibility is to secure the private key used for authentication. It can also store useful information such as device serial numbers, board name, and important settings.

Nerves Keyにはデバイス証明書(device certificate)とそのデバイス証明書の署名者証明書(signer certificate / Device CA certificate)を保存します。

../../../_images/nerves_key_atecc508a.png

ATECC508A概要図#

署名者証明書#

署名者証明書は、デバイス証明書に署名するsigner keyの対となるsigner certificate [1] です。 signer keyはデバイスの出自証明の署名に使われるため、デバイスの製造拠点で厳格に保管される必要があり、紛失/盗難への対策が必要です。保管方法はハードウェアセキュリティモジュールを用いる、暗号化して保管する等があります。

製造拠点に一つ必要となる証明書です。

作り方#

Creating a Device CA certificate を参照してください。

デバイス証明書#

出荷するデバイス毎に一つ必要となる証明書です。

作り方#

Provisioning を参照してください。

詳細#

NervesKey.provision はデバイス証明書(メタデータとsigner keyで署名された公開鍵を含む)と秘密鍵を作成します。

秘密鍵と公開鍵は以下の順に関数が呼び出され作成されます。

NervesKey.provision -> NervesKey.Data.genkey -> NervesKey.Data.genkey_raw -> ATECC508A.Request.genkey

  • ATECC508A.Request.genkey はATECC508Aチップのgenkeyコマンド [2] をたたき、秘密鍵と公開鍵を作成させます。秘密鍵はチップに保存され取り出すことはできません。

デバイス証明書は以下の順に関数が呼び出され作成されます。

NervesKey.provision -> ATECC508A.Certificate.new_device -> X509.Certificate.new

回路図#

https://github.com/nerves-hub/nerves_key/blob/f58807c783ac385126400e180356ad3b25f86e4f/hw/assets/TSW19001_NERVESKEY_X1_SCH.PDF

NerveKeyの理解のためにした質問#

https://github.com/nerves-hub/documentation/issues/5

mix nerves_key.signer create command create a signer cert and its key. This signer cert is stored by factory. And this signer cert is self signed cert like root CA. So it is also called Device CA cert.

NervesKey.provision function create a device cert and which is signed by signer key. The device cert and signer cert is stored in NervesKey by the function.