public function sign($data)
    {
        $privateKeyResource = openssl_pkey_get_private('file://' . $this->filePath);

        $signature = null;
        openssl_sign($data, $signature, $privateKeyResource);

        openssl_free_key($privateKeyResource);

        return $signature;
    }
public function sign($data)
    {
        $privateKeyResource = openssl_pkey_get_private('file://' . $this->filePath);

        $signature = null;
        openssl_sign($data, $signature, $privateKeyResource);

        openssl_free_key($privateKeyResource);

        return $signature;
    }
public function sign ( $ data ) { $ privateKeyResource = openssl_pkey_get_private ( 'file://' . $ this -> filePath ) ; $ signature = null ; openssl_sign ( $ data , $ signature , $ privateKeyResource ) ; openssl_free_key ( $ privateKeyResource ) ; return $ signature ; }
Sign some data with this private key.

Note how we never actually load the private key into memory, we let OpenSSL do this and afterwards immediately
tell OpenSSL to forget the key to reduce chances of leakage.

@param string $data
@return string
Sign some data with this private key .