load does not decrypt from export
Havivw opened this issue · 1 comments
flow:
ghost export
ghost init (on new machine)
mv passphrase.ghost to /home/centos/.ghost/passphrases/haviv
ghost load new-stash -p new-stash
error:
ghost get -s /home/centos/.ghost/cloudify.json[haviv] -p $(cat /home/centos/.ghost/passphrases/haviv) aws
STDOUT: Stash: tinydb at /home/centos/.ghost/cloudify.json[haviv]
STDERR: Traceback (most recent call last):
File "/usr/bin/ghost", line 11, in
load_entry_point('ghost==0.5.0', 'console_scripts', 'ghost')()
File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/ghost.py", line 1237, in get_key
record = stash.get(key_name=key_name, decrypt=not no_decrypt)
File "/usr/lib/python2.7/site-packages/ghost.py", line 262, in get
key['value'] = self._decrypt(key['value'])
File "/usr/lib/python2.7/site-packages/ghost.py", line 449, in _decrypt
encrypted_value).decode('ascii')
File "/usr/lib64/python2.7/site-packages/cryptography/fernet.py", line 103, in decrypt
raise InvalidToken
cryptography.fernet.InvalidToken
Yup, when loading it doesn't get both the passphrase required for decrypting and encrypting. Will fix this.