kittinan/crypt-time-php

CryptTime-PHP is a simple class to encrypt string with timeout. the encryption use AES128/PKCS7.

1.0.0 2014-09-10 17:41 UTC

This package is auto-updated.

Last update: 2024-04-19 20:04:23 UTC


README

Build Status Coverage Status License

CryptTime-PHP is a simple class to encrypt string with timeout. the encryption use AES128/PKCS7.

Requirement

  • PHP 5.3+
  • php-mcrypt

Composer

This plugin on the Packagist.

https://packagist.org/packages/kittinan/crypt-time-php

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.

$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

$cryptTime = \KS\CryptTime::getInstance();
$cryptTime->setIV('MyNewInitialValue');
$cryptTime->setKey('MyNewKeyMyNewKeyMyNewKey');

License

The MIT License (MIT)