mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
implement certificate read, parse methods
This commit is contained in:
parent
c1f087e5ec
commit
82bdf211d6
2 changed files with 36 additions and 0 deletions
|
|
@ -74,4 +74,30 @@ abstract class Identity implements \Yggverse\Yoda\Interface\Model\Identity
|
|||
|
||||
throw new Exception;
|
||||
}
|
||||
|
||||
// Read certificate
|
||||
public static function read(
|
||||
OpenSSLCertificate|string $crt
|
||||
): OpenSSLCertificate
|
||||
{
|
||||
if ($result = openssl_x509_read($crt))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
||||
throw new Exception;
|
||||
}
|
||||
|
||||
// Dump certificate
|
||||
public static function parse(
|
||||
OpenSSLCertificate|string $crt
|
||||
): array
|
||||
{
|
||||
if ($result = openssl_x509_parse($crt))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
|
@ -37,4 +37,14 @@ interface Identity
|
|||
OpenSSLCertificate|string|null $crt = null, // self-signed
|
||||
int $days = self::CSR_SIGN_DAYS
|
||||
): OpenSSLCertificate;
|
||||
|
||||
// Read certificate
|
||||
public static function read(
|
||||
OpenSSLCertificate|string $crt
|
||||
): OpenSSLCertificate;
|
||||
|
||||
// Dump certificate
|
||||
public static function parse(
|
||||
OpenSSLCertificate|string $crt
|
||||
): array;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue