Example #1
0
SpecBackendBuilder SpecMountpointReader::readMountpointSpecification (KeySet const & cks)
{
	ks = cks;
	mp = ks.head ().dup ();

	Key rmp (mp.dup ());
	helper::removeNamespace (rmp);

	bb.setMountpoint (rmp, mountConf);

	processKey (mp);
	bb.nodes++; // count mp

	ks.lookup (mp, KDB_O_POP);

	ks.rewind (); // we need old fashioned loop, because it can handle ks.cut during iteration
	for (Key k = ks.next (); k; k = ks.next ())
	{
		// search for mountpoint
		Key m = k.getMeta<const Key> ("mountpoint");
		if (m)
		{
			SpecMountpointReader smr (backends, bbi);
			backends[k] = smr.readMountpointSpecification (ks.cut (k));
			continue;
		}

		processKey (k);
		bb.nodes++;
	}

	bb.setBackendConfig (backendConfig);
	bb.useConfigFile (mp.getMeta<std::string> ("mountpoint"));
	return bb;
}
Example #2
0
bool Curses::processKeyInFocus(const Key &key)
{
	if ((key.plain() && key.ukey == '\t')
	    || key == key.DOWN || key == key.SHIFTDOWN
	    || key == key.ENTER)
	{
		transferNextFocus();
		return true;
	}

	if (key == key.UP || key == key.SHIFTUP)
	{
		transferPrevFocus();
		return true;
	}

	if (key == key.PGUP || key == key.SHIFTPGUP)
	{
		int h=getScreenHeight();

		if (h > 5)
			h -= 5;

		if (h < 5)
			h=5;

		while (h)
		{
			processKey(Key(key ==
				       Key::PGUP ? Key::UP:Key::SHIFTUP));
			--h;
		}
		return true;
	}

	if (key == key.PGDN || key == key.SHIFTPGDN)
	{
		int h=getScreenHeight();

		if (h > 5)
			h -= 5;

		if (h < 5)
			h=5;

		while (h)
		{
			processKey(Key(key ==
				       Key::PGDN ? Key::DOWN:Key::SHIFTDOWN));
			--h;
		}
		return true;
	}

	return false;
}
Example #3
0
const QXmlElms QueryXML::getValues(const string& key, QXmlElmPtr element) const
{
	QXmlElms elements;

	/*
	 * Parse from root if no node is given
	 */
	if (element == NULL) element = (QXmlElmPtr) &_doc;

	try
	{
		vector<string> keys;
		string attribute;
		processKey(key, keys, attribute);

		for (Node* child = getElement(element, keys); child; child = child->NextSibling(false))
		{
			if (child->Type() == TiXmlNode::ELEMENT && child->Value().compare(keys.back()) == 0)
			{
				elements.push_back((QXmlElmPtr) child->ToElement());
			}
		}

	} catch (Exceptions& exception)
	{
		showError(exception, key);
	}

	return elements;
}
SM_STATE(KEY_RX, KEY_RECEIVE)
{
	SM_ENTRY_MA(KEY_RX, KEY_RECEIVE, key_rx);

	processKey();
	sm->rxKey = FALSE;
}
Example #5
0
bool ShortcutDialog::eventFilter(QObject *object, QEvent *event)
{
    if (object != ui->lineEditShortcut)
        return false;

    if (event->type() == QEvent::KeyPress) {
        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
        COPYQ_LOG(QString("Shortcut key press: %1").arg(keyEvent->key()));

        const int key = createPlatformNativeInterface()->keyCode(*keyEvent);
        Qt::KeyboardModifiers mods = getModifiers(*keyEvent);

        if (mods == Qt::NoModifier) {
            if (key == Qt::Key_Tab)
                return false;

            if (key == Qt::Key_Escape) {
                reject();
                return true;
            }

            if (m_expectModifier)
                return true;
        }

        event->accept();
        processKey(key, mods);

        if ( isNonModifierKey(key) )
            accept();

        return false;
    } else if (event->type() == QEvent::KeyRelease) {
        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
        COPYQ_LOG(QString("Shortcut key release: %1").arg(keyEvent->key()));

        Qt::KeyboardModifiers mods = getModifiers(*keyEvent);

        processKey(0, mods);

        return true;
    }

    return false;
}
Example #6
0
AbcKeyboardFilter::AbcKeyboardFilter()
    : QWSServer::KeyboardFilter() {
    server = qteapp_get_server();
    tHandler = new KeyTimerHandler(this);
    timer = new QTimer(tHandler, "KeyTimer");
    tHandler->connect(timer, SIGNAL(timeout()), SLOT(processKey()));
    caps = false;
    clear();
}
Example #7
0
/**
*  Decrypts a string and removes the padding using either private or public key. 
* (depending on mode).
*  @param ciphertext: binary string to be decrypted.
*  @param key: table containing either the public or the private key, as generated by gen_key.
*  @return  The original message (if everything works ok).
*  @see  rsa_genkey
*/
static int luarsa_pkcs1_decrypt (lua_State *L) {
	int res = 0;
	int mode;
    size_t lmsg, lresult;
    rsa_context rsa;
    char *message = (char*)luaL_checklstring(L, 1, &lmsg); /* ciphertext */
    char result[KEY_SIZE];
    
    rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL ); 
    

    mode = processKey(L, 2, &rsa); /* keytable */
    
    rsa.len = lmsg;

    memset(result, 0, KEY_SIZE);
    printf("\nMode==%s\n", mode==RSA_PUBLIC ? "RSA_PUBLIC" : "RSA_PRIVATE" );
    printf("Size==%d\n", lmsg );
    printf("Crypt.Size==%d\n", rsa.len );
    
    printf("ver: %d\n", rsa.ver);
    printf("len: %d\n", rsa.len);
    printf("padding: %d\n", rsa.padding);
    printf("hash_id: %d\n", rsa.hash_id);
    
    mpi_print("N:%s\n", &rsa.N);
    mpi_print("E:%s\n", &rsa.E);
    
    if(mode!=RSA_PUBLIC) {
        mpi_print("D:%s\n", &rsa.D);
        mpi_print("P:%s\n", &rsa.P);
        mpi_print("Q:%s\n", &rsa.Q);
        mpi_print("DP:%s\n", &rsa.DP);
        mpi_print("DQ:%s\n", &rsa.DQ);
        mpi_print("QP:%s\n", &rsa.QP);

        //mpi_print("RN:%s\n", &rsa.RN);
        //mpi_print("RP:%s\n", &rsa.RP);
        //mpi_print("RQ:%s\n", &rsa.RQ);
    }
    
    // pass rsa context and ciphertext to decryption engine
    res = rsa_pkcs1_decrypt(&rsa, RSA_PRIVATE, &lmsg, message, result);
    printf("Orig.Size==%d\n", lmsg );
    
    if(res) {
    	luaL_error(L, "Error during cipher (%d)", res);
    }
    
    // push encrypted result buffer
    lua_pushlstring(L, result, lmsg); /* ciphertext */

    rsa_free( &rsa );
    
    return 1;
}
Example #8
0
bool ShortcutDialog::eventFilter(QObject *object, QEvent *event)
{
    if (object != ui->lineEditShortcut)
        return QDialog::eventFilter(object, event);

    if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
        auto keyEvent = static_cast<QKeyEvent*>(event);
        const int key = createPlatformNativeInterface()->keyCode(*keyEvent);
        const int mods = getModifiers(*keyEvent);

        if (mods == Qt::NoModifier) {
            if (key == Qt::Key_Tab)
                return QDialog::eventFilter(object, event);

            if (key == Qt::Key_Escape) {
                reject();
                return true;
            }
        }

        event->accept();

        if (event->type() == QEvent::KeyPress) {
            COPYQ_LOG(QString("Shortcut key press: %1").arg(keyEvent->key()));

            if ( isModifierKey(keyEvent->key()) ) {
                processKey(0, mods);
            } else {
                processKey(key, mods);
                accept();
            }
        } else if (result() != QDialog::Accepted) {
            COPYQ_LOG(QString("Shortcut key release: %1").arg(keyEvent->key()));
            processKey(0, mods);
        }

        return true;
    }

    return QDialog::eventFilter(object, event);
}
Example #9
0
void Game::processEvent(Event &evt)
{
    switch (evt.type)
    {
        case Event::Closed:
            pWnd->close();
            break;
        case Event::KeyPressed:
            processKey(evt.key.code);
            break;
    }
}
Example #10
0
//! called if an event happened.
bool CGUIEditBox::OnEvent(const SEvent& event)
{
#ifndef SERVER_ONLY
    if (isEnabled())
    {

        switch(event.EventType)
        {
        case EET_GUI_EVENT:
            if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
            {
                if (event.GUIEvent.Caller == this)
                {
                    MouseMarking = false;
                    setTextMarkers(0,0);
                }
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
                CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
                dl->setIMEEnable(false);
#endif
            }
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
            else if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUSED)
            {
                CIrrDeviceLinux* dl = dynamic_cast<CIrrDeviceLinux*>(irr_driver->getDevice());
                dl->setIMEEnable(true);
                dl->setIMELocation(calculateICPos());
            }
#endif
            break;
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
        case EET_IMPUT_METHOD_EVENT:
            if (processIMEEvent(event))
                return true;
            break;
#endif
        case EET_KEY_INPUT_EVENT:
            if (processKey(event))
                return true;
            break;
        case EET_MOUSE_INPUT_EVENT:
            if (processMouse(event))
                return true;
            break;
        default:
            break;
        }
    }
