cossacklabs / themis

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
https://www.cossacklabs.com/themis
Apache License 2.0
1.85k stars 143 forks source link

Passphrase support for Context Imprint (and Token Protect) #1044

Open ashughes opened 6 months ago

ashughes commented 6 months ago

Is your feature request related to a problem? Please describe. The documentation here states that all modes have passphrase support. However, there does not appear to be passphrase support for Context Imprint or Token Protect modes (at least in the Java/Kotlin API).

Describe the solution you'd like to see Similar to the SealWithPassphrase API, it would be helpful if there was a ContextImprintWithPassphrase (and TokenProtectWithPassphrase) API.

Describe alternatives you've considered In order to use Context Imprint with a passphrase, we would need to generate a SymmetricKey to use with Context Imprint, then use SealWithPassphrase to encrypt the SymmetricKey and prepend it our output data. During decryption we would then have to decrypt the SymmetricKey in our header with the passphrase and then use the SymmetricKey to decrypt the data using Context Imprint.

This alternative is definitely workable, but it would be helpful if we could use the passphrase API directly to skip this extra step.