mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 06:12:06 +01:00
Deprecate addPassphrase()/addDecryptionPassphrase in favor of addMessagePassphrase()
This commit is contained in:
parent
6f46f75602
commit
69a57ef3bc
2 changed files with 28 additions and 2 deletions
|
@ -196,7 +196,22 @@ class ConsumerOptions {
|
||||||
* @param passphrase passphrase
|
* @param passphrase passphrase
|
||||||
* @return options
|
* @return options
|
||||||
*/
|
*/
|
||||||
fun addDecryptionPassphrase(passphrase: Passphrase) = apply {
|
@Deprecated(
|
||||||
|
"Deprecated in favor of addMessagePassphrase",
|
||||||
|
ReplaceWith("addMessagePassphrase(passphrase)"))
|
||||||
|
fun addDecryptionPassphrase(passphrase: Passphrase) = addMessagePassphrase(passphrase)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a passphrase for message decryption. This passphrase will be used to try to decrypt
|
||||||
|
* messages which were symmetrically encrypted for a passphrase.
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* [Symmetrically Encrypted Data Packet](https://datatracker.ietf.org/doc/html/rfc4880#section-5.7)
|
||||||
|
*
|
||||||
|
* @param passphrase passphrase
|
||||||
|
* @return options
|
||||||
|
*/
|
||||||
|
fun addMessagePassphrase(passphrase: Passphrase) = apply {
|
||||||
decryptionPassphrases.add(passphrase)
|
decryptionPassphrases.add(passphrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,18 @@ class EncryptionOptions(private val purpose: EncryptionPurpose) {
|
||||||
* @param passphrase passphrase
|
* @param passphrase passphrase
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
fun addPassphrase(passphrase: Passphrase) = apply {
|
@Deprecated(
|
||||||
|
"Deprecated in favor of addMessagePassphrase",
|
||||||
|
ReplaceWith("addMessagePassphrase(passphrase)"))
|
||||||
|
fun addPassphrase(passphrase: Passphrase) = addMessagePassphrase(passphrase)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a symmetric passphrase which the message will be encrypted to.
|
||||||
|
*
|
||||||
|
* @param passphrase passphrase
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
fun addMessagePassphrase(passphrase: Passphrase) = apply {
|
||||||
require(!passphrase.isEmpty) { "Passphrase MUST NOT be empty." }
|
require(!passphrase.isEmpty) { "Passphrase MUST NOT be empty." }
|
||||||
addEncryptionMethod(
|
addEncryptionMethod(
|
||||||
ImplementationFactory.getInstance().getPBEKeyEncryptionMethodGenerator(passphrase))
|
ImplementationFactory.getInstance().getPBEKeyEncryptionMethodGenerator(passphrase))
|
||||||
|
|
Loading…
Reference in a new issue