|
@@ 97-103 (lines=7) @@
|
| 94 |
|
throw new InvalidConfigException('Missing Alipay Config -- [private_key]', 1); |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
if (Str::endsWith($privateKey, '.pem')) { |
| 98 |
|
$privateKey = openssl_pkey_get_private($privateKey); |
| 99 |
|
} else { |
| 100 |
|
$privateKey = "-----BEGIN RSA PRIVATE KEY-----\n". |
| 101 |
|
wordwrap($privateKey, 64, "\n", true). |
| 102 |
|
"\n-----END RSA PRIVATE KEY-----"; |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
openssl_sign(self::getSignContent($parmas), $sign, $privateKey, OPENSSL_ALGO_SHA256); |
| 106 |
|
|
|
@@ 128-134 (lines=7) @@
|
| 125 |
|
throw new InvalidConfigException('Missing Alipay Config -- [ali_public_key]', 2); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
if (Str::endsWith($publicKey, '.pem')) { |
| 129 |
|
$publicKey = openssl_pkey_get_public($publicKey); |
| 130 |
|
} else { |
| 131 |
|
$publicKey = "-----BEGIN PUBLIC KEY-----\n". |
| 132 |
|
wordwrap($publicKey, 64, "\n", true). |
| 133 |
|
"\n-----END PUBLIC KEY-----"; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
$sign = $sign ?? $data['sign']; |
| 137 |
|
|