public function privateKeyToDer($privateKey, $privateKyePassword = '')
    {
        try {
            if (strlen($privateKyePassword) === 0) {
                return CryptoVirgilKeyPair::privateKeyToDER($privateKey);
            }

            return CryptoVirgilKeyPair::privateKeyToDER(
                $this->encryptPrivateKey($privateKey, $privateKyePassword),
                $privateKyePassword
            );
        } catch (Exception $exception) {
            throw new PrivateKeyToDerConvertingException($exception->getMessage(), $exception->getCode());
        }
    }
public function privateKeyToDer($privateKey, $privateKyePassword = '')
    {
        try {
            if (strlen($privateKyePassword) === 0) {
                return CryptoVirgilKeyPair::privateKeyToDER($privateKey);
            }

            return CryptoVirgilKeyPair::privateKeyToDER(
                $this->encryptPrivateKey($privateKey, $privateKyePassword),
                $privateKyePassword
            );
        } catch (Exception $exception) {
            throw new PrivateKeyToDerConvertingException($exception->getMessage(), $exception->getCode());
        }
    }
public function privateKeyToDer ( $ privateKey , $ privateKyePassword = '' ) { try { if ( strlen ( $ privateKyePassword ) === 0 ) { return CryptoVirgilKeyPair :: privateKeyToDER ( $ privateKey ) ; } return CryptoVirgilKeyPair :: privateKeyToDER ( $ this -> encryptPrivateKey ( $ privateKey , $ privateKyePassword ) , $ privateKyePassword ) ; } catch ( Exception $ exception ) { throw new PrivateKeyToDerConvertingException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) ) ; } }
Converts private key to DER format.

@param string $privateKey
@param string $privateKyePassword

@return string

@throws PrivateKeyToDerConvertingException
Converts private key to DER format .