简体   繁体   中英

ECC key encoding in pyecc and seccure

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

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/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM