for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\JWT\Signer\OpenSSL;
/**
* @author Kevin Bond <[email protected]>
*/
abstract class Key
{
private $value;
private $type;
* @param resource $value
public function __construct($value)
if (!is_resource($value)) {
throw new \InvalidArgumentException('Invalid key.');
}
$keyDetails = openssl_pkey_get_details($value);
if (!is_array($keyDetails) || !isset($keyDetails['type'])) {
$this->value = $value;
$this->type = $keyDetails['type'];
* @return resource
final public function get()
return $this->value;
final public function type()
return $this->type;