mblsolutions / mcryptgatewayservice
Package to allow interaction to MBL Solutions Mcrypt Gateway
Installs: 2 460
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=7.1.0
- ext-json: *
- guzzlehttp/guzzle: ^6.3|^7.0
Requires (Dev)
- phpunit/phpunit: ~7.0
- vlucas/phpdotenv: ~2.0
README
Package to interact with the MBL Solutions Mcrypt Gateway Service.
Allows versions of PHP that do not support mcrypt_encrypt and mcrypt_decrypt to handle Mcrypt encryption and decryption.
Installation with Composer
composer require mblsolutions/mcryptgatewayservice
Usage
Data passed in should be base64 encoded
Encryption
$mcryptService = new MBLSolutions\McryptService('https://example.execute-api.eu-west-1.amazonaws.com', 'prod'); $string = base64_encode('password'); // Encrypted base64 encoded string `password` $secret = base64_encode('thisisatwentyfourcharkey'); // encryption secret $result = $mcryptService->encrypt($string, $secret); // Encrypts into 0sQg7vz6S9g=
Decryption
$mcryptService = new MBLSolutions\McryptService('https://example.execute-api.eu-west-1.amazonaws.com', 'prod'); $encrypted = '0sQg7vz6S9g='; // Encrypted base64 encoded string `password` $secret = base64_encode('thisisatwentyfourcharkey'); // encryption secret $result = $mcryptService->decrypt($encrypted, $secret); // Decrypts into cGFzc3dvcmQ= base64_decode($result); // password