roundcubemail/plugins/enigma/lib/enigma_ui.php
private function key_generate()
    {
        // Crypt_GPG does not support key generation for multiple identities
        // It is also very slow (which is problematic because it may exceed
        // request time limit) and requires entropy generator
        // That's why we use only OpenPGP.js method of key generation
        return;

        $user = rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST, true);
        $pass = rcube_utils::get_input_value('_password', rcube_utils::INPUT_POST, true);
        $size = (int) rcube_utils::get_input_value('_size', rcube_utils::INPUT_POST);

        if ($size > 4096) {
            $size = 4096;
        }

        $ident = rcube_mime::decode_address_list($user, 1, false);

        if (empty($ident)) {
            $this->rc->output->show_message('enigma.keygenerateerror', 'error');
            $this->rc->output->send();
        }

        $this->enigma->load_engine();
        $result = $this->enigma->engine->generate_key(array(
            'user'     => $ident[1]['name'],
            'email'    => $ident[1]['mailto'],
            'password' => $pass,
            'size'     => $size,
        ));

        if ($result instanceof enigma_key) {
            $this->rc->output->command('enigma_key_create_success');
            $this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
        }
        else {
            $this->rc->output->show_message('enigma.keygenerateerror', 'error');
        }

        $this->rc->output->send();
    }
private function key_generate()
    {
        // Crypt_GPG does not support key generation for multiple identities
        // It is also very slow (which is problematic because it may exceed
        // request time limit) and requires entropy generator
        // That's why we use only OpenPGP.js method of key generation
        return;

        $user = rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST, true);
        $pass = rcube_utils::get_input_value('_password', rcube_utils::INPUT_POST, true);
        $size = (int) rcube_utils::get_input_value('_size', rcube_utils::INPUT_POST);

        if ($size > 4096) {
            $size = 4096;
        }

        $ident = rcube_mime::decode_address_list($user, 1, false);

        if (empty($ident)) {
            $this->rc->output->show_message('enigma.keygenerateerror', 'error');
            $this->rc->output->send();
        }

        $this->enigma->load_engine();
        $result = $this->enigma->engine->generate_key(array(
            'user'     => $ident[1]['name'],
            'email'    => $ident[1]['mailto'],
            'password' => $pass,
            'size'     => $size,
        ));

        if ($result instanceof enigma_key) {
            $this->rc->output->command('enigma_key_create_success');
            $this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
        }
        else {
            $this->rc->output->show_message('enigma.keygenerateerror', 'error');
        }

        $this->rc->output->send();
    }
private function key_generate ( ) { // Crypt_GPG does not support key generation for multiple identities // It is also very slow (which is problematic because it may exceed // request time limit) and requires entropy generator // That's why we use only OpenPGP.js method of key generation return ; $ user = rcube_utils :: get_input_value ( '_user' , rcube_utils :: INPUT_POST , true ) ; $ pass = rcube_utils :: get_input_value ( '_password' , rcube_utils :: INPUT_POST , true ) ; $ size = ( int ) rcube_utils :: get_input_value ( '_size' , rcube_utils :: INPUT_POST ) ; if ( $ size > 4096 ) { $ size = 4096 ; } $ ident = rcube_mime :: decode_address_list ( $ user , 1 , false ) ; if ( empty ( $ ident ) ) { $ this -> rc -> output -> show_message ( 'enigma.keygenerateerror' , 'error' ) ; $ this -> rc -> output -> send ( ) ; } $ this -> enigma -> load_engine ( ) ; $ result = $ this -> enigma -> engine -> generate_key ( array ( 'user' => $ ident [ 1 ] [ 'name' ] , 'email' => $ ident [ 1 ] [ 'mailto' ] , 'password' => $ pass , 'size' => $ size , ) ) ; if ( $ result instanceof enigma_key ) { $ this -> rc -> output -> command ( 'enigma_key_create_success' ) ; $ this -> rc -> output -> show_message ( 'enigma.keygeneratesuccess' , 'confirmation' ) ; } else { $ this -> rc -> output -> show_message ( 'enigma.keygenerateerror' , 'error' ) ; } $ this -> rc -> output -> send ( ) ; }
Server-side key pair generation handler
Server - side key pair generation handler