Data encryption using public and private keys.

1.1.0 2022-07-26 09:07 UTC

This package is auto-updated.

Last update: 2024-05-26 13:06:47 UTC


Build Status Latest Stable Version License Total Downloads PHP Classes

RSA Crypt

This class can RSA generate keys and encrypt data using OpenSSL.

It can generate public and private RSA keys of given length calling the openssl program.

The class and also encrypt data with a given public key file and decrypt data with a given private key file.

More information


  • PHP version ~5.3.3


  1. Install composer

  2. Follow in the project folder:

composer require dmamontov/rsacrypt ~1.0.2

In config composer.json your project will be added to the library dmamontov/rsacrypt, who settled in the folder vendor/. In the absence of a config file or folder with vendors they will be created.

If before your project is not used composer, connect the startup file vendors. To do this, enter the code in the project:

require 'path/to/vendor/autoload.php';

Example of work

$crypt = new RsaCrypt;

$data = $crypt->encrypt("Test Crypt");

echo $data;
echo $crypt->decrypt($data);