Decrypt: Use return statement

This commit is contained in:
Paul Schaub 2023-10-31 14:11:11 +01:00
parent 4dc1779a06
commit ee6975c7d3
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -99,9 +99,7 @@ interface Decrypt {
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
*/ */
@Throws(BadData::class, UnsupportedAsymmetricAlgo::class, IOException::class) @Throws(BadData::class, UnsupportedAsymmetricAlgo::class, IOException::class)
fun withKey(key: ByteArray): Decrypt { fun withKey(key: ByteArray): Decrypt = withKey(key.inputStream())
return withKey(key.inputStream())
}
/** /**
* Provide the decryption password for the secret key. * Provide the decryption password for the secret key.
@ -112,9 +110,8 @@ interface Decrypt {
* @throws PasswordNotHumanReadable if the password is not human-readable * @throws PasswordNotHumanReadable if the password is not human-readable
*/ */
@Throws(UnsupportedOption::class, PasswordNotHumanReadable::class) @Throws(UnsupportedOption::class, PasswordNotHumanReadable::class)
fun withKeyPassword(password: String): Decrypt { fun withKeyPassword(password: String): Decrypt =
return withKeyPassword(password.toByteArray(UTF8Util.UTF8)) withKeyPassword(password.toByteArray(UTF8Util.UTF8))
}
/** /**
* Provide the decryption password for the secret key. * Provide the decryption password for the secret key.
@ -163,7 +160,6 @@ interface Decrypt {
CannotDecrypt::class, CannotDecrypt::class,
KeyIsProtected::class, KeyIsProtected::class,
IOException::class) IOException::class)
fun ciphertext(ciphertext: ByteArray): ReadyWithResult<DecryptionResult> { fun ciphertext(ciphertext: ByteArray): ReadyWithResult<DecryptionResult> =
return ciphertext(ciphertext.inputStream()) ciphertext(ciphertext.inputStream())
}
} }