Add withKeypassword() methods to Decrypt

This commit is contained in:
Paul Schaub 2022-05-24 21:18:47 +02:00
parent 0699ae740a
commit 0bfc12c1e1
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -4,16 +4,17 @@
package sop.operation;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import sop.DecryptionResult;
import sop.ReadyWithResult;
import sop.SessionKey;
import sop.exception.SOPGPException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Date;
public interface Decrypt {
/**
@ -121,6 +122,24 @@ public interface Decrypt {
return withKey(new ByteArrayInputStream(key));
}
/**
* Provide the decryption password for the secret key.
*
* @param password password
* @return builder instance
*/
default Decrypt withKeyPassword(String password) {
return withKeyPassword(password.getBytes(Charset.forName("UTF8")));
}
/**
* Provide the decryption password for the secret key.
*
* @param password password
* @return builder instance
*/
Decrypt withKeyPassword(byte[] password);
/**
* Decrypts the given ciphertext, returning verification results and plaintext.
* @param ciphertext ciphertext