GoogleCloudPlatform / iot-core-micropython

Apache License 2.0
52 stars 14 forks source link

Decode rsa #13

Closed Tayaah closed 3 years ago

Tayaah commented 3 years ago

I'm having a problem in decode rsa,

C:\Users\hyago\Desktop\litlab\teste01micropython>iot-core-micropython-master\utils\decode_rsa.py Traceback (most recent call last): File "C:\Users\hyago\Desktop\litlab\teste01micropython\iot-core-micropython-master\utils\decode_rsa.py", line 17, in pk = rsa.PrivateKey.load_pkcs1(private_key) File "C:\Users\hyago\AppData\Roaming\Python\Python38\site-packages\rsa\key.py", line 116, in load_pkcs1 return method(keyfile) File "C:\Users\hyago\AppData\Roaming\Python\Python38\site-packages\rsa\key.py", line 563, in _load_pkcs1_pem der = rsa.pem.load_pem(keyfile, b'RSA PRIVATE KEY') File "C:\Users\hyago\AppData\Roaming\Python\Python38\site-packages\rsa\pem.py", line 101, in load_pem pem_lines = [line for line in _pem_lines(contents, pem_start, pem_end)] File "C:\Users\hyago\AppData\Roaming\Python\Python38\site-packages\rsa\pem.py", line 101, in pem_lines = [line for line in _pem_lines(contents, pem_start, pem_end)] File "C:\Users\hyago\AppData\Roaming\Python\Python38\site-packages\rsa\pem.py", line 75, in _pem_lines raise ValueError('No PEM start marker "%r" found' % pem_start) ValueError: No PEM start marker "b'-----BEGIN RSA PRIVATE KEY-----'" found

I'm not an expert as you can see, and it seems to be an easy problem, anyone can help?

I had already done the previous steps (generate rsa_private...)

I'm opening the file with mode='rb, as decode_rsa is...

Tayaah commented 3 years ago

https://stackoverflow.com/questions/20065304/differences-between-begin-rsa-private-key-and-begin-private-key