Skip to main content

Manage credentials stored in Nordic Semiconductor modems.

Project description

nrfcredstore

nrfcredstore is a command line tool that simplifies managing credentials stored in Nordic Semiconductor modems, like the nRF9151. The typical use case of nrfcredstore is to automate the provisioning of cloud certificates that are stored securely in the modem.

Install

Run the following command to use this package as a dependency:

pip3 install nrfcredstore

Requirements

The device must be able to respond to AT commands. The Cellular: AT Client sample can be used, and the nRF9151 DK application and modem firmware download contains a pre-built firmware.

Command Line Interface

usage: nrfcredstore [-h] [--baudrate BAUDRATE] [--timeout TIMEOUT] [--debug] [--cmd-type {at,shell,auto}]
                    dev {list,write,delete,deleteall,imei,attoken,generate} ...

Manage certificates stored in a cellular modem.

positional arguments:
  dev                   Device used to communicate with the modem. For interactive selection of serial port, use "auto". For RTT, use "rtt". If given a SEGGER
                        serial number, it is assumed to be an RTT device.

options:
  -h, --help            show this help message and exit
  --baudrate BAUDRATE   Serial baudrate
  --timeout TIMEOUT     Serial communication timeout in seconds
  --debug               Enable debug logging
  --cmd-type {at,shell,auto}
                        Command type to use. "at" for AT commands, "shell" for shell commands, "auto" to detect automatically.

subcommands:
  {list,write,delete,deleteall,imei,attoken,generate}
                        Certificate related commands
    list                List all keys stored in the modem
    write               Write key/cert to a secure tag
    delete              Delete value from a secure tag
    deleteall           Delete all keys in a secure tag
    imei                Get IMEI from the modem
    attoken             Get attestation token of the modem
    generate            Generate private key

list subcommand

List keys stored in the modem.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev list [--tag SECURE_TAG [--type KEY_TYPE]]

example

$ nrfcredstore /dev/tty.usbmodem0009600000001 list --tag 123
Secure tag   Key type           SHA
123          ROOT_CA_CERT       XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
123          CLIENT_CERT        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
123          CLIENT_KEY         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

write subcommand

Write key/cert to a security tag. KEY_TYPE must be either ROOT_CA_CERT, CLIENT_CERT, CLIENT_KEY, or PSK.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev write SECURE_TAG KEY_TYPE FILENAME

example

$ nrfcredstore /dev/tty.usbmodem0009600000001 write 123 ROOT_CA_CERT root-ca.pem

delete subcommand

Delete value from a security tag.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev delete SECURE_TAG KEY_TYPE

example

$ nrfcredstore /dev/tty.usbmodem0009600000001 delete 123 ROOT_CA_CERT

deletall subcommand

Delete all writable security tags.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev deleteall

imei subcommand

Read IMEI from modem.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev imei

attoken subcommand

Read Attestation Token from modem.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev attoken

generate subcommand

[!IMPORTANT] This command requires modem firmware version greater than or equal to 1.3.0.

Generate a private key in the modem and output a certificate signing request.

usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev generate SECURE_TAG FILENAME

example

$ nrfcredstore /dev/tty.usbmodem0009600000001 generate 123 device_cert.der

# Convert DER to CSR
$ openssl req -pubkey -in device_cert.der -inform DER > device_cert.csr

Development installation

For development mode, you need poetry:

curl -sSL https://install.python-poetry.org | python3 -

Install package dependencies, development dependencies, and the nrfcredstore itself into poetry's internal virtual environment:

poetry install

Test

Running the tests depends on a development installation.

poetry run pytest

Check coverage

poetry run pytest --cov=src tests --cov-report=html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nrfcredstore-2.0.4.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nrfcredstore-2.0.4-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file nrfcredstore-2.0.4.tar.gz.

File metadata

  • Download URL: nrfcredstore-2.0.4.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.13.9 Linux/6.11.0-1018-azure

File hashes

Hashes for nrfcredstore-2.0.4.tar.gz
Algorithm Hash digest
SHA256 059fb5c22a621e88d7c70f13133364bb34c825ae5ba4e7eaf11df61990c62d7b
MD5 2124903a7d106ba5f7dff80cf4a15064
BLAKE2b-256 314cbf4b08a6b439e17f7eb5c727123e4bc680e10abc97040481fe5e9b21d20e

See more details on using hashes here.

File details

Details for the file nrfcredstore-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: nrfcredstore-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.13.9 Linux/6.11.0-1018-azure

File hashes

Hashes for nrfcredstore-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8d7ff842c3db2650b7993de9c12a528d7bfc4f2bc2cee9cc1b8bec90a7070504
MD5 152590f05dadd4a203285530bbf4a232
BLAKE2b-256 51e38b4b9b8579ea0c3c1e42247258419ae539c95d4288c9ab6a2deb43c513aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page