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 nRF9160. 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

For the device to respond to AT commands, the firmware on the device must have at_client enabled. This can be done by setting CONFIG_AT_HOST_LIBRARY=y. The nRF9160: AT Client sample can also be used, and the nRF9160 DK application and modem firmware download contains a pre-built firmware.

Command Line Interface

usage: nrfcredstore [-h] [--baudrate BAUDRATE] [--timeout TIMEOUT] dev {list,write,delete,generate} ...

Manage certificates stored in a cellular modem.

positional arguments:
  dev                   Serial device used to communicate with the modem.

options:
  -h, --help            show this help message and exit
  --baudrate BAUDRATE   Serial baudrate
  --timeout TIMEOUT     Serial communication timeout in seconds

subcommands:
  {list,write,delete,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
    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 secure 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 secure tag.

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

example

$ nrfcredstore /dev/tty.usbmodem0009600000001 delete 123 ROOT_CA_CERT

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=. tests

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-1.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

nrfcredstore-1.1.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nrfcredstore-1.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.9 Linux/6.5.0-1022-azure

File hashes

Hashes for nrfcredstore-1.1.1.tar.gz
Algorithm Hash digest
SHA256 212c21fdcf1869078eb3a1da92a52d1be9110cee54d5c238a294c65740662a24
MD5 33bf7b935f777e8f81c7853e6865dc4e
BLAKE2b-256 85211af88126569679c6ff0ec6bccc86ed67f5b5ed034f202c54eaf3c7f9a5ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nrfcredstore-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.9 Linux/6.5.0-1022-azure

File hashes

Hashes for nrfcredstore-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a8f9ce86510ab0303ba2ca04e3939f9d24b080d872702dc11f54636ed8de9d5
MD5 cea61cb641c1b628cb3cecba240d6bc5
BLAKE2b-256 f6ce9f6e6bb0e91c280d29e72d3db719650d3505c525f0c219ce2544b9a9c8b1

See more details on using hashes here.

Supported by

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