Open ronaldtse opened 6 years ago
https://github.com/riboseinc/ruby-rnp/issues/2#issuecomment-385835133
Did you mean you want an example added to the repo?
Both 😉 Thank you @dewyatt !
Is it possible to use keys generated via Rnp.new
for start_encrypt
?
Something like this?
rnp.load_keys(format: 'raw', input: Rnp::Input.from_XXX)
enc = rnp.start_encrypt(
input: Rnp::Input.from_string(plaintext),
output: Rnp::Output.to_null
)
Oh, I see that by default Rnp.new
uses 'GPG' for both:
In particular, is it possible to only rnp.save_keys
on particular keys?
I would like to get rid of pubfmt
and secfmt
for Rnp#initialize
eventually as it does seem out of place (related TODO).
In particular, is it possible to only rnp.save_keys on particular keys?
Yes, but not with the #save_keys
interface. I recall you can do File.write
with the #public_key_data
or #secret_key_data
.
Indeed #public_key_data
and #secret_key_data
works, but once exported, how can we read them back as keys? Rnp.key_format(data)
return nil
on these.
Rnp.key_format(data) return nil on these.
I wouldn't expect it to so that would probably be a bug.
I wouldn't expect it to so that would probably be a bug.
Actually it works. Not sure what I did last night, probably just too late 👍
It could be that you followed my bad advice and used File.write
instead of File.binwrite
. Glad it's working either way.
You're probably right. I didn't try saving today 😉
I think the example should show key generation, key save (in GPG/KBX/ASCII) formats and a key load.
@dewyatt does it make more sense that we utilize a Key model on the Ruby side to manage such functionality?
I'd like to see something like this, couldn't figure out how to save generated keys in GPG or KBX formats...