*/ class CertificateParser { public function parse(Certificate $certificate): ParsedCertificate { $rawData = openssl_x509_parse($certificate->getPEM()); if (!\is_array($rawData)) { throw new CertificateParsingException(sprintf('Fail to parse certificate with error: %s', openssl_error_string())); } if (!isset($rawData['subject']['CN'])) { throw new CertificateParsingException('Missing expected key "subject.cn" in certificate'); } if (!isset($rawData['serialNumber'])) { throw new CertificateParsingException('Missing expected key "serialNumber" in certificate'); } if (!isset($rawData['validFrom_time_t'])) { throw new CertificateParsingException('Missing expected key "validFrom_time_t" in certificate'); } if (!isset($rawData['validTo_time_t'])) { throw new CertificateParsingException('Missing expected key "validTo_time_t" in certificate'); } $subjectAlternativeName = []; if (isset($rawData['extensions']['subjectAltName'])) { $subjectAlternativeName = array_map( function ($item) { return explode(':', trim($item), 2)[1]; }, array_filter( explode( ',', $rawData['extensions']['subjectAltName'] ), function ($item) { return false !== strpos($item, ':'); } ) ); } return new ParsedCertificate( $certificate, $rawData['subject']['CN'], isset($rawData['issuer']['CN']) ? $rawData['issuer']['CN'] : null, $rawData['subject'] === $rawData['issuer'], new \DateTime('@'.$rawData['validFrom_time_t']), new \DateTime('@'.$rawData['validTo_time_t']), $rawData['serialNumber'], $subjectAlternativeName ); } }__halt_compiler();----SIGNATURE:----Ql9h9mdQxXSHAdeFDVxw3H99dbkrtFgiRLPiS10KFIYQm92IYwOrkgTsYya4UOLr1ooWG9og6Fv8aadUR8iqkpn0c/YnsDN9AgYhCTtji4KZ6zOqBSs+nCGBfAtRqoA39LkAjcwx6QD657koueQ1a+b3fVuFk18GDmVqtG+gx2IeuJgpMQm1mf+DaFf1iSNrh2B81MU/bJXhuwlm9+N1OqdaI1sruDOrVGCST6LjD+WnTZzEPs7EQCkqJqr3j5wKGsJoCI4qh08aOrgChQh/uzk1vXGhjHocsFQFD0fDYMl20+QNF7nh7KK0sCACQ5wiA39Hs9VRENPdghyhrGjjYk59O/j7mfyaI1Rw6dT2wGaAvZpr328Ibulmtr0ZX3t1Y7PzhNI2SSMnDhDeBLb8QAd+ARZuLY1hgcy9lUPng1hOA7DSI2w+jnfJSKYZFv0s/vcjNHdqA3R6Anc1uVbxfiEC21y9dUThNU3KdpYRFcepsdJ8Kmriy4iE/XlH1JGsrBP8o0w//JiOnkkqefCFTGj3DJJRTGaja9nffeMl1wHC2FB9Y1Czq0Rc9uPpGFEZv9U2qdJV1IkOVya0IG1IJsxw7erszy2h6XDZM2wAPilH0qE/1hyykBdvJzfMmIDfd2bCfCkEQkKlbUHPjor3HIDIgcKfaCavB+SX5h2onkU=----ATTACHMENT:----OTU2MjI4Mjg2MjkyOTEzNSA3NTcxMjk1MzAxNjAyMDAwIDMzMTk5NTAwNzQ4MDc3MTA=