private function validateCertificate($i, $c) { try { $c = new CertParser($c); $expiresAt = $c->getNotValidAfter(); if (time() > $expiresAt) { $this->logWarning(sprintf("certificate '%s' expired at %s [%s]", $c->getName(), date("r", $expiresAt), $i)); } elseif (time() + self::EXPIRY_WARNING_TIME > $expiresAt) { $this->logWarning(sprintf("certificate '%s' expires at %s [%s]", $c->getName(), date("r", $expiresAt), $i)); } } catch (CertParserException $e) { $this->logWarning(sprintf("%s [%s]", $e->getMessage(), $i)); } }
public function testMultipleComponentsInDistinguishedName() { if (PHP_VERSION <= '5.4.0') { $this->markTestSkipped('Works only with PHP >= 5.4'); } else { $certParser = CertParser::fromPemFile(self::getFilePath('2-multi.pem')); $this->assertSame('C=DE, ST=Berlin, L=Berlin, O=FooBar Inc, OU=Testing Multi, OU=Foo, CN=multi.foobar.tld, emailAddress=baz@foobar.tld', $certParser->getSubject()); } }