public static function getDhGen() { return base64_encode(self::$bigmath->btwoc(self::DH_G)); } public static function getDhPrivateKey($server) { self::loadData(); return self::$data[$server]['__private']; } public static function getDhPublicKey($server) { self::loadData(); $key = self::createDhKey($server); self::saveData(); return base64_encode(self::$bigmath->btwoc(self::$bigmath->powmod(self::DH_G, $key, self::DH_P))); } private static function createDhKey($server) { return self::$data[$server]['__private'] = self::$bigmath->rand(self::DH_P); } public static function supportsDH() { return self::$bigmath != null; } public static function init() { self::$bigmath = BigMath::getBigMath(); } } KeyManager::init();