# nrfcredstore
nrfcredstore is a command line tool that simplifies managing credentials stored in Nordic Semiconductor modems, like the [nRF9160](https://www.nordicsemi.com/products/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](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/at_client/README.html) can also be used, and the [nRF9160 DK application and modem firmware](https://www.nordicsemi.com/Products/Development-hardware/nRF9160-DK/Download#infotabs) 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](https://python-poetry.org/):
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](#development-installation).
poetry run pytest
Check coverage
poetry run pytest --cov=src tests --cov-report=html
Raw data
{
"_id": null,
"home_page": "https://github.com/NordicSemiconductor/nrfcredstore",
"name": "nrfcredstore",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Nordic Semiconductor ASA",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b1/13/a97d6b82083f66a040dae1f75be61c56c887988c2b336d6caff65bc4058f/nrfcredstore-2.0.2.tar.gz",
"platform": null,
"description": "# nrfcredstore\n\nnrfcredstore is a command line tool that simplifies managing credentials stored in Nordic Semiconductor modems, like the [nRF9160](https://www.nordicsemi.com/products/nrf9160). The typical use case of nrfcredstore is to automate the provisioning of cloud certificates that are stored securely in the modem.\n\n## Install\n\nRun the following command to use this package as a dependency:\n\n pip3 install nrfcredstore\n\n## Requirements\n\nFor 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](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/at_client/README.html) can also be used, and the [nRF9160 DK application and modem firmware](https://www.nordicsemi.com/Products/Development-hardware/nRF9160-DK/Download#infotabs) download contains a pre-built firmware.\n\n## Command Line Interface\n\n```\nusage: nrfcredstore [-h] [--baudrate BAUDRATE] [--timeout TIMEOUT] [--debug] [--cmd-type {at,shell,auto}]\n dev {list,write,delete,deleteall,imei,attoken,generate} ...\n\nManage certificates stored in a cellular modem.\n\npositional arguments:\n dev Device used to communicate with the modem. For interactive selection of serial port, use \"auto\". For RTT, use \"rtt\". If given a SEGGER\n serial number, it is assumed to be an RTT device.\n\noptions:\n -h, --help show this help message and exit\n --baudrate BAUDRATE Serial baudrate\n --timeout TIMEOUT Serial communication timeout in seconds\n --debug Enable debug logging\n --cmd-type {at,shell,auto}\n Command type to use. \"at\" for AT commands, \"shell\" for shell commands, \"auto\" to detect automatically.\n\nsubcommands:\n {list,write,delete,deleteall,imei,attoken,generate}\n Certificate related commands\n list List all keys stored in the modem\n write Write key/cert to a secure tag\n delete Delete value from a secure tag\n deleteall Delete all keys in a secure tag\n imei Get IMEI from the modem\n attoken Get attestation token of the modem\n generate Generate private key\n```\n\n### list subcommand\n\nList keys stored in the modem.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev list [--tag SECURE_TAG [--type KEY_TYPE]]\n```\n\n#### example\n\n```\n$ nrfcredstore /dev/tty.usbmodem0009600000001 list --tag 123\nSecure tag Key type SHA\n123 ROOT_CA_CERT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n123 CLIENT_CERT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n123 CLIENT_KEY XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n```\n\n### write subcommand\n\nWrite key/cert to a security tag. KEY_TYPE must be either ROOT_CA_CERT, CLIENT_CERT, CLIENT_KEY, or PSK.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev write SECURE_TAG KEY_TYPE FILENAME\n```\n\n#### example\n\n $ nrfcredstore /dev/tty.usbmodem0009600000001 write 123 ROOT_CA_CERT root-ca.pem\n\n### delete subcommand\n\nDelete value from a security tag.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev delete SECURE_TAG KEY_TYPE\n```\n\n#### example\n\n $ nrfcredstore /dev/tty.usbmodem0009600000001 delete 123 ROOT_CA_CERT\n\n### deletall subcommand\n\nDelete all writable security tags.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev deleteall\n```\n\n### imei subcommand\n\nRead IMEI from modem.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev imei\n```\n\n### attoken subcommand\n\nRead Attestation Token from modem.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev attoken\n```\n\n\n### generate subcommand\n\n> [!IMPORTANT]\n> This command requires modem firmware version greater than or equal to 1.3.0.\n\nGenerate a private key in the modem and output a certificate signing request.\n\n```\nusage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev generate SECURE_TAG FILENAME\n```\n\n#### example\n\n $ nrfcredstore /dev/tty.usbmodem0009600000001 generate 123 device_cert.der\n\n # Convert DER to CSR\n $ openssl req -pubkey -in device_cert.der -inform DER > device_cert.csr\n\n## Development installation\n\nFor development mode, you need [poetry](https://python-poetry.org/):\n\n curl -sSL https://install.python-poetry.org | python3 -\n\nInstall package dependencies, development dependencies, and the nrfcredstore itself into poetry's internal virtual environment:\n\n poetry install\n\n## Test\n\nRunning the tests depends on a [development installation](#development-installation).\n\n poetry run pytest\n\nCheck coverage\n\n poetry run pytest --cov=src tests --cov-report=html\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Manage credentials stored in Nordic Semiconductor modems.",
"version": "2.0.2",
"project_urls": {
"Homepage": "https://github.com/NordicSemiconductor/nrfcredstore",
"Repository": "https://github.com/NordicSemiconductor/nrfcredstore"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1f9c44d30a764de235227af07805da305a0819cb9f397439f0bdcc3129516f35",
"md5": "4f1006b98b9798adf5aa5e88edfd2f74",
"sha256": "b20d77696389541eb9de5a6bdf0a37b4bb3023683d284439a63f9a2fa9b87a87"
},
"downloads": -1,
"filename": "nrfcredstore-2.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4f1006b98b9798adf5aa5e88edfd2f74",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 15886,
"upload_time": "2025-07-14T12:35:19",
"upload_time_iso_8601": "2025-07-14T12:35:19.945996Z",
"url": "https://files.pythonhosted.org/packages/1f/9c/44d30a764de235227af07805da305a0819cb9f397439f0bdcc3129516f35/nrfcredstore-2.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b113a97d6b82083f66a040dae1f75be61c56c887988c2b336d6caff65bc4058f",
"md5": "39a29663a1f9e60e6862ee3814160992",
"sha256": "eb3b5dda4bc30392dfdb7f701b34b537a398f8ed1c1c3c07f912a8dd80412718"
},
"downloads": -1,
"filename": "nrfcredstore-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "39a29663a1f9e60e6862ee3814160992",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 14649,
"upload_time": "2025-07-14T12:35:21",
"upload_time_iso_8601": "2025-07-14T12:35:21.297688Z",
"url": "https://files.pythonhosted.org/packages/b1/13/a97d6b82083f66a040dae1f75be61c56c887988c2b336d6caff65bc4058f/nrfcredstore-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 12:35:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NordicSemiconductor",
"github_project": "nrfcredstore",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nrfcredstore"
}