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

In which format is configuration expected to be provided? #15

Closed
m90 opened this issue May 31, 2019 · 3 comments
Closed

In which format is configuration expected to be provided? #15

m90 opened this issue May 31, 2019 · 3 comments

Comments

@m90
Copy link
Contributor

m90 commented May 31, 2019

I am trying to use symmecrypt but am unable to have the keyloader load the key I previously generated.

I generated a key (this one is not real and just used for demo purposes) that looks like:

{"identifier": "offen","cipher": "aes-gcm","timestamp": 1559304854,"key": "0fa4ec6d625633067c17be66f14dca39d8b64223044338ff2db5b68a0944c65e"}

The code in the example here: https://github.com/ovh/symmecrypt#example omits configuring the configstore, so using it as is fails with

encryption key 'offen' not found"

Looking at the configstore API, I found I was probably expected to use

configstore.File("key.json")

to load the key from the file.

This actually loads the file, I can iterate over the items in the configstore after loading, so it seems to pick up something, but apparently I am not able to get the format right.

The README in this repository displays sth like:

encryption-key: {"cipher":"aes-gcm","key":"442fca912da8309613542e7bb29788a44c162cde6ee4f0f5b1322132f65a2ddc","identifier":"storage","timestamp":1522138216}

which when used in my key.json fails with a "key not found" error still.

When I look at the documentation of configstore here: https://github.com/ovh/configstore#item-retrieval-example-101 it instructs me to specify items like:

    - key: foo
      value: bar
    - key: baz
      value: bazz

but if I try using sth like this:

- key: offen
  value: {"identifier": "offen","cipher": "aes-gcm","timestamp": 1559304854,"key": "0fa4ec6d625633067c17be66f14dca39d8b64223044338ff2db5b68a0944c65e"}

in my context, I will still not be able to load the key.

Is there a real-world example of how to load keys from a file here? Is this supposed to be text, JSON, YAML?

@loopfz
Copy link
Member

loopfz commented May 31, 2019

Sorry for the confusion, indeed this part of the symmecrypt documentation is not detailed enough.

Try with:

  • key: encryption-key
    value: '{...}'

The key label is a constant used by the symmecrypt keyloader.
Mind the single quotes to avoid quoting issues.

@m90
Copy link
Contributor Author

m90 commented May 31, 2019

Thanks for getting back to me so quickly, this is exactly how it's supposed to be done, works fine for me now. Would you mind a PR that adds this to the docs in here?

@loopfz
Copy link
Member

loopfz commented May 31, 2019

Glad to hear it's working for you.
For a PR @ doc: absolutely, thanks!

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

2 participants