mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-16 12:42:05 +01:00
Add withKeypassword() methods to Decrypt
This commit is contained in:
parent
0699ae740a
commit
0bfc12c1e1
1 changed files with 24 additions and 5 deletions
|
@ -4,16 +4,17 @@
|
||||||
|
|
||||||
package sop.operation;
|
package sop.operation;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import sop.DecryptionResult;
|
import sop.DecryptionResult;
|
||||||
import sop.ReadyWithResult;
|
import sop.ReadyWithResult;
|
||||||
import sop.SessionKey;
|
import sop.SessionKey;
|
||||||
import sop.exception.SOPGPException;
|
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 {
|
public interface Decrypt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +122,24 @@ public interface Decrypt {
|
||||||
return withKey(new ByteArrayInputStream(key));
|
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.
|
* Decrypts the given ciphertext, returning verification results and plaintext.
|
||||||
* @param ciphertext ciphertext
|
* @param ciphertext ciphertext
|
||||||
|
|
Loading…
Reference in a new issue