Jose\Algorithm\Signature\RSA::sign PHP Method

sign() public method

public sign ( Jose\Object\JWKInterface $key, $input )
$key Jose\Object\JWKInterface
    public function sign(JWKInterface $key, $input)
    {
        $this->checkKey($key);
        Assertion::true($key->has('d'), 'The key is not a private key');
        $priv = new RSAKey($key);
        if ($this->getSignatureMethod() === self::SIGNATURE_PSS) {
            $signature = JoseRSA::sign($priv, $input, $this->getAlgorithm());
            $result = is_string($signature);
        } else {
            $result = openssl_sign($input, $signature, $priv->toPEM(), $this->getAlgorithm());
        }
        Assertion::true($result, 'An error occurred during the creation of the signature');
        return $signature;
    }