1

I am working with pyecc which uses the seccure C library.

When a public key is generated I get something back like this:

#Gp}7RRWK5Dyg&-m5yHve1p{?<o0xi.M8-?W^]xb))oA]|qO%[5v?#IxteV?

Are these the 'raw bytes' or is this encoded in some form? When I use os.urandom(16) I get all kinds of messed up characters, but not from this generate public key function. Does that mean that there is some encoding? I've looked at the seccure source code, but I still don't understand why I get all these 'normal' characters.

How do I turn this into a byte array (Python bytearray) of the exact key?

Code:

from pyecc import ECC
ecc = ECC.generate()
print ecc._public
Ihmahr
  • 1,110
  • 1
  • 16
  • 25

1 Answers1

2

It looks like it might be a proprietary format from quickly looking at their code. They serialize and compress the key information into a printable string. You can download the source code and see an example of how to use it here: http://point-at-infinity.org/seccure/.

gtrig
  • 12,550
  • 5
  • 28
  • 36