Encryption helper

Named example: 4-asymmetric-to-secret

<?php //-------------------------------------------------- // 1. Create a key encryption::key_asymmetric_create('my-key'); $key_public = encryption::key_public_get('my-key'); //-------------------------------------------------- // 2. Encrypt $message = 'Hello'; $encrypted = encryption::encode($message, $key_public); //-------------------------------------------------- // 3. Decrypt $decrypted = encryption::decode($encrypted, 'my-key'); //-------------------------------------------------- // Results echo debug_dump([ $key_public, $encrypted, $decrypted, ]); ?>

Back