mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-22 19:08:00 +01:00
Add support for LibrePGP OED packet
This commit is contained in:
parent
ad2976dbcc
commit
5dfebc5bde
3 changed files with 13 additions and 2 deletions
|
@ -22,6 +22,7 @@ enum class OpenPgpPacket(val tag: Int) {
|
|||
UATTR(17),
|
||||
SEIPD(18),
|
||||
MDC(19),
|
||||
OED(20),
|
||||
PADDING(21),
|
||||
EXP_1(60),
|
||||
EXP_2(61),
|
||||
|
|
|
@ -163,7 +163,8 @@ class OpenPgpMessageInputStream(
|
|||
OpenPgpPacket.PKESK,
|
||||
OpenPgpPacket.SKESK,
|
||||
OpenPgpPacket.SED,
|
||||
OpenPgpPacket.SEIPD -> {
|
||||
OpenPgpPacket.SEIPD,
|
||||
OpenPgpPacket.OED -> {
|
||||
if (processEncryptedData()) {
|
||||
break@layer
|
||||
}
|
||||
|
@ -185,6 +186,10 @@ class OpenPgpMessageInputStream(
|
|||
OpenPgpPacket.UID,
|
||||
OpenPgpPacket.UATTR ->
|
||||
throw MalformedOpenPgpMessageException("Illegal Packet in Stream: $packet")
|
||||
OpenPgpPacket.PADDING -> {
|
||||
LOGGER.debug("Padding packet")
|
||||
pIn.readPadding()
|
||||
}
|
||||
OpenPgpPacket.EXP_1,
|
||||
OpenPgpPacket.EXP_2,
|
||||
OpenPgpPacket.EXP_3,
|
||||
|
@ -319,7 +324,7 @@ class OpenPgpMessageInputStream(
|
|||
"Symmetrically Encrypted Data Packet at depth ${layerMetadata.depth} encountered.")
|
||||
syntaxVerifier.next(InputSymbol.ENCRYPTED_DATA)
|
||||
val encDataList = packetInputStream!!.readEncryptedDataList()
|
||||
if (!encDataList.isIntegrityProtected) {
|
||||
if (!encDataList.isIntegrityProtected && !encDataList.get(0).isAEAD) {
|
||||
LOGGER.warn("Symmetrically Encrypted Data Packet is not integrity-protected.")
|
||||
if (!options.isIgnoreMDCErrors()) {
|
||||
throw MessageNotIntegrityProtectedException()
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.bouncycastle.openpgp.PGPCompressedData
|
|||
import org.bouncycastle.openpgp.PGPEncryptedDataList
|
||||
import org.bouncycastle.openpgp.PGPLiteralData
|
||||
import org.bouncycastle.openpgp.PGPOnePassSignature
|
||||
import org.bouncycastle.openpgp.PGPPadding
|
||||
import org.bouncycastle.openpgp.PGPSignature
|
||||
import org.pgpainless.algorithm.OpenPgpPacket
|
||||
|
||||
|
@ -75,6 +76,10 @@ class TeeBCPGInputStream(inputStream: BCPGInputStream, outputStream: OutputStrea
|
|||
return (readPacket() as MarkerPacket).also { delayedTee.squeeze() }
|
||||
}
|
||||
|
||||
fun readPadding(): PGPPadding {
|
||||
return PGPPadding(packetInputStream).also { delayedTee.squeeze() }
|
||||
}
|
||||
|
||||
fun close() {
|
||||
packetInputStream.close()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue