Alliance Key Manager Client
- Primary Key Manager IP
- Secondary Key Manager IP
- Key Name
(Optional)
- Key Instance Name
$manager = new KeyManagerHA::getInstance(['tls://<primary address>:6000', 'tls://<secondary address>:6000'], <CA Cert File Path>, <Client Cert File Path>);
$key = $manager->getKey(<Key Name>, <Optional Key Instance Name>)
$crypt = new Crypt($key);
$cipherText = $crypt->encrypt(<secret>); // $cipherText is ready to put into a database or pass to another service
$instance = $key->getInstance(); // Instance name needs to be saved with the $cipherText data
// To decrypt the encoded information
$key = $manager->getKey(<Key Name>, <Key Instance Name>) // Instance name is mandatory
$crypt = new Crypt($key);
$plainText = $crypt->decrypt($cipherText); // To decrypt the encoded information