Replace ByteArrayInputStream with inputStream()

This commit is contained in:
Paul Schaub 2023-10-31 14:22:12 +01:00
parent 8df4a520bd
commit 9283f81c56
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
3 changed files with 5 additions and 9 deletions

View File

@ -4,7 +4,6 @@
package sop.operation
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import sop.exception.SOPGPException.BadData
@ -31,6 +30,5 @@ interface DetachedVerify : AbstractVerify<DetachedVerify>, VerifySignatures {
* @throws IOException in case of an IO error
*/
@Throws(BadData::class, IOException::class)
fun signatures(signatures: ByteArray): VerifySignatures =
signatures(ByteArrayInputStream(signatures))
fun signatures(signatures: ByteArray): VerifySignatures = signatures(signatures.inputStream())
}

View File

@ -4,7 +4,6 @@
package sop.operation
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import sop.Profile
@ -57,7 +56,7 @@ interface Encrypt {
*/
@Throws(
KeyCannotSign::class, UnsupportedAsymmetricAlgo::class, BadData::class, IOException::class)
fun signWith(key: ByteArray): Encrypt = signWith(ByteArrayInputStream(key))
fun signWith(key: ByteArray): Encrypt = signWith(key.inputStream())
/**
* Provide the password for the secret key used for signing.
@ -125,7 +124,7 @@ interface Encrypt {
UnsupportedAsymmetricAlgo::class,
BadData::class,
IOException::class)
fun withCert(cert: ByteArray): Encrypt = withCert(ByteArrayInputStream(cert))
fun withCert(cert: ByteArray): Encrypt = withCert(cert.inputStream())
/**
* Pass in a profile.
@ -162,5 +161,5 @@ interface Encrypt {
* @throws KeyIsProtected if at least one signing key cannot be unlocked
*/
@Throws(IOException::class, KeyIsProtected::class)
fun plaintext(plaintext: ByteArray): Ready = plaintext(ByteArrayInputStream(plaintext))
fun plaintext(plaintext: ByteArray): Ready = plaintext(plaintext.inputStream())
}

View File

@ -4,7 +4,6 @@
package sop.operation
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import sop.Ready
@ -38,5 +37,5 @@ interface ExtractCert {
* @throws BadData if the byte array does not contain an OpenPGP key
*/
@Throws(IOException::class, BadData::class)
fun key(key: ByteArray): Ready = key(ByteArrayInputStream(key))
fun key(key: ByteArray): Ready = key(key.inputStream())
}