Move withKeyPassword method in Sign around

This commit is contained in:
Paul Schaub 2022-05-24 21:36:02 +02:00
parent 72c3b3218d
commit e8d7d1b5f4
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 23 additions and 14 deletions

View file

@ -0,0 +1,9 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.operation;
public interface InlineSign {
}

View file

@ -46,6 +46,20 @@ public interface Sign {
*/
Sign key(InputStream key) throws SOPGPException.KeyIsProtected, SOPGPException.BadData, IOException;
/**
* Add one or more signing keys.
*
* @param key byte array containing encoded keys
* @return builder instance
*
* @throws sop.exception.SOPGPException.KeyIsProtected if the key is password protected
* @throws sop.exception.SOPGPException.BadData if the byte array does not contain an OpenPGP key
* @throws IOException in case of an IO error
*/
default Sign key(byte[] key) throws SOPGPException.KeyIsProtected, SOPGPException.BadData, IOException {
return key(new ByteArrayInputStream(key));
}
/**
* Provide the decryption password for the secret key.
*
@ -64,20 +78,6 @@ public interface Sign {
*/
Sign withKeyPassword(byte[] password);
/**
* Add one or more signing keys.
*
* @param key byte array containing encoded keys
* @return builder instance
*
* @throws sop.exception.SOPGPException.KeyIsProtected if the key is password protected
* @throws sop.exception.SOPGPException.BadData if the byte array does not contain an OpenPGP key
* @throws IOException in case of an IO error
*/
default Sign key(byte[] key) throws SOPGPException.KeyIsProtected, SOPGPException.BadData, IOException {
return key(new ByteArrayInputStream(key));
}
/**
* Signs data.
*