Skip to content

Commit

Permalink
'xx'
Browse files Browse the repository at this point in the history
  • Loading branch information
lpilp committed Aug 5, 2022
1 parent 78b9e4f commit 3509875
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sm/RtSm2.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,17 @@ public function doEncrypt($document, $publicKey)

}
/**
* SM2 私钥解密算法
* SM2 私钥解密算法,
*
* @param string $document
* @param string $privateKey 如提供的base64的,可使用 bin2hex(base64_decode($privateKey))
* @param bool $trim 是否做04开头的去除,看业务返回
* @return string
*/
public function doDecrypt($encryptData,$privateKey)
public function doDecrypt($encryptData,$privateKey,$trim = true)
{
// $encryptData = $c1.$c3.$c2
if(substr($encryptData,0,2)=='04'){
if(substr($encryptData,0,2)=='04' && $trim){
$encryptData = substr($encryptData,2);
}
$adapter = $this->adapter;
Expand Down

0 comments on commit 3509875

Please sign in to comment.