mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-26 09:02:06 +01:00
Add withKeyPassword() methods to GenerateKey
This commit is contained in:
parent
be2fd9de49
commit
146a2bd761
1 changed files with 22 additions and 0 deletions
|
@ -9,6 +9,7 @@ import java.io.InputStream;
|
|||
|
||||
import sop.Ready;
|
||||
import sop.exception.SOPGPException;
|
||||
import sop.util.UTF8Util;
|
||||
|
||||
public interface GenerateKey {
|
||||
|
||||
|
@ -27,6 +28,27 @@ public interface GenerateKey {
|
|||
*/
|
||||
GenerateKey userId(String userId);
|
||||
|
||||
/**
|
||||
* Set a password for the key.
|
||||
*
|
||||
* @param password password to protect the key
|
||||
* @return builder instance
|
||||
*/
|
||||
GenerateKey withKeyPassword(String password);
|
||||
|
||||
/**
|
||||
* Set a password for the key.
|
||||
*
|
||||
* @param password password to protect the key
|
||||
* @return builder instance
|
||||
*
|
||||
* @throws sop.exception.SOPGPException.PasswordNotHumanReadable in case of a non-UTF8 password
|
||||
*/
|
||||
default GenerateKey withKeyPassword(byte[] password)
|
||||
throws SOPGPException.PasswordNotHumanReadable {
|
||||
return withKeyPassword(UTF8Util.decodeUTF8(password));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the OpenPGP key and return it encoded as an {@link InputStream}.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue