mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Fix IndexOutOfBounds, but keep decryption with only SK working
This commit is contained in:
parent
de3afbfc1d
commit
446526c7ec
2 changed files with 5 additions and 6 deletions
|
@ -347,11 +347,10 @@ class OpenPgpMessageInputStream(
|
||||||
syntaxVerifier.next(InputSymbol.ENCRYPTED_DATA)
|
syntaxVerifier.next(InputSymbol.ENCRYPTED_DATA)
|
||||||
|
|
||||||
val encDataList = packetInputStream!!.readEncryptedDataList()
|
val encDataList = packetInputStream!!.readEncryptedDataList()
|
||||||
if (encDataList.isEmpty) {
|
if (!encDataList.isIntegrityProtected &&
|
||||||
LOGGER.debug("Missing encrypted session key packet.")
|
!encDataList.isEmpty &&
|
||||||
return false
|
!encDataList.get(0).isAEAD) {
|
||||||
}
|
|
||||||
if (!encDataList.isIntegrityProtected && !encDataList.get(0).isAEAD) {
|
|
||||||
LOGGER.warn("Symmetrically Encrypted Data Packet is not integrity-protected.")
|
LOGGER.warn("Symmetrically Encrypted Data Packet is not integrity-protected.")
|
||||||
if (!options.isIgnoreMDCErrors()) {
|
if (!options.isIgnoreMDCErrors()) {
|
||||||
throw MessageNotIntegrityProtectedException()
|
throw MessageNotIntegrityProtectedException()
|
||||||
|
|
|
@ -152,7 +152,7 @@ class EncryptImpl(private val api: PGPainless) : Encrypt {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun withPassword(password: String): Encrypt = apply {
|
override fun withPassword(password: String): Encrypt = apply {
|
||||||
encryptionOptions.addMessagePassphrase(Passphrase.fromPassword(password))
|
encryptionOptions.addMessagePassphrase(Passphrase.fromPassword(password).withTrimmedWhitespace())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun modeToStreamEncoding(mode: EncryptAs): StreamEncoding {
|
private fun modeToStreamEncoding(mode: EncryptAs): StreamEncoding {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue