# Using my own private keys on bootloader "ruuvi.nrf5\_sdk15\_bootloader.c"

**URL:** <https://f.ruuvi.com/t/using-my-own-private-keys-on-bootloader-ruuvi-nrf5-sdk15-bootloader-c/3078>\
**Category:** 🇬🇧 Ruuvi firmware development\
**Created:** [16 November 2018 15:24 UTC](https://f.ruuvi.com/t/using-my-own-private-keys-on-bootloader-ruuvi-nrf5-sdk15-bootloader-c/3078 "2018-11-16T15:24:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cirobr](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/c/a3d4f5/32.png) [@cirobr](https://f.ruuvi.com/u/cirobr)\
**Post date:** [16 November 2018 15:24 UTC](https://f.ruuvi.com/t/using-my-own-private-keys-on-bootloader-ruuvi-nrf5-sdk15-bootloader-c/3078/1 "2018-11-16T15:24:49Z")

</div>

Hello,

I am stuck on generating bootloader signed with my own keys and compiling it with Segger. Status as follows:

- Public/private keys are created with “nrfutil keys generate”. Files are named as “private.pem” and “public\_pem.c”.

- Project “ruuvi.nrf5\_sdk15\_bootloader.c” is correctly structured as in its “README.md” file, and in fact it compiles flawlessly with the key pair provided by Ruuvi.

- The unclear topic is exactly how to integrate my own keys on the project. README indiates to “use production version”.

Questions:  
a. Where exactly on “Build options” to change between debug and production version? Couldn’t find it…  
b. I wonder if you did actually meant change in “Preprocessor Definitions”? There is a NDEBUG statement at Solution level, which is inherited to Project level…  
c. Should the file “dfu\_public\_key.c” be edited to have deleted its native public key and replaced by mine?

Many thans in advance.

---

<div class="post-metadata">

**Author:** ![otso](https://f.ruuvi.com/user_avatar/f.ruuvi.com/otso/32/1651_2.png) [@otso](https://f.ruuvi.com/u/otso)\
**Post date:** [16 November 2018 17:20 UTC](https://f.ruuvi.com/t/using-my-own-private-keys-on-bootloader-ruuvi-nrf5-sdk15-bootloader-c/3078/2 "2018-11-16T17:20:32Z")

</div>

Hello,

> [@cirobr](#):
>
> Where exactly on “Build options” to change between debug and production version? Couldn’t find it…

I don’t remember it right now, but there is a flag along the lines of “DEBUG\_BOOTLOADER”. It lets the bootloader to skip various version checks. SES might have build configurations “Debug” and “Release” which have these set.

> [@cirobr](#):
>
> b. I wonder if you did actually meant change in “Preprocessor Definitions”? There is a NDEBUG statement at Solution level, which is inherited to Project level…

Yes

> [@cirobr](#):
>
> c. Should the file “dfu\_public\_key.c” be edited to have deleted its native public key and replaced by mine?

yes

---

<div class="post-metadata">

**Author:** ![cirobr](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/c/a3d4f5/32.png) [@cirobr](https://f.ruuvi.com/u/cirobr)\
**Post date:** [17 November 2018 13:29 UTC](https://f.ruuvi.com/t/using-my-own-private-keys-on-bootloader-ruuvi-nrf5-sdk15-bootloader-c/3078/3 "2018-11-17T13:29:34Z")

</div>

Thanks, I ended up managing in simplest way which is by editing dfu\_public\_key.c.
