CryptTime-PHP
, (*1)
CryptTime-PHP is a simple class to encrypt string with timeout. the encryption use AES128/PKCS7., (*2)
Requirement
Composer
This plugin on the Packagist., (*3)
https://packagist.org/packages/kittinan/crypt-time-php, (*4)
Quick Start.
$plainText = 'Hello World';
$cryptTime = \KS\CryptTime::getInstance();
$cipherText = $cryptTime->encrypt($plainText); //Default timeout is 86400 seconds (1 day)
$decryptText = $cryptTime->decrypt($cipherText);
if you want to encrypt string with 10 minutes timeout., (*5)
$plainText = 'Hello World';
$cryptTime = \KS\CryptTime::getInstance();
$cipherText = $cryptTime->encrypt($plainText, 600); //10 minutes = 600 seconds
$decryptText = $cryptTime->decrypt($cipherText);
you can set IV and Key, (*6)
$cryptTime = \KS\CryptTime::getInstance();
$cryptTime->setIV('MyNewInitialValue');
$cryptTime->setKey('MyNewKeyMyNewKeyMyNewKey');
License
The MIT License (MIT), (*7)