| Conditions | 3 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public static function toPem($pfx, $password): string |
||
| 18 | { |
||
| 19 | $p12cert = array(); |
||
| 20 | $p12buf = self::read($pfx); |
||
| 21 | $p12cert = self::pkcs12Read($p12buf, $p12cert, $password); |
||
| 22 | |||
| 23 | if (empty($p12cert['cert']) || empty($p12cert['pkey'])) { |
||
| 24 | throw new \RuntimeException('Cert file not include info.'); |
||
| 25 | } |
||
| 26 | |||
| 27 | $pem = $p12cert['cert'] . "\n" . $p12cert['pkey'] . "\n"; |
||
| 28 | |||
| 29 | return self::addExtracerts($pem, $p12cert); |
||
| 30 | } |
||
| 80 |