Add withKeyPassword() methods to Sign

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

View file

@ -7,6 +7,7 @@ package sop.operation;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset;
import sop.ReadyWithResult; import sop.ReadyWithResult;
import sop.SigningResult; import sop.SigningResult;
@ -45,6 +46,24 @@ public interface Sign {
*/ */
Sign key(InputStream key) throws SOPGPException.KeyIsProtected, SOPGPException.BadData, IOException; Sign key(InputStream key) throws SOPGPException.KeyIsProtected, SOPGPException.BadData, IOException;
/**
* Provide the decryption password for the secret key.
*
* @param password password
* @return builder instance
*/
default Sign withKeyPassword(String password) {
return withKeyPassword(password.getBytes(Charset.forName("UTF8")));
}
/**
* Provide the decryption password for the secret key.
*
* @param password password
* @return builder instance
*/
Sign withKeyPassword(byte[] password);
/** /**
* Add one or more signing keys. * Add one or more signing keys.
* *