aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2024-09-30 10:24:20 +0200
committerGitHub <noreply@github.com>2024-09-30 10:24:20 +0200
commit6949e21c097d19d965901271dc5aece4401168e5 (patch)
tree4e135726af46075668e2f7bb820f01b200336f12 /tests
parentb2fa6ff1974385d2556126dd91fbc05ff4ed19eb (diff)
parentc4ffd8443949db03cda56deb76b474dc583189f7 (diff)
downloadnextcloud-server-6949e21c097d19d965901271dc5aece4401168e5.tar.gz
nextcloud-server-6949e21c097d19d965901271dc5aece4401168e5.zip
Merge pull request #48317 from nextcloud/backport/48307/stable30
Diffstat (limited to 'tests')
-rw-r--r--tests/data/certificates/openSslTrustedCertificate.crt25
-rw-r--r--tests/lib/Security/CertificateTest.php9
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/data/certificates/openSslTrustedCertificate.crt b/tests/data/certificates/openSslTrustedCertificate.crt
new file mode 100644
index 00000000000..21af3485995
--- /dev/null
+++ b/tests/data/certificates/openSslTrustedCertificate.crt
@@ -0,0 +1,25 @@
+-----BEGIN TRUSTED CERTIFICATE-----
+MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB
+qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
+Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
+MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV
+BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw
+NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j
+LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ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ff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php
index 6f4e736263b..ef43d7cc412 100644
--- a/tests/lib/Security/CertificateTest.php
+++ b/tests/lib/Security/CertificateTest.php
@@ -31,7 +31,7 @@ class CertificateTest extends \Test\TestCase {
$this->expiredCertificate = new Certificate($expiredCertificate, 'ExpiredCertificate');
}
-
+
public function testBogusData() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');
@@ -40,7 +40,12 @@ class CertificateTest extends \Test\TestCase {
$certificate->getIssueDate();
}
-
+ public function testOpenSslTrustedCertificateFormat(): void {
+ $trustedCertificate = file_get_contents(__DIR__ . '/../../data/certificates/openSslTrustedCertificate.crt');
+ $certificate = new Certificate($trustedCertificate, 'TrustedCertificate');
+ $this->assertSame('thawte, Inc.', $certificate->getOrganization());
+ }
+
public function testCertificateStartingWithFileReference() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');