-
Notifications
You must be signed in to change notification settings - Fork 20
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
Passphrase storing #19
Comments
Thank you for raising this issue! -- it's a very good point, and your suggestions make a lot of sense to me. I'll play around with it a bit over the next few weeks, and see if I can put together an update that:
|
Thanks for the quick response. Sounds like a plan! Ping me if you need any assistance, I would gladly help. |
and to be zeroed after use; for #19 * Updated the `Subkey` class to: * Add new `passphraseChars` property, allowing a subkey's passphrase to be set and cached as a `char[]` instead of as a `String` object. * Add new `unlock()` method, allowing the subkey to be unlocked without caching the passphrase at all. * Cache the private-key material (in the form of a `PGPPrivateKey` object) after the subkey has been unlocked. * Add new `clearSecrets()` method, allowing the cached private-key material to be released for garbage collection, and zeroing-out the cached `char[]` passphrase. * Updated the `Key` class to: * Add new `passphraseChars` setter as a convenience for setting subkey `char[]` passphrases. * Add new constructors that accept `char[]` passphrases; one each corresponding to the old `String` passphrase constructors. * Add new `clearSecrets()` method as a convenience for clearing subkey secrets. * Updated the `Ring` class to: * Add new `clearSecrets()` method as a convenience for clearing subkey secrets. * Updated the `Encryptor` class to: * Add new `symmetricPassphraseChars` property, allowing the passphrase for symmetric encryption to be set and cached as a `char[]` instead of as a `String` object. * Add new `clearSecrets()` method as a convenience for clearing subkey secrets, and zeroing-out the cached `char[]` symmetric passphrase. * Updated the `Decryptor` class to: * Add new `symmetricPassphraseChars` property, allowing the passphrase for symmetric encryption to be set and cached as a `char[]` instead of as a `String` object. * Add new `clearSecrets()` method as a convenience for clearing subkey secrets, and zeroing-out the cached `char[]` symmetric passphrase.
I coded up some changes as PR #20, trying to avoid breaking the existing use of passphrases as
I also wrote up some changes to the wiki pages, including updating the section on setting passphrases to document how to supply the passphrase as a |
Thanks again for your help @dtitov! -- I merged #20 into master, and released v0.5 with the change. I also merged those wiki updates in -- the main section for documenting how best to use the new API methods is here: https://github.com/justinludwig/jpgpj/wiki/KeyRings#cleaning-up-memory |
Thanks! :) |
Hi! Very nice library, but we've discovered a potential security issue: passphrase for the private key is stored as
String
, which is a bit insecure.I would suggest not just replacing the type of
passphrase
field in theSubkey
class fromString
tochar[]
, but rather not storing passphrase at all: it should be possible to store builtPBESecretKeyDecryptor
instead. Or even not store anything at all and just ask for achar[]
each time upon decryption.What do you think? Would it be possible to implement such a change?
The text was updated successfully, but these errors were encountered: