Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Invalid key file #9076

Closed
stone212 opened this issue Jul 9, 2018 · 6 comments
Closed

Invalid key file #9076

stone212 opened this issue Jul 9, 2018 · 6 comments
Labels
Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Milestone

Comments

@stone212
Copy link

stone212 commented Jul 9, 2018

Before filing a new issue, please provide the following information.

I'm running:

  • Which Parity version?: 1.10.8
  • Which operating system?: Ubuntu 16.04
  • How installed?: via .deb
  • Are you fully synchronized?: yes
  • Which network are you connected to?: private blockchain
  • Did you try to restart the node?: yes

Your issue description goes here below. Try to include actual vs. expected behavior and steps to reproduce the issue.

  1. Run Parity 1.10.8.

  2. Create two addresses. See that they work as expected.

  3. Create a third address. See this error with one of the original two:

Invalid key file: "/path/to/UTC-keyfile" (ErrorImpl { code: ExpectedObjectCommaOrEnd, line: 1, column: 510 })

(4. Also notice that the Parity UI does not show the address from 3. )

@Tbaut
Copy link
Contributor

Tbaut commented Jul 9, 2018

How do you create the addresses? This could be linked to parity-js/shell#106 which is solved in the latest Parity UI releases.

@Tbaut Tbaut added the Z1-question 🙋‍♀️ Issue is a question. Closer should answer. label Jul 9, 2018
@Tbaut Tbaut added this to the 2.0 milestone Jul 9, 2018
@Tbaut Tbaut added the Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. label Jul 9, 2018
@stone212
Copy link
Author

@Tbaut Good question. #3 should read:

  1. Create a third address on the command line with "parity account new". Then see the error.

@Tbaut
Copy link
Contributor

Tbaut commented Jul 10, 2018

Did you see my comment regarding parity-js/shell#106? I have been using parity account new extensively lately and I couldn't reproduce.

Could you manually verify the JSON file? is there some kind of repetition toward the end of it?

@stone212
Copy link
Author

@Tbaut I do see that now and possible the metadata was rewritten but I don't know how. Is there a way to delete and re-create metadata?

Could you manually verify the JSON file? is there some kind of repetition toward the end of it?

Maybe and I don't know. I have it open but I don't know what to look for. There is not anything that is obviously repetition. I am comparing to the other good one. I can not share because these are actual live keys.

I am hoping there is a way to re-create metadata?

@Tbaut
Copy link
Contributor

Tbaut commented Jul 11, 2018

I am hoping there is a way to re-create metadata?

There is no easy way to create metadata. This must be done manually. What you could look for would something like an invalid json indentation. Here is an example I gave in the issue

This is the key that got corrupted (having a look at it quickly, it's not obvious), it's in bad-key.json file:

{"id":"4d99d2c6-85da-1dcc-f4db-0bd75e12f6d5","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"3f4e63966d6f5...689f240a"},"ciphertext":"ab0c0bcd78199a...669d7a40df7fbce","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"83acee02...db150d68"},"mac":"22763026...22e0b"},"address":"00bde63c2...4d332fb6060","name":"Signer Oops 001","meta":"{\"description\":\"\",\"passwordHint\":\"whatever\",\"tags\":[],\"timestamp\":1524227384857}"}57}"}

Now using jq cli tool, you can print the valid part of the key :

$ cat bad-key.json | jq
{
  "id": "4d99d2c6-85da-1dcc-f4db-0bd75e12f6d5",
  "version": 3,
  "crypto": {
    "cipher": "aes-128-ctr",
    "cipherparams": {
      "iv": "3f4e63966d6f5...689f240a"
    },
    "ciphertext": "ab0c0bcd78199a...669d7a40df7fbce",
    "kdf": "pbkdf2",
    "kdfparams": {
      "c": 10240,
      "dklen": 32,
      "prf": "hmac-sha256",
      "salt": "83acee02...db150d68"
    },
    "mac": "22763026...22e0b"
  },
  "address": "00bde63c2...4d332fb6060",
  "name": "Signer Oops 001",
  "meta": "{\"description\":\"\",\"passwordHint\":\"whatever\",\"tags\":[],\"timestamp\":1524227384857}"
}
parse error: Unmatched '}' at line 1, column 478

Now you can actually copy/paste what you see (before the error) in a good-key.json.

Or fix the error by understanding what happens in column 478. Use vi or a regular text editor. In my case xed to have a look at the problem:
image
Here you can see that there is an error with the unexpected } and there is actually a repetition.

removing the end of the file 57}"} makes it a valid json.

If you're really clueless you can still post the keys here and change/remove part of it, just like I did.

@stone212
Copy link
Author

stone212 commented Jul 11, 2018

@Tbaut Thank you. Explaining the jq tool make all the difference. I'm not a programmer I'm a systems guy. Yes the error is gone. Here is an example of what I found:

"meta":"{\"descriptio\\d:\"\",\"passwordHi\"pa:\"\",\"tags\":[]}"}tags\":[]}"}

Also I saw:

"name":"M,

They are obvious mistakes now but just looking at them with no tool did not help. Using an editor to find the error was easy once I knew to use jq.

And the error is almost definitely caused by parity-js/shell#106. I did change the name of the keys (and forgot that I had done that) and I guess maybe the description also. Thank you for your help. Hopefully the explanation of jq here will help other people. It is a simple fix with that tool and an editor.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Projects
None yet
Development

No branches or pull requests

2 participants