Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

nrfutil 6.0.0 generates invalic c code when converting private key #289

Closed
mawis opened this issue Dec 9, 2019 · 2 comments
Closed

nrfutil 6.0.0 generates invalic c code when converting private key #289

mawis opened this issue Dec 9, 2019 · 2 comments
Labels

Comments

@mawis
Copy link

mawis commented Dec 9, 2019

Using the new nrfutil I cannot re-generate the private key C code from the PEM file anymore.

The command I use is:

nrfutil keys display --key pk --format code ../keys/private.pem --out_file dfu_public_key.c

The problem is in the file dfu_public_key.c. The key generated there is split into two lines of 32 hex values each. The problem is that at the end of the first key line (i.e. between pk[31] and pk[32]) there is no comma. Therefore the C compiler is complaining that the file is not correct.

Generated dfu_public_key.c looks something like this:

/* This file was automatically generated by nrfutil on 2019-12-09 (YY-MM-DD) at 20:21:48 */

#include "stdint.h"
#include "compiler_abstraction.h"

/** @brief Public key used to verify DFU images */
__ALIGN(4) const uint8_t pk[64] =
{
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

(Actual key replaced by 0x00 bytes manually by me.)

@bihanssen
Copy link
Contributor

@mawis, thanks for reporting, this seems like a bug.

@bihanssen bihanssen added the bug label Dec 10, 2019
@bihanssen
Copy link
Contributor

Fixed in #290

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants