Dev Portal Installation: Crypto Undefined Offset Error

Not applicable

I'm seeing the following error on Apigee Dev Portal on premise install version 4.14.07.03. This error appears on the Database Update page. e.g, https://server.com/update.php

Notice: Undefined offset: 1 in Apigee\Util\Crypto::decrypt() (line 91 of /u01/apigee/var/www/html/profiles/apigee/libraries/mgmt-api-php-sdk/Apigee/Util/Crypto.php).

Here's the method. Line 91 is

list ($length, $password) = explode("\n", $decrypted, 2);

  /**
     * Decrypts a string which was encrypted with Crypto::encrypt().
     *
     * @static
     * @param string $scrambled
     * @return string
     */
    public static function decrypt($scrambled)
    {
        $iv_base64 = substr($scrambled, 0, 22) . '==';
        $string_encrypted = substr($scrambled, 22);


        $iv = base64_decode($iv_base64);
        if ($iv === false || strlen($iv) < 16) {
            throw new \Apigee\Exceptions\ParameterException('Unable to parse encrypted string.');
        }
        $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, self::$cryptoKey, base64_decode($string_encrypted), MCRYPT_MODE_CBC, $iv);
        list ($length, $password) = explode("\n", $decrypted, 2);
        return substr($password, 0, intval($length));
    }

Any ideas what would cause this?

Thanks,

Mike

Solved Solved
0 1 287
1 ACCEPTED SOLUTION

Not applicable

Hi Mike,

Can you please check for the current EDGE connection details ( which is encrypted in private files ). In this version of OPDK, there is no check to validate If $scrambled is not valid base64 and throw an exception.

Thanks, Seshi

View solution in original post

1 REPLY 1

Not applicable

Hi Mike,

Can you please check for the current EDGE connection details ( which is encrypted in private files ). In this version of OPDK, there is no check to validate If $scrambled is not valid base64 and throw an exception.

Thanks, Seshi