Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Encode/Decode with RSA
  • Hi !
    I don't understand how to encode/decode datas with RSA in FuelPHP.
    There is the Crypt class, but I don't know how to indicate that I want to use RSA.
    There is also the file RSA.php of phpseclib but I feel it's not the good solution to use it directly.

    It would be cool if could give me some indications.

    Thanks !
  • You want to encrypt what exactly? If you tell use what you want to do, we can tell you how to do it.

    The Crypt class uses AES, which is a pretty solid encryption method.
  • I'm developing a medical app for a school project. So, user's data must be encrypted to keep the medical confidentiality. I'd like to encrypt fields of my database 'users' with an asymetric system : RSA, which is imposed by my teacher.

    I thought that the Crypt class could be configured to use RSA.

    So, do I have to use the Crypt_RSA class  directly ? 
  • HarroHarro
    Accepted Answer
    If you want to use PHPSecLib's RSA implementation, you're best of to create your own crypter class, to encapsulate the native class. You can use our Crypt class as an example.

    You can follow the examples found online (like http://phpseclib.sourceforge.net/rsa/examples.html), but instead of

    include('Crypt/RSA.php');

    you need to use

    use \PHPSecLib\Crypt_RSA;

    at the top of your crypter class (like we do in Crypt with Crypt_AES).
  • Thanks, it works very well, I created a class with encode/decode/createKeys methods.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion