justinludwig / jpgpj

Java Pretty Good Privacy Jig
MIT License
75 stars 20 forks source link

Added cloning of encryptor/decryptor #35

Closed lgoldstein closed 3 years ago

lgoldstein commented 3 years ago

The expected use-case is as follows:

justinludwig commented 3 years ago

Thanks -- looks good! I think you might also want to implement Cloneable for Key and Subkey, too, though. Otherwise, if you add keys to an encryptor/decryptor ring before you clone it, you'll end up with multiple encryptor/decryptors sharing the same subkey instances -- which could would cause problems if clearSecrets() is called on one encryptor/decryptor while other encryptors/decryptors are still using a shared subkey instance (as it will clear the subkey's extracted private key material, as well as any passphrase that could be use to extract it again).

lgoldstein commented 3 years ago

Good catch - done.