diff --git a/lib/Service/SmimeService.php b/lib/Service/SmimeService.php index c9e0be73fc..5276e2682d 100644 --- a/lib/Service/SmimeService.php +++ b/lib/Service/SmimeService.php @@ -182,13 +182,16 @@ public function parseCertificate(string $certificate): SmimeCertificateInfo { } } + $decryptedCertificateFile = $this->tempManager->getTemporaryFile(); + file_put_contents($decryptedCertificateFile, $certificate); + $caBundle = [$this->certificateManager->getAbsoluteBundlePath()]; return new SmimeCertificateInfo( $certificateData['subject']['CN'] ?? null, $certificateData['subject']['emailAddress'] ?? $certificateData['subject']['CN'], $certificateData['validTo_time_t'], $purposes, - openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, $caBundle) === true, + openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, $caBundle, $decryptedCertificateFile) === true, ); } @@ -376,13 +379,16 @@ public function signMimePart(Horde_Mime_Part $part, ); } + $decryptedCertificateFile = $this->tempManager->getTemporaryFile(); + file_put_contents($decryptedCertificateFile, $decryptedCertificate); + $inPath = $this->tempManager->getTemporaryFile(); $outPath = $this->tempManager->getTemporaryFile(); file_put_contents($inPath, $part->toString([ 'canonical' => true, 'headers' => true, ])); - if (!openssl_pkcs7_sign($inPath, $outPath, $decryptedCertificate, $decryptedKey, null)) { + if (!openssl_pkcs7_sign($inPath, $outPath, $decryptedCertificate, $decryptedKey, null, PKCS7_DETACHED, $decryptedCertificateFile)) { throw new SmimeSignException('Failed to sign MIME part'); } diff --git a/src/tests/data/user@imap.localhost.chain.crt b/src/tests/data/user@imap.localhost.chain.crt new file mode 100644 index 0000000000..438b49552f --- /dev/null +++ b/src/tests/data/user@imap.localhost.chain.crt @@ -0,0 +1,61 @@ +-----BEGIN CERTIFICATE----- +MIIFUjCCAzqgAwIBAgIQPNReuUyM+DUIY0jIs9wXfjANBgkqhkiG9w0BAQsFADAU +MRIwEAYDVQQDDAlTL01JTUUgQ0EwHhcNMjMwMTI2MTAxMjIzWhcNMjQwMTI2MTAx +MjIzWjAzMQ0wCwYDVQQDDA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JjsJjyE0plX9Bu76soUIL/z/ut9RpomEQ6wvMXqRXy3bPDgGxTnYbK2Zi1yq +lulOO4xqzfn9JX3qN+QDQUc4wpwtqGmkURUMTCd4am2lx1jAs/z4jA03l/8weBPh +2Yw10RtpucQLhpQHeEFz0iYGr0jMMZKieceFjzl4e/5VoChWYLOaf1GIAM+wMpAG +Zw6tNlgXBmKe38UKs3dD6NBU8rGdJni+ysyMKS7jLFEBauP2OEdGgUnnuY8WnHgi +4LC3+GEsTFdDgpSOJ6sUj7f6kQkXjOAHhngReX8Zv+l9pnENtdZiKJCz4Vl4 +-----END CERTIFICATE----- diff --git a/src/tests/unit/util/pkcs12.spec.js b/src/tests/unit/util/pkcs12.spec.js index 9c74d8553b..307bbff3c5 100644 --- a/src/tests/unit/util/pkcs12.spec.js +++ b/src/tests/unit/util/pkcs12.spec.js @@ -36,7 +36,7 @@ describe('pkcs12', () => { }) it('correctly handles PKCS#12 files with multiple cert bags', () => { - const certPem = readTestData('user@imap.localhost.crt').replaceAll('\n', '\r\n') + const certPem = readTestData('user@imap.localhost.chain.crt').replaceAll('\n', '\r\n') const keyPem = readTestData('user@imap.localhost.key').replaceAll('\n', '\r\n') const pkcs12Der = toArrayBuffer(readTestDataRaw('user@imap.localhost.chain.p12')) diff --git a/src/util/pkcs12.js b/src/util/pkcs12.js index 29a999329d..284b8b6181 100644 --- a/src/util/pkcs12.js +++ b/src/util/pkcs12.js @@ -51,7 +51,7 @@ export function convertPkcs12ToPem(pkcs12Der, password) { } return { - certificate: forge.pki.certificateToPem(certBags[0].cert), + certificate: certBags.map((certBag) => forge.pki.certificateToPem(certBag.cert)).join('\r\n'), privateKey: forge.pki.privateKeyToPem(keyBags[0].key), } } diff --git a/tests/Unit/Service/SmimeServiceTest.php b/tests/Unit/Service/SmimeServiceTest.php index 72c18c80d5..b06a4ea475 100644 --- a/tests/Unit/Service/SmimeServiceTest.php +++ b/tests/Unit/Service/SmimeServiceTest.php @@ -423,6 +423,36 @@ public function provideParseCertificateData(): array { false, ), ], + [ // Full chain: Leaf -> Intermediate CA -> CA + $this->getTestCertificate('chain@imap.localhost'), + new SmimeCertificateInfo( + 'chain', + 'chain@imap.localhost', + 4870519697, + new SmimeCertificatePurposes(true, true), + true, + ), + ], + [ // Partial chain: Leaf -> Intermediate CA + $this->getTestCertificate('chain-partial@imap.localhost'), + new SmimeCertificateInfo( + 'chain', + 'chain@imap.localhost', + 4870519697, + new SmimeCertificatePurposes(true, true), + true, + ), + ], + [ // Leaf only + $this->getTestCertificate('chain-leaf-only@imap.localhost'), + new SmimeCertificateInfo( + 'chain', + 'chain@imap.localhost', + 4870519697, + new SmimeCertificatePurposes(true, true), + false, + ), + ], ]; } @@ -435,6 +465,10 @@ public function testParseCertificate(SmimeCertificate $certificate, ->method('getAbsoluteBundlePath') ->willReturn(__DIR__ . '/../../data/smime-certs/imap.localhost.ca.crt'); + $this->tempManager->expects(self::once()) + ->method('getTemporaryFile') + ->willReturnCallback(fn () => $this->createTempFile()); + $this->assertEquals( $expected, $this->smimeService->parseCertificate($certificate->getCertificate()), diff --git a/tests/data/smime-certs/chain-leaf-only@imap.localhost.crt b/tests/data/smime-certs/chain-leaf-only@imap.localhost.crt new file mode 100644 index 0000000000..417fb98c95 --- /dev/null +++ b/tests/data/smime-certs/chain-leaf-only@imap.localhost.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIRAJp/VZ0n301xLR86gjdy8BswDQYJKoZIhvcNAQELBQAw +MDEuMCwGA1UEAwwlaW1hcC5sb2NhbGhvc3QgUy9NSU1FIEludGVybWVkaWF0ZSBD +QTAgFw0yNDA1MjgxODA4MTdaGA8yMTI0MDUwNDE4MDgxN1owNTEOMAwGA1UEAwwF +Y2hhaW4xIzAhBgkqhkiG9w0BCQEWFGNoYWluQGltYXAubG9jYWxob3N0MIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApjW7+drIdItQX4Gjhta1+F4DFAYZ +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2bTOwn+5RRb7QrIYkKETkaXjA7O+cvqVHZ +KPNX9fVu/vAlXsaU0+4Q7I+8NkFNSlPAfcgmzTQ/3ieKTSAWYKLJDrfZf0k5wX+p +HSDPpZkd3f3k751k/SGahyBcAFPm3FSUHMQSiDAYcN33i3Z9O8j9sGtUCJ52/WGi +T0Nw7EKMwm0lEx/Pa4VxoWXGtju6idQ+v3LkJbv8LeYHs7MlXRuHCDopNhiO7wFG +6VfM426J81dGEylMJamJdTlrCfDiQkT864Nt24HkQVgM/MpK4D/YiSOtKUeVJeLh +UxmPB2aP1k1pKJl9GyBdh48L1t12MoNadliH053v4GQ3QorIIRAuPZVP1I+EzIgi +3q/GbuFseJ6PtvZWctX0ZpIGgDEEVusF4wcn5+NkZCgsSAw7JaJU7bIkUi6948IP +e/8qNo5AU/S8X71wgblcgaN36DjVQraYjR6zQTfhWRUIJnA9E65yGPT1I5mNoUT2 +LKrGUdB8XKI= +-----END CERTIFICATE----- diff --git a/tests/data/smime-certs/chain-partial@imap.localhost.crt b/tests/data/smime-certs/chain-partial@imap.localhost.crt new file mode 100644 index 0000000000..73111e192d --- /dev/null +++ b/tests/data/smime-certs/chain-partial@imap.localhost.crt @@ -0,0 +1,62 @@ +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIRAJp/VZ0n301xLR86gjdy8BswDQYJKoZIhvcNAQELBQAw +MDEuMCwGA1UEAwwlaW1hcC5sb2NhbGhvc3QgUy9NSU1FIEludGVybWVkaWF0ZSBD +QTAgFw0yNDA1MjgxODA4MTdaGA8yMTI0MDUwNDE4MDgxN1owNTEOMAwGA1UEAwwF +Y2hhaW4xIzAhBgkqhkiG9w0BCQEWFGNoYWluQGltYXAubG9jYWxob3N0MIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApjW7+drIdItQX4Gjhta1+F4DFAYZ +TD6N+IHz/l30Dby8lUsKCVrss679W3C1mVz6LiXf4XlziIkZjluL10P85pYocU9V +EkPKkKNZlV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aui+LiP4/VUaB +Yz2Nt5OAfAusrXjTlN+TrSj7q8WkJiWBc4RkgccZVG7MIY8EEmUwy3A6vpQ8wzHx +dqV/1GenR3yM4YK1ZQkClCHjlAVSPLpd62WlRAWYJzMAz/7SHPA= +-----END CERTIFICATE----- diff --git a/tests/data/smime-certs/chain@imap.localhost.crt b/tests/data/smime-certs/chain@imap.localhost.crt new file mode 100644 index 0000000000..ad7cfcee4c --- /dev/null +++ b/tests/data/smime-certs/chain@imap.localhost.crt @@ -0,0 +1,92 @@ +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIRAJp/VZ0n301xLR86gjdy8BswDQYJKoZIhvcNAQELBQAw +MDEuMCwGA1UEAwwlaW1hcC5sb2NhbGhvc3QgUy9NSU1FIEludGVybWVkaWF0ZSBD +QTAgFw0yNDA1MjgxODA4MTdaGA8yMTI0MDUwNDE4MDgxN1owNTEOMAwGA1UEAwwF +Y2hhaW4xIzAhBgkqhkiG9w0BCQEWFGNoYWluQGltYXAubG9jYWxob3N0MIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApjW7+drIdItQX4Gjhta1+F4DFAYZ +TD6N+IHz/l30Dby8lUsKCVrss679W3C1mVz6LiXf4XlziIkZjluL10P85pYocU9V +EkPKkKNZlVRDYAdlWdxtoj5oL2BSTmM6vX8SVR1JL8WSwDfWy5t9T0aKR0aX37wF +BABLKB0uGG4JoiTRmG/2Mk/ILahJdzp3RFCeF5PVR5Vui04O17xRZ/lmWzrRPfqH ++F+OUQ9IqSzDGY9RZB9aaiAK48WcHYWJdFTjlm6ls2Mf16AdlbhPnqUSssDeWjjI +R82VGCkY2CSgcVk9IKWEsjhHFD0a753CiojkPGg9U54iA1FePt5fF3YlF1Hj2BU1 +xR2HxBYbOtNRYqH1+BtEHnekTAks5HvjSu2ugNPdcqY/0thh07UzfpMIsfSxr1Ah +KJQIr0fjtZJ0JAVeggHLDLD/gCE5ExN6rAX8mKi0HPrPqUzsYj8yM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