phpseclib\Crypt\RSA\PKCS8::savePrivateKey PHP Method

savePrivateKey() static public method

Convert a private key to the appropriate format.
static public savePrivateKey ( phpseclib\Math\BigInteger $n, phpseclib\Math\BigInteger $e, phpseclib\Math\BigInteger $d, array $primes, array $exponents, array $coefficients, string $password = '' ) : string
$n phpseclib\Math\BigInteger
$e phpseclib\Math\BigInteger
$d phpseclib\Math\BigInteger
$primes array
$exponents array
$coefficients array
$password string optional
return string
    static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, $primes, $exponents, $coefficients, $password = '')
    {
        $key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients);
        $key = ASN1::extractBER($key);
        return self::wrapPrivateKey($key, '1.2.840.113549.1.1.1', [], $password);
    }