Skip to content

Commit

Permalink
Display RSA modulus line for copy&paste into config.h
Browse files Browse the repository at this point in the history
enhanced version of: pfalcon#22
  • Loading branch information
jedie committed Dec 30, 2019
1 parent 95413b7 commit 2b401e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ota-client/gen_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ BITS=512
openssl genrsa -out priv.key -3 $BITS
openssl rsa -in priv.key -pubout -out pub.key
openssl pkey -in priv.key -text

python -c "import rsa_sign; rsa_sign.dump_modulus(rsa_sign.load_key())"
12 changes: 9 additions & 3 deletions ota-client/rsa_sign.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ def load_key():
elif l.startswith(" "):
comps[last_comp] = comps.get(last_comp, "") + l.lstrip()

print(comps)
#print(comps)
return comps


def dump_c(comps):
print('mod = "%s"' % comps["modulus"][2:].replace(":", "\\x"))
def dump_modulus(comps):
print('Copy&paste this RSA modulus line into your config.h:')
print('-'*100)
print('#define MODULUS "%s"' % comps["modulus"][2:].replace(":", "\\x"))
print('-'*100)


def dump_exponent(comps):
print('pe = "%s"' % comps["privateExponent"][2:].replace(":", "\\x"))


Expand Down

0 comments on commit 2b401e0

Please sign in to comment.