#endif
    return IGUIElement::OnEvent(event);
}
Example #11
0
PS2KeyboardManager::Report PS2KeyboardManager::read() {
  if (ps2_keyboard_->available() > 0)
    processKey(transformKey(ps2_keyboard_->read()));

  // See page 62-63 in HID11_1.pdf for more details.
  Report report;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_LSHFT) ? M_LSHFT : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_LCTRL) ? M_LCTRL : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_LALT) ? M_LALT : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_LGUI) ? M_LGUI : 0;

  report.modifiers |= isKeyPressed(PS2Keyboard::KC_RSHFT) ? M_RSHFT : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_RCTRL) ? M_RCTRL : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_RALT) ? M_RALT : 0;
  report.modifiers |= isKeyPressed(PS2Keyboard::KC_RGUI) ? M_RGUI : 0;

  collectKeysDown(&report);
  return report;
}
/*************************************************
 *
 * Run the keying state machine that is defined in the 802.1x standard.  
 * Depending on the state, we may need to process a key.
 *
 *************************************************/
void run_key_statemachine(struct interface_data *thisint, char *inframe,
			  int insize)
{
  if ((!thisint) || (!inframe))
    {
      debug_printf(DEBUG_NORMAL, "Invalid data passed in to run_key_statemachine()!\n");
      return;
    }

  if ((thisint->statemachine->initialize == TRUE) ||
      (thisint->statemachine->portEnabled == FALSE))
    {
      // Do the NO_KEY_RECIEVE part of the state machine.

    }

  if (thisint->statemachine->rxKey == TRUE)
    {
      processKey(thisint, inframe, insize);
      thisint->statemachine->rxKey = FALSE;
    }
}
Example #13
0
bool QueryXML::hasValue(const std::string& key, QXmlElmPtr el) const
{
	if (el == NULL) el = (QXmlElmPtr) &_doc;

	std::vector<std::string> keys;
	std::string attribute;

	try
	{
		processKey(key, keys, attribute);
		QXmlElmPtr element = getElement(el, keys);

		if (!element)
			return false;
		else
			return true;

	} catch (Exceptions& exception)
	{
		showError(exception, key);
	}

	return false;
}
Example #14
0
void LaunchyWidget::keyPressEvent(QKeyEvent* event)
{
#ifdef Q_WS_X11
    // ignore hotkey
    if (event->modifiers() + event->key() == getHotkey()) {
        return;
    }
#endif

	if (event->key() == Qt::Key_Escape)
	{
		if (alternatives->isVisible())
			showAlternatives(false);
		else
			hideLaunchy();
	}

	else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
	{
		doEnter();
	}

	else if (event->key() == Qt::Key_Down || event->key() == Qt::Key_PageDown || 
			 event->key() == Qt::Key_Up || event->key() == Qt::Key_PageUp)
	{
		if (alternatives->isVisible())
		{
			if (!alternatives->isActiveWindow())
			{
				// Don't refactor the activateWindow outside the if, it won't work properly any other way!
				if (alternatives->currentRow() < 0 && alternatives->count() > 0)
				{
					alternatives->activateWindow();
					alternatives->setCurrentRow(0);
				}
				else
				{
					alternatives->activateWindow();
					qApp->sendEvent(alternatives, event);
				}
			}
		}
		else if (event->key() == Qt::Key_Down || event->key() == Qt::Key_PageDown)
		{
			// do a search and show the results, selecting the first one
			searchOnInput();
			if (searchResults.count() > 0)
			{
				showAlternatives();
				alternatives->activateWindow();
				if (alternatives->count() > 0)
					alternatives->setCurrentRow(0);
			}
		}
	}

	else if ((event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backspace) && event->modifiers() == Qt::ShiftModifier)
	{
		doBackTab();
		processKey();
	}
	else if (event->key() == Qt::Key_Tab)
	{
		doTab();
		processKey();
	}
	/*
	else if (event->key() == Qt::Key_Slash || event->key() == Qt::Key_Backslash)
	{
		if (inputData.count() > 0 && inputData.last().hasLabel(LABEL_FILE))
			doTab();
		processKey();
	}
	*/
	else if (event->text().length() > 0)
	{
		// process any other key with character output
		event->ignore();
		processKey();
	}
}
Example #15
0
void LaunchyWidget::alternativesKeyPressEvent(QKeyEvent* event)
{
	if (event->key() == Qt::Key_Escape)
	{
		showAlternatives(false);
		event->ignore();
                this->input->setFocus();
	}
	else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter || event->key() == Qt::Key_Tab)
	{
		if (searchResults.count() > 0)
		{
			int row = alternatives->currentRow();
			if (row > -1)
			{
				QString location = "History/" + input->text();
				QStringList hist;
				hist << searchResults[row].lowName << searchResults[row].fullPath;
				gSettings->setValue(location, hist);

				if (row > 0)
					searchResults.move(row, 0);

				if (event->key() == Qt::Key_Tab)
				{
					doTab();
					processKey();
				}
				else
				{
					// Load up the inputData properly before running the command
					/* commented out until I find a fix for it breaking the history selection
					inputData.last().setTopResult(searchResults[0]);
					doTab();
					inputData.parse(input->text());
					inputData.erase(inputData.end() - 1);*/

					updateOutputWidgets();
					keyPressEvent(event);
				}
			}
		}
	}
	else if (event->key() == Qt::Key_Delete && (event->modifiers() & Qt::ShiftModifier) != 0)
	{
		int row = alternatives->currentRow();
		if (row > -1)
		{
			if (searchResults[row].id == HASH_HISTORY)
			{
				// Delete selected history entry from the alternatives list
				history.removeAt(row);
				input->clear();
				processKey();
				alternativesRowChanged(alternatives->currentRow());
			}
			else
			{
				// Demote the selected item down the alternatives list
				catalog->demoteItem(searchResults[row]);
				searchOnInput();
				updateOutputWidgets(false);
			}
			showAlternatives(true, false);
		}
	}
	else if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right ||
			 event->text().length() > 0)
	{
		// Send text entry to the input control
		activateWindow();
		input->setFocus();
		event->ignore();
		input->keyPressEvent(event);
		keyPressEvent(event);
	}
        alternatives->setFocus();
}
	void ObjectRefInstance::process(real currentTime)
	{
		processKey(currentTime);
		processTransform();
	}
Example #17
0
void CommandPanel::keyPressEvent(QKeyEvent *event)
{
   event->accept(); // consume event if it arrived via default event handing mechanism
   processKey(Qt::Key(event->key()));
}
Example #18
0
PlayfairCipher::PlayfairCipher(std::string cipher_key) : key_{cipher_key}
{
  processKey();
}
void App::process()
{
    if (sources.empty())
    {
        std::cout << "Using default frames source...\n";
        sources.push_back(new VideoSource("data/bgfg/haut-640x480.avi"));
    }

    cv::Mat frame;
    cv::gpu::GpuMat d_frame;
    IplImage ipl_frame;

    cv::Mat fgmask;
    cv::gpu::GpuMat d_fgmask;
    cv::Mat buf;

    cv::Mat outImg;
    cv::Mat foreground;

    while (!exited)
    {
        int64 total_time = cv::getTickCount();

        sources[curSource]->next(frame);
        d_frame.upload(frame);
        ipl_frame = frame;
        frame.copyTo(outImg);

        double total_fps = 0.0;
        double proc_fps = 0.0;

        try
        {
            int64 proc_time = cv::getTickCount();

            switch (method) {
            case MOG:
                {
                    if (useGpu)
                    {
                        if (reinitialize)
                            mog_gpu.initialize(d_frame.size(), d_frame.type());
                        mog_gpu(d_frame, d_fgmask, 0.01f);
                    }
                    else
                    {
                        if (reinitialize)
                            mog_cpu.initialize(frame.size(), frame.type());
                        mog_cpu(frame, fgmask, 0.01);
                    }
                    break;
                }
            //case MOG2:
            //    {
            //        if (useGpu)
            //        {
            //            if (reinitialize)
            //                mog2_gpu.initialize(d_frame.size(), d_frame.type());
            //            mog2_gpu(d_frame, d_fgmask);
            //        }
            //        else
            //        {
            //            if (reinitialize)
            //            {
            //                mog2_cpu.set("detectShadows", false);
            //                mog2_cpu.initialize(frame.size(), frame.type());
            //            }
            //            mog2_cpu(frame, fgmask);
            //        }
            //        break;
            //    }
            case FGD:
                {
                    if (useGpu)
                    {
                        if (reinitialize)
                            fgd_gpu.create(d_frame);
                        fgd_gpu.update(d_frame);
                        fgd_gpu.foreground.copyTo(d_fgmask);
                    }
                    else
                    {
                        if (reinitialize)
                            fgd_cpu = cvCreateFGDStatModel(&ipl_frame);
                        cvUpdateBGStatModel(&ipl_frame, fgd_cpu);
                        cv::Mat(fgd_cpu->foreground).copyTo(fgmask);
                    }
                    break;
                }
            //case GMG:
            //    {
            //        if (useGpu)
            //        {
            //            if (reinitialize)
            //                gmg_gpu.initialize(d_frame.size());
            //            gmg_gpu(d_frame, d_fgmask);
            //        }
            //        else
            //        {
            //            if (reinitialize)
            //                gmg_cpu.initialize(frame.size(), 0, 255);
            //            gmg_cpu(frame, fgmask);
            //        }
            //        break;
            //    }
            case VIBE:
                {
                    if (useGpu)
                    {
                        if (reinitialize)
                            vibe_gpu.initialize(d_frame);
                        vibe_gpu(d_frame, d_fgmask);
                    }
                    break;
                }
            }

            proc_fps = cv::getTickFrequency() / (cv::getTickCount() - proc_time);

            if (useGpu)
                d_fgmask.download(fgmask);

            cv::filterSpeckles(fgmask, 0, 100, 1, buf);

            cv::add(outImg, cv::Scalar(100, 100, 0), outImg, fgmask);

            foreground.create(frame.size(), frame.type());
            foreground.setTo(0);
            frame.copyTo(foreground, fgmask);

            total_fps = cv::getTickFrequency() / (cv::getTickCount() - total_time);

            reinitialize = false;
        }
        catch (const cv::Exception&)
        {
            std::string msg = "Can't allocate memory";

            int fontFace = cv::FONT_HERSHEY_DUPLEX;
            int fontThickness = 2;
            double fontScale = 0.8;

            cv::Size fontSize = cv::getTextSize("T[]", fontFace, fontScale, fontThickness, 0);

            cv::Point org(outImg.cols / 2, outImg.rows / 2);
            org.x -= fontSize.width;
            org.y -= fontSize.height / 2;

            cv::putText(outImg, msg, org, fontFace, fontScale, cv::Scalar(0,0,0,255), 5 * fontThickness / 2, 16);
            cv::putText(outImg, msg, org, fontFace, fontScale, CV_RGB(255, 0, 0), fontThickness, 16);
        }

        displayState(outImg, proc_fps, total_fps);

        cv::imshow("Background Subtraction Demo", outImg);
        cv::imshow("Foreground", foreground);

        processKey(cv::waitKey(30) & 0xff);
    }
}
Example #20
0
void PlayfairCipher::setKey(std::string key)
{
  key_ = key;
  processKey();
}
Example #21
0
/**
*  Adds padding and encrypts a string using either private or public key. 
* (depending on mode).
*  @param message: arbitrary binary string to be encrypted.
*  @param keytable: table containing either the public or the private key, as generated by gen_key.
*  @return  The cyphertext (as a binary string).
*  @see  rsa_genkey
*/
static int luarsa_pkcs1_encrypt (lua_State *L) {
	int res = 0;
	int mode;
    size_t lmsg, lresult;
    rsa_context rsa;
    char *message = (char*)luaL_checklstring(L, 1, &lmsg); /* message */
    char result[KEY_SIZE];
char alt_result[KEY_SIZE];
    char* strMode=NULL;
    if(lua_type(L, 3)==LUA_TSTRING) {
        printf("Got parameter\n");
        strMode = (char*)lua_tostring(L, 3);
        printf("[%s]\n", strMode);
        mode = strncmp(strMode, "private", 7) ? RSA_PUBLIC : RSA_PRIVATE;
    }
    
    rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL ); 
    
    processKey(L, 2, &rsa); /* keytable */
    
    rsa.len = ( mpi_msb( &rsa.N ) + 7 ) >> 3;
    
    memset(result, 0, KEY_SIZE);
    
