1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-11 03:09:41 +02:00

Checkstyle issues

This commit is contained in:
Paul Schaub 2025-07-30 13:25:09 +02:00
parent fed6cbcd6e
commit 4b179d750a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
6 changed files with 59 additions and 57 deletions

View file

@ -5,6 +5,7 @@
package org.pgpainless.sop
import java.io.BufferedOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
import kotlin.jvm.Throws
@ -14,7 +15,6 @@ import org.pgpainless.util.ArmoredOutputStreamFactory
import sop.Ready
import sop.exception.SOPGPException
import sop.operation.Armor
import java.io.IOException
/** Implementation of the `armor` operation using PGPainless. */
class ArmorImpl : Armor {
@ -27,14 +27,15 @@ class ArmorImpl : Armor {
val bufferedOutputStream = BufferedOutputStream(outputStream)
// Determine the nature of the given data
val openPgpIn = OpenPgpInputStream(data, false).apply {
try {
inspectBuffer()
} catch (e: IOException) {
// ignore
val openPgpIn =
OpenPgpInputStream(data, false).apply {
try {
inspectBuffer()
} catch (e: IOException) {
// ignore
}
reset()
}
reset()
}
if (openPgpIn.isAsciiArmored) {
// armoring already-armored data is an idempotent operation

View file

@ -4,11 +4,13 @@
package org.pgpainless.sop
import org.bouncycastle.bcpg.UnsupportedPacketVersionException
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
import java.util.*
import java.util.zip.ZipException
import kotlin.NoSuchElementException
import org.bouncycastle.bcpg.UnsupportedPacketVersionException
import org.bouncycastle.openpgp.PGPException
import org.bouncycastle.util.io.Streams
import org.pgpainless.PGPainless
@ -25,8 +27,6 @@ import sop.SessionKey
import sop.exception.SOPGPException
import sop.operation.Decrypt
import sop.util.UTF8Util
import java.util.zip.ZipException
import kotlin.NoSuchElementException
/** Implementation of the `decrypt` operation using PGPainless. */
class DecryptImpl : Decrypt {
@ -61,8 +61,7 @@ class DecryptImpl : Decrypt {
throw SOPGPException.BadData(e)
} catch (e: ModificationDetectionException) {
throw SOPGPException.BadData(e)
}
finally {
} finally {
// Forget passphrases after decryption
protector.clear()
}