$modulus->SetIntBuffer($Modulus);
$publicExponent = new ASNValue(ASNValue::TAG_INTEGER);
$publicExponent->SetIntBuffer($PublicExponent);
- $keySequenceItems = array($modulus, $publicExponent);
+ $keySequenceItems = [$modulus, $publicExponent];
$keySequence = new ASNValue(ASNValue::TAG_SEQUENCE);
$keySequence->SetSequence($keySequenceItems);
//Encode bit string
$modulus->SetIntBuffer($Modulus);
$publicExponent = new ASNValue(ASNValue::TAG_INTEGER);
$publicExponent->SetIntBuffer($PublicExponent);
- $keySequenceItems = array($modulus, $publicExponent);
+ $keySequenceItems = [$modulus, $publicExponent];
$keySequence = new ASNValue(ASNValue::TAG_SEQUENCE);
$keySequence->SetSequence($keySequenceItems);
//Encode bit string
* @param string $e exponent reference
* @return void
*/
- private static function pemToMe($key, &$m, &$e)
+ public static function pemToMe($key, &$m, &$e)
{
$lines = explode("\n", $key);
unset($lines[0]);
return $key;
}
- /**
- * @param string $pubkey public key
- * @return string
- */
- public static function salmonKey($pubkey)
- {
- self::pemToMe($pubkey, $m, $e);
- return 'RSA' . '.' . base64url_encode($m, true) . '.' . base64url_encode($e, true);
- }
-
/**
* @param integer $bits number of bits
* @return mixed
*/
public static function newKeypair($bits)
{
- $openssl_options = array(
+ $openssl_options = [
'digest_alg' => 'sha1',
'private_key_bits' => $bits,
'encrypt_key' => false
- );
+ ];
$conf = Config::get('system', 'openssl_conf_file');
if ($conf) {
}
// Get private key
- $response = array('prvkey' => '', 'pubkey' => '');
+ $response = ['prvkey' => '', 'pubkey' => ''];
openssl_pkey_export($result, $response['prvkey']);