The problem that the signature generated by the interface is empty

always prompts openssl_sign (): supplied key param cannot be coerced into a private key. I changed the system and the local computer is WIN7, not even under the linux system?
someone on the network said that in the sandbox, the private key needs to be converted, and I report an error directly in the formal environment. At the same time, the public key verification is successful in Alipay.

    
       
        $priKey=$this->rsaPrivateKey;
        $res = "-----BEGIN RSA PRIVATE KEY-----" .PHP_EOL.
            wordwrap($priKey, 64, "\n", true) .PHP_EOL.
            "-----END RSA PRIVATE KEY-----";
        ($res) or die("RSA");
        if ("RSA2" == $signType) {
            openssl_sign($data, $sign, $res, version_compare(PHP_VERSION,"5.4.0", "<") ? SHA256 : OPENSSL_ALGO_SHA256); 
        } else {
            openssl_sign($data, $sign, $res);
        }
        $sign = base64_encode($sign);
        return $sign;

is WIN7 64-bit on the native, while the environment is phpstudy

I haven"t answered my question on OS for a long time. I don"t know why, but I have no direction at all.

Php
Mar.10,2021
The format of

private key is incorrect. See if there is a newline character at the end of your code splicing. Remove one and try


I also encounter this problem because there is a newline deletion

in the private key.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dab8-4da4e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dab8-4da4e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?