search

Home  >  Q&A  >  body text

Signature verification - How to perform SHA512withRSA algorithm signature in PHP?

After searching, I only found the [SHA1withRSA][1] algorithm signature, but not the SHA512withRSA

怪我咯怪我咯2782 days ago1075

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:07:17

    function sign($data) {
        $certs = array();
        openssl_pkcs12_read(file_get_contents("你的.pfx文件路径"), $certs, "password"); //其中password为你的证书密码
        if(!$certs) return ;
        $signature = '';  
        openssl_sign($data, $signature, $certs['pkey'],OPENSSL_ALGO_SHA512);
        return base64_encode($signature); 
    }
    e

    OopensSL_Sign 默认 Signature_alg 参数 是 OpenSSL_Algo_Sha1
    Signature_alg 其他 参数

    OpenSL_Algo_DSS1 (Integer)
    OpenSL_SHA1 (Integer) )
    openssl_algo_sha384 (Integer)
    opensl_algo_sha512 (Integer)
    opensl_algo_rmd160 (integer)
    openssl_algo_md5 (integer )
      OPENSSL_ALGO_MD4 (integer)
      OPENSSL_ALGO_MD2 (integer)
    参考:http://php.net/manual/en/func...

    reply
    0
  • Cancelreply