mblsolutions/mcryptgatewayservice

Package to allow interaction to MBL Solutions Mcrypt Gateway

v1.2.0 2020-09-28 14:39 UTC

This package is auto-updated.

Last update: 2024-04-28 22:43:48 UTC


README

CircleCI

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