// <test> by Jason
    printf("\nMode==%s\n", mode==RSA_PUBLIC ? "RSA_PUBLIC" : "RSA_PRIVATE" );
    printf("Size==%d\n", lmsg );
    printf("Crypt.Size==%d\n", rsa.len );
    
    printf("ver: %d\n", rsa.ver);
    printf("len: %d\n", rsa.len);
    printf("padding: %d\n", rsa.padding);
    printf("hash_id: %d\n", rsa.hash_id);
    
    mpi_print("N:%s\n", &rsa.N);
    mpi_print("E:%s\n", &rsa.E);
    
    if(mode!=RSA_PUBLIC) {
        //mpi_print("D:%s\n", &rsa.D);
        //mpi_print("P:%s\n", &rsa.P);
        //mpi_print("Q:%s\n", &rsa.Q);
        //mpi_print("DP:%s\n", &rsa.DP);
        //mpi_print("DQ:%s\n", &rsa.DQ);
        //mpi_print("QP:%s\n", &rsa.QP);

        //mpi_print("RN:%s\n", &rsa.RN);
        //mpi_print("RP:%s\n", &rsa.RP);
        //mpi_print("RQ:%s\n", &rsa.RQ);
    }
// </test> by Jason

    // pass rsa context and message to encryption engine
    res = rsa_pkcs1_encrypt(&rsa, RSA_PUBLIC, lmsg, message, result);
    
    if(res)
    	luaL_error(L, "Error during cipher (%d)", res);
/*    
    lmsg = 128;
    res = rsa_pkcs1_decrypt(&rsa, mode, &lmsg, result, alt_result);
    
    if(res)
    	luaL_error(L, "Error during decipher (%d)", res);
    
    printf("(%d)", lmsg);
*/
    push_private_key(L, &rsa);
    
    // push encrypted result buffer
    lua_pushlstring(L, result, rsa.len); /* ciphertext */

    rsa_free( &rsa );
    
    return 1;
}