0

1에서 사용할 수있는 Matyas Danter의 phpecc 라이브러리를 사용하여 Elliptic Curve Cryptography를 사용하려고합니다. 내가 전달 된 인수가 포인트이지만 .. 도와주세요, 변수 앨리스를 만들 때 그러나, 나는 .. 타원 곡선 암호 PHP : catchable 치명적 오류 인수 1이 __construct()에 전달되었습니다.

  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); 

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

을 다음과 같은 오류를 얻고있다 ............ ..............................

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; 
} 

답변

0

마지막 줄에 오류가있었습니다.

$ 앨리스 = 새로운 ECDH (g) -> 잘못된

$ 앨리스 = 새로운 ECDH ($의 g) ->

큰 오류의 원인이 sily 실수 올바른 ..