Package: nrfcredstore
nrfcredstorenrfcredstore is a command line tool that simplifies managing credentials stored in Nordic Semiconductor modems, like thenRF9160. The typical use case of nrfcredstore is to automate the provisioning of cloud certificates that are stored securely in the modem.InstallRun the following command to use this package as a dependency:pip3 install nrfcredstoreRequirementsFor the device to respond to AT commands, the firmware on the device must have at_client enabled. This can be done by settingCONFIG_AT_HOST_LIBRARY=y. ThenRF9160: AT Client samplecan also be used, and thenRF9160 DK application and modem firmwaredownload contains a pre-built firmware.Command Line Interfaceusage: 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 keylist subcommandList 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         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXwrite subcommandWrite 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 FILENAMEexample$ nrfcredstore /dev/tty.usbmodem0009600000001 write 123 ROOT_CA_CERT root-ca.pemdelete subcommandDelete value from a secure tag.usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev delete SECURE_TAG KEY_TYPEexample$ nrfcredstore /dev/tty.usbmodem0009600000001 delete 123 ROOT_CA_CERTgenerate 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 FILENAMEexample$ nrfcredstore /dev/tty.usbmodem0009600000001 generate 123 device_cert.der

# Convert DER to CSR
$ openssl req -pubkey -in device_cert.der -inform DER > device_cert.csrDevelopment installationFor development mode, you needpoetry:curl -sSL https://install.python-poetry.org | python3 -Install package dependencies, development dependencies, and the nrfcredstore itself into poetry's internal virtual environment:poetry installTestRunning the tests depends on adevelopment installation.poetry run pytestCheck coveragepoetry run pytest --cov=. tests