Jose\KeyConverter\KeyConverter::loadFromKey PHP Method

loadFromKey() public static method

public static loadFromKey ( string $key, null | string $password = null ) : array
$key string
$password null | string
return array
    public static function loadFromKey($key, $password = null)
    {
        try {
            return self::loadKeyFromDER($key, $password);
        } catch (\Exception $e) {
            return self::loadKeyFromPEM($key, $password);
        }
    }

Usage Example

示例#1
0
 /**
  * {@inheritdoc}
  */
 public static function createFromKey($key, $password = null, array $additional_values = [])
 {
     $values = KeyConverter::loadFromKey($key, $password);
     $values = array_merge($values, $additional_values);
     return new JWK($values);
 }