Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize key management for bnscli #831

Closed
ruseinov opened this issue Jun 27, 2019 · 8 comments
Closed

Standardize key management for bnscli #831

ruseinov opened this issue Jun 27, 2019 · 8 comments

Comments

@ruseinov
Copy link
Contributor

ruseinov commented Jun 27, 2019

There are several ways to store keys in strings, some of them are in use in IOV

  1. Base64
  2. Hex

Currently there is no standard way to deal with this when working with bnscli.

In order to simplify this process I would propose 2 solutions:

  1. Support base64 and hex-encoded strings in any command that requires a key, not just the keyfile
  2. Implement helper commands to save a base64/hex-encoded string as decoded raw-bytes, similar to keygen.

Ideally I would have both of these solutions implemented for convenience.

@ethanfrey
Copy link
Contributor

In Linux there is a cli tool, I think

Echo $key | base64 - d > keyfile

@ruseinov
Copy link
Contributor Author

ruseinov commented Jun 27, 2019

@ethanfrey It's not a base64 issue, but rather decoding a hex string and writing it to a file.
That's probably because we should store base64 instead of hex..

@husio
Copy link
Contributor

husio commented Jun 27, 2019

I am using a custom program to deal with hex values https://gist.github.com/husio/0508ad24aa52a8f95684a1a86f33e1cb

echo $key | hexit -d > keyfile

@ethanfrey
Copy link
Contributor

ethanfrey commented Jun 27, 2019

We use this in iov-core scripts:

echo -n 1234 | xxd -r -p - | xxd -p -c 9999

xxd -r -p - will convert raw hex to binary
xxd -p -c 9999 will convert to raw hex (with 9999 character lines, so we get no newlines)

Example to do what you want I believe (hex to base64):

$ echo -n 00CAFE00 | xxd -r -p - | base64
AMr+AA==
$ echo -n AMr+AA== | base64 -d | xxd -p -c 999
00cafe00

@ruseinov
Copy link
Contributor Author

Yeah, I have already added the xxd bit to the wiki as it seems to work fine. Will close this for now as everybody stores their test private keys differently.

@ethanfrey
Copy link
Contributor

Will close this for now as everybody stores their test private keys differently

We really need a standard key management for any production bnscli tool

@ruseinov
Copy link
Contributor Author

@ethanfrey I will reopen then an formulate the ticket differently.

@ruseinov ruseinov reopened this Jun 27, 2019
@ruseinov ruseinov changed the title Add a command line tool that converts 64-byte hex string to a keyfile. Standardize key management for bnscli Jun 27, 2019
@ethanfrey
Copy link
Contributor

Closing in favor of #856 and #855 for a much deeper overhaul of key management functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants