public function testGetContentToSign() { $params1 = ['bbb' => '2222', 'ccc' => '3333', 'aaa' => '111', 's' => '"."', 'e' => '', 'apple' => 'jobs']; $signer = new Signer($params1); $signer->setIgnores(['apple']); $content = $signer->getContentToSign(); $this->assertEquals('aaa=111&bbb=2222&ccc=3333&s="."', $content); }
protected function sign($params, $signType) { $signer = new Signer($params); $signer->setIgnores(['sign']); $signType = strtoupper($signType); if ($signType == 'RSA') { $sign = $signer->signWithRSA($this->getPrivateKey()); } elseif ($signType == 'RSA2') { $sign = $signer->signWithRSA($this->getPrivateKey(), OPENSSL_ALGO_SHA256); } else { throw new InvalidRequestException('The signType is invalid'); } return $sign; }