工银e生活开发脱坑日志(7)Missing argument 6 for IcbcSignature::verify()

工行沙箱环境测试过程中,出现参数错误,解决如下:

Warning: Missing argument 6 for IcbcSignature::verify(), called in 

原verify类函数

	public static function verify($strToSign, $signType, $publicKey, $charset, $signedStr, $password)//原静态参数;
	{
		if (IcbcConstants::$SIGN_TYPE_CA == $signType) {
			return IcbcCa::verify($strToSign, $publicKey, $password);
		} elseif (IcbcConstants::$SIGN_TYPE_RSA == $signType) {
			return RSA::verify($strToSign, $signedStr, $publicKey, IcbcConstants::$SIGN_SHA1RSA_ALGORITHMS);
		} elseif (IcbcConstants::$SIGN_TYPE_RSA2 == $signType) {
			return RSA::verify($strToSign, $signedStr, $publicKey, IcbcConstants::$SIGN_SHA256RSA_ALGORITHMS);
		} else {
			throw new Exception("Only support CA or RSA signature verify!");
		}
	}

原因在于第六个参数$password,用于CA证书的验证;对于RSA\RSA2中,根本没有用到,导致的。

最直接的解决方式:IcbcSignature.php文件头部添加代码

ini_set("display_errors", "off");
error_reporting(E_ALL | E_STRICT);

只是关闭错误信息提醒,如果要彻底解决该问题,将该类拆分成两个即可,一个专门用于CA证书的验证即可。

posted on 2019-03-26 09:16  漏刻有时  阅读(58)  评论(0)    收藏  举报