php+椭圆曲线加密,椭圆曲线加密PHP:可捕捉的致命错误参数1传递给__construct()...

我想使用椭圆曲线加密使用Matyas Danter的phpecc库在1中可用。不过,我收到以下错误,当我创建变量翘,虽然传递的参数是一个点..请帮助..椭圆曲线加密PHP:可捕捉的致命错误参数1传递给__construct()

Catchable fatal error: Argument 1 passed to EcDH::__construct() must be an instance of Point, string given, called in C:\xampp\htdocs\ECC-example.php on line 31 and defined in C:\xampp\htdocs\classes\EcDH.php on line 39

include 'autoload.inc.php';

include 'classes/EcDH.php';

include 'classes/PHPECC.class.php';

include 'classes/SECurve.class.php';

$keypair = PHPECC::hex_keypair_genorate();

$g = NISTcurve::generator_192();

echo $g;

$Alice = new EcDH(g);

............ ..............................

NISTcurve.php具有以下功能:

public static function generator_192() {

// NIST Curve P-192:

if (extension_loaded('gmp') && USE_EXT == 'GMP') {

$_p = '6277101735386680763835789423207666416083908700390324961279';

$_r = '6277101735386680763835789423176059013767194773182842284081';

$_b = gmp_Utils::gmp_hexdec('0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1');

$_Gx = gmp_Utils::gmp_hexdec('0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012');

$_Gy = gmp_Utils::gmp_hexdec('0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811');

$curve_192 = new CurveFp($_p, -3, $_b);

$generator_192 = new Point($curve_192, $_Gx, $_Gy, $_r);

} else if (extension_loaded('bcmath') && USE_EXT == 'BCMATH') {

$_p = '6277101735386680763835789423207666416083908700390324961279';

$_r = '6277101735386680763835789423176059013767194773182842284081';

$_b = bcmath_Utils::bchexdec('0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1');

$_Gx = bcmath_Utils::bchexdec('0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012');

$_Gy = bcmath_Utils::bchexdec('0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811');

$curve_192 = new CurveFp($_p, -3, $_b);

$generator_192 = new Point($curve_192, $_Gx, $_Gy, $_r);

}

return $generator_192;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值