| @@ 99-111 (lines=13) @@ | ||
| 96 | ||
| 97 | $fullCertificateChain = array_merge([$peerCertificate], $peerCertificateChain); |
|
| 98 | ||
| 99 | $certificates = array_map(function ($certificate) use ($remoteAddress) { |
|
| 100 | $certificateFields = openssl_x509_parse($certificate); |
|
| 101 | ||
| 102 | $fingerprint = openssl_x509_fingerprint($certificate); |
|
| 103 | $fingerprintSha256 = openssl_x509_fingerprint($certificate, 'sha256'); |
|
| 104 | ||
| 105 | return new SslCertificate( |
|
| 106 | $certificateFields, |
|
| 107 | $fingerprint, |
|
| 108 | $fingerprintSha256, |
|
| 109 | $remoteAddress |
|
| 110 | ); |
|
| 111 | }, $fullCertificateChain); |
|
| 112 | ||
| 113 | return array_unique($certificates); |
|
| 114 | } |
|
| @@ 34-46 (lines=13) @@ | ||
| 31 | return Downloader::downloadCertificateFromUrl($url, $timeout); |
|
| 32 | } |
|
| 33 | ||
| 34 | public static function createFromString(string $certificate): self |
|
| 35 | { |
|
| 36 | $certificateFields = openssl_x509_parse($certificate); |
|
| 37 | ||
| 38 | $fingerprint = openssl_x509_fingerprint($certificate); |
|
| 39 | $fingerprintSha256 = openssl_x509_fingerprint($certificate, 'sha256'); |
|
| 40 | ||
| 41 | return new self( |
|
| 42 | $certificateFields, |
|
| 43 | $fingerprint, |
|
| 44 | $fingerprintSha256 |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function __construct( |
|
| 49 | array $rawCertificateFields, |
|