protected function _sign($parameters)
    {
        // Fixup our private key, copy-pasting the key might lead to whitespace faults
        if (!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', $this->client->getPrivateKey(), $matches)) {
            die('<p>Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>');
        }

        $key = $matches[2];
        $key = preg_replace('/\s*/s', '', $key);
        $key = chunk_split($key, 64, "\n");

        $key = "-----BEGIN PRIVATE KEY-----\n" . $key . "-----END PRIVATE KEY-----";

        $digest = $this->_sha512Asn1($this->_encodeParameters($parameters));
        if (!@openssl_private_encrypt($digest, $signature, $key)) {
            die('<p>Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>');
        }

        return base64_encode($signature);
    }
protected function _sign($parameters)
    {
        // Fixup our private key, copy-pasting the key might lead to whitespace faults
        if (!preg_match('/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si', $this->client->getPrivateKey(), $matches)) {
            die('<p>Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>');
        }

        $key = $matches[2];
        $key = preg_replace('/\s*/s', '', $key);
        $key = chunk_split($key, 64, "\n");

        $key = "-----BEGIN PRIVATE KEY-----\n" . $key . "-----END PRIVATE KEY-----";

        $digest = $this->_sha512Asn1($this->_encodeParameters($parameters));
        if (!@openssl_private_encrypt($digest, $signature, $key)) {
            die('<p>Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>');
        }

        return base64_encode($signature);
    }
protected function _sign ( $ parameters ) { // Fixup our private key, copy-pasting the key might lead to whitespace faults if ( ! preg_match ( '/-----BEGIN (RSA )?PRIVATE KEY-----(.*)-----END (RSA )?PRIVATE KEY-----/si' , $ this -> client -> getPrivateKey ( ) , $ matches ) ) { die ( '<p>Could not find your private key, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>' ) ; } $ key = $ matches [ 2 ] ; $ key = preg_replace ( '/\s*/s' , '' , $ key ) ; $ key = chunk_split ( $ key , 64 , "\n" ) ; $ key = "-----BEGIN PRIVATE KEY-----\n" . $ key . "-----END PRIVATE KEY-----" ; $ digest = $ this -> _sha512Asn1 ( $ this -> _encodeParameters ( $ parameters ) ) ; if ( ! @ openssl_private_encrypt ( $ digest , $ signature , $ key ) ) { die ( '<p>Could not sign your request, please supply your private key in the ApiSettings file. You can request a new private key in your TransIP Controlpanel.</p>' ) ; } return base64_encode ( $ signature ) ; }
Calculates the hash to sign our request with based on the given parameters.

@param  mixed $parameters The parameters to sign.
@return string               Base64 encoded signing hash.
Calculates the hash to sign our request with based on the given parameters .