public static function encrypt_secret($secret)
    {
        global $CFG;
        if ( startsWith($secret,'AES::') ) return $secret;
        $encr = AesCtr::encrypt($secret, $CFG->cookiesecret, 256) ;
        return 'AES::'.$encr;
    }