Download the PHP package vlucas/pikirasa without Composer
On this page you can find all versions of the php package vlucas/pikirasa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vlucas/pikirasa
More information about vlucas/pikirasa
Files in vlucas/pikirasa
Package pikirasa
Short Description PKI public/private RSA key encryption using the OpenSSL extension
License BSD
Homepage https://github.com/vlucas/pikirasa
Informations about the package pikirasa
Pikirasa
Easy PKI public/private RSA key encryption using the OpenSSL extension.
What's up with the name?
Pikirasa is just "PKI RSA" with a few exta vowels thrown in. Also, I created this project late on a Friday night, so I just couldn't bring myself to name it anything serious.
What is this for?
Pikirasa is very lightweight wrapper around PHP's OpenSSL extension for encrypting and decrypting data with a known public/private key pair. It requires that you have the OpenSSL extension installed, and that your certificates have already been generated.
Pikirasa is not a general purpose or all-encompassing encryption library. If you need more encryption options or maximum system compatability, take a look at phpseclib.
Installation
Just fire up Composer!
Example Usage
All you need is the full path to your public and/or private key files:
Under the hood, Pikirasa will make these paths file streams, and you may use any file stream directly instead :
You can also use the string contents of your public and private keys :
Creating keys
Don't have key files already? No problem - you can simply create new ones :
Need a key size other than the default of 2048 bits? Simply pass the size you
need as the first parameter of $rsa->create()
.
Pikirasa won't overwrite existing key files unless you pass true
to the second
parameter of $rsa->create()
.
If you prefer to work with key strings over key files, you can create keys that way, too :
Using Keys with a Passphrase
The Pikirasa\RSA
class constructor accepts an optional 3rd parameter if your
private key is protected with a password.
This approach also works when creating new keys that should be password protected :
Working with base64-encoded strings
A common pattern if you want to deal with plain strings rather than binary data
is to encode encryped data with base64. If you need to do that, both encrypt
and decrypt
have a base64 counterpart you can use :
All versions of pikirasa with dependencies
ext-openssl Version *