benkonrath / transip-api

Python implementation for the TransIP API
https://transip-api.readthedocs.io/en/latest/
MIT License
23 stars 23 forks source link

ValueError("Could not deserialize key data. ") #54

Closed rubenzovoorts closed 4 years ago

rubenzovoorts commented 4 years ago

Sorry if this is a novice question, I am very new to this!

I saw someone else had the some problem but I still can't figure out what I'm doing wrong.

I used this command in the terminal while testing the api:

$ transip-api -l <username> --api-key /Documents/decrypted_key

This should return a list of my domain-names, right?

I used the -----BEGINPRIVATEKEY----- format in de key-file. It's a complete copy-paste from the Trans-ip control panel.

And this is the output:

Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.8.0/bin/transip-api", line 11, in <module>
    load_entry_point('transip==2.0.0', 'console_scripts', 'transip-api')()
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/transip/transip_cli.py", line 117, in main
    show_dns_entries(domain_service, args.domain_name)
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/transip/transip_cli.py", line 26, in show_dns_entries
    dns_entries = domain_service.get_info(domain_name).dnsEntries
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/transip/service/domain.py", line 56, in get_info
    cookie = self.build_cookie(mode=MODE_RO, method='getInfo', parameters=[domain_name])
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/transip/client.py", line 182, in build_cookie
    signature = self._sign(message_to_sign)
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/transip/client.py", line 102, in _sign
    private_key = serialization.load_pem_private_key(
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py", line 16, in load_pem_private_key
    return backend.load_pem_private_key(data, password)
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1085, in load_pem_private_key
    return self._load_key(
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1315, in _load_key
    self._handle_key_loading_error()
  File "/Users/user/.pyenv/versions/3.8.0/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1373, in _handle_key_loading_error
    raise ValueError("Could not deserialize key data.")
ValueError: Could not deserialize key data.

Any ideas what I might be doing wrong?

KajdeMunter commented 4 years ago

After experiencing https://github.com/benkonrath/transip-api/issues/60 I am now having this too..

benkonrath commented 4 years ago

This has been fixed by #55 which was just merged into master.

benkonrath commented 4 years ago

I just released 2.1.2 which has the fix for this.