/** * @param NamedCurveFp $curve * @return ObjectIdentifier */ public static function getCurveOid(NamedCurveFp $curve) { if (array_key_exists($curve->getName(), self::$oidMap)) { $oidString = self::$oidMap[$curve->getName()]; return new ObjectIdentifier($oidString); } throw new \RuntimeException('Unsupported curve type.'); }
/** * @param NamedCurveFp $curve * @return string */ public function getCanonicalCurveName(NamedCurveFp $curve) { switch ($curve->getName()) { case 'nist-p256': return 'nistp256'; case 'nist-p384': return 'nistp384'; case 'nist-p521': return 'nistp521'; default: throw new \RuntimeException('Key not supported by git'); } }