mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 02:39:39 +02:00
Port OpenPGPInputStream to Kotlin as OpenPGPAnimalSnifferInputStream
This commit is contained in:
parent
bef30223fa
commit
62fe69db75
8 changed files with 340 additions and 367 deletions
|
@ -10,7 +10,7 @@ import java.io.OutputStream
|
|||
import kotlin.jvm.Throws
|
||||
import org.bouncycastle.util.io.Streams
|
||||
import org.pgpainless.PGPainless
|
||||
import org.pgpainless.decryption_verification.OpenPgpInputStream
|
||||
import org.pgpainless.decryption_verification.OpenPGPAnimalSnifferInputStream
|
||||
import org.pgpainless.util.ArmoredOutputStreamFactory
|
||||
import sop.Ready
|
||||
import sop.exception.SOPGPException
|
||||
|
@ -27,7 +27,7 @@ class ArmorImpl(private val api: PGPainless) : Armor {
|
|||
val bufferedOutputStream = BufferedOutputStream(outputStream)
|
||||
|
||||
// Determine the nature of the given data
|
||||
val openPgpIn = OpenPgpInputStream(data)
|
||||
val openPgpIn = OpenPGPAnimalSnifferInputStream(data)
|
||||
openPgpIn.reset()
|
||||
|
||||
if (openPgpIn.isAsciiArmored) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.bouncycastle.openpgp.PGPOnePassSignatureList
|
|||
import org.bouncycastle.openpgp.PGPSignatureList
|
||||
import org.bouncycastle.util.io.Streams
|
||||
import org.pgpainless.PGPainless
|
||||
import org.pgpainless.decryption_verification.OpenPgpInputStream
|
||||
import org.pgpainless.decryption_verification.OpenPGPAnimalSnifferInputStream
|
||||
import org.pgpainless.decryption_verification.cleartext_signatures.ClearsignedMessageUtil
|
||||
import org.pgpainless.exception.WrongConsumingMethodException
|
||||
import org.pgpainless.util.ArmoredOutputStreamFactory
|
||||
|
@ -35,7 +35,7 @@ class InlineDetachImpl(private val api: PGPainless) : InlineDetach {
|
|||
private val sigOut = ByteArrayOutputStream()
|
||||
|
||||
override fun writeTo(outputStream: OutputStream): Signatures {
|
||||
var pgpIn = OpenPgpInputStream(messageInputStream)
|
||||
var pgpIn = OpenPGPAnimalSnifferInputStream(messageInputStream)
|
||||
if (pgpIn.isNonOpenPgp) {
|
||||
throw SOPGPException.BadData("Data appears to be non-OpenPGP.")
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class InlineDetachImpl(private val api: PGPainless) : InlineDetach {
|
|||
}
|
||||
|
||||
// else just dearmor
|
||||
pgpIn = OpenPgpInputStream(armorIn)
|
||||
pgpIn = OpenPGPAnimalSnifferInputStream(armorIn)
|
||||
}
|
||||
|
||||
// If data was not using cleartext signature framework
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue