admicro / kms-client
KMS is a key management system for data encryption, decryption, signing and verification
README
Install library
Install
$ composer require admicro/kms-client
Table of contents
- Usage
- Create KMS Key
- Generate Data Key Pair
- Generate Data Key
- Encrypt
- Decrypt
- Encrypt With Data Key
- Decrypt With Data Key
- Encrypt With Data Key Pair
- Decrypt With Data Key Pair
- Update Alias
- Delete Alias
- Describe KMS Key
- Disable KMS Key
- Enable KMS Key
- Delete KMS Key
- List KMS Key By Alias
- List KMS Key
- Update Description Key
- Sign
- Verify
Usage
Add security_file.json into project
Create KMS Key
This function generate KMS key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/CreateKMSKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new CreateKMSKeyRequest(null, null, Algorithm::AES_256); print($kms->create_key($request));
Response
key_id = 01H0M06NHYRK32VS44JQKRASSZ, alias = , algorithm = AES_256, state = ENABLED, description =
Generate Data Key Pair
This function generate data key pair, create plaintext private data key, encrypt private data key and plaintext public data key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/GenerateDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new GenerateDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', Algorithm::RSA_2048); print($kms->generate_data_key_pair($request));
Response
key_id = 01H0ENF8BREJDN9SB7G7AP5M9N, algorithm = RSA_2048, encrypt_private_data_key = D5ZV0sZb+7aKhGXKJAnvJ6/37eusPjibT/EcnfJQV+Tny4rqu+cSz9D/fdBep0/O6wCyJHXh0pnBJoqawdNDdukRwtN5B2DagLC+npSzP9WMeEGqg+CnPQ91YIpP4Hmq+tswtjvfeAwEt+1H4tM+HJgOf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9GoDgD9o5Y5zXGW8jQy83qMDq8SU/wqNGHU7gbeU9bwCn6rZ0CacaWhId3e75pFfaq3gR4Hqt90xfj9AZsbAoGABMSOsgNFUe7ZlNJyVgzmUDuf1ozAdxIP3XO1r6u0YuurqiiKJle1oTfX//7vtfuXeMmMaQfdnkF0HijIoA7XncfZL7+wLRQyc24UQt/7FSV+/+sVBkFZNgy4S2FfJKy7u3WlflZ3VcVGNO6yMQNrQl6SCEpCQR6x67i0XxH3YkECgYBSfQe6Ljw6gF2dWMXv6ePRbT9/DJ6713EQd5d0FQK1vD9nVw4tEdBGP1Vt0ki5hPD8J6eR9XwecgeE0ITME72ThOhMyS90kJIG/og2wq2r8961j2C3H8/YFwmcOoLXQPW7bDub+szWlxXmb+YI18Zxq4/FTXGP8FWo5FfFJfMjig==, plaintext_public_data_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgWOFCW8FzQKrORhkXf3085fNe8r+gKsVm8XafqJDi58p27pZp2JP1Tmshu1nsupC3mjoGLPkLJ4I3PX2qgb/s4Zpbc5iDkXVNpSrWfkMhl3DrUfvdOBC4OUL/Y1zMpH7PXlIK90hDP5yN1dXPa+lZM2oWg805CtSWA94qswOQAq8LAcLi/LeP+noWkMwHVvCjcQ8EuPB6so2j4ltulCQVG4+ZNWm7H2QFflUILa0lOfHmTUSaemMkyWz4WGdw1lp1E8f1IKAFm47SpRa8LvZxSzCIP8wEebj01jq+AwHRQtQLW02LQ3rbnhn23HSLJQsbU99uWIXOT5jFXm8Y7nreQIDAQAB
Generate Data Key
This function generate data key, create plaintext secret data key and encrypt secret data key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/GenerateDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new GenerateDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', Algorithm::AES_256); print($kms->generate_data_key($request));
Response
key_id = 01H0ENF8BREJDN9SB7G7AP5M9N, algorithm = AES_256, plaintext_data_key = MIGqyHGnNwcyfGi8+uvHvIheFfwAaZdvDSb/mFMFAp8=, encrypt_data_key = 9gwVrJopJ4QUbAiD58ipoqnUR8DKdP7gJjOhzx9NEXW4/eRjtHkaBtCVKEw+Gkwc
Encrypt
This function encrypt data directly with KMS key
Encrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new EncryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'cuong dep zai', ContentType::SINGLE_STRING); print_r($kms->encrypt($request));
Response
EncryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => IwSaVIIs/ETMvPqIpBx0yQ==
[algorithm] => AES_256
)
Encrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array("Volvo", "BMW"); $request = new EncryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_STRING); print_r($kms->encrypt($request));
Response
EncryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => s1gbHPrgNfhZ8d4D3T/XNQ==
[1] => eqOMg50E67tD1/MVYZtLtQ==
)
[algorithm] => AES_256
)
Encrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name' => 'Cuong', 'age' => 37))); $request = new EncryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_JSON_OBJECT); print_r($kms->encrypt($request));
Response
EncryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"Iyd9uKOc59ZtVKfC/69y0A==","age":"iC/9uKKh1CTH7DW6BUfdyw=="}
)
[algorithm] => AES_256
)
Decrypt
This function decrypt data directly with KMS key
Decrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DecryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'IwSaVIIs/ETMvPqIpBx0yQ==', ContentType::SINGLE_STRING); print_r($kms->decrypt($request));
Response
DecryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => cuong dep zai
)
Decrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array("s1gbHPrgNfhZ8d4D3T/XNQ==", "eqOMg50E67tD1/MVYZtLtQ=="); $request = new DecryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_STRING); print_r($kms->decrypt($request));
Response
DecryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => Volvo
[1] => BMW
)
)
Decrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name'=>'Iyd9uKOc59ZtVKfC/69y0A==', 'age'=>'iC/9uKKh1CTH7DW6BUfdyw=='))); $request = new DecryptRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_JSON_OBJECT); print_r($kms->decrypt($request));
Response
DecryptResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"Cuong","age":"37"}
)
)
Encrypt With Data Key
This function encrypt data with data key
Encrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new EncryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'cuong dep zai', Algorithm::AES_256, ContentType::SINGLE_STRING); print_r($kms->encrypt_with_data_key($request));
Response
EncryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => MFGJoytdnyFPxv4Uz7qVnA7lfQc3+mQzF+AQgv548iIQD2WdUWp/rOksGeZ2mS6miF9d02PXQlo6b+slzEkiM0IisE2Gi9u7Qte2TQSnn96ACnf2qQC2WGxuS8b15EoZrNDxW1yhPuqGxaTsn5v71sMGmGWmd/0IqeIZP2kQCIs=
[algorithm] => AES_256
)
Encrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array("Volvo"); $request = new EncryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, Algorithm::AES_256, ContentType::LIST_STRING); print_r($kms->encrypt_with_data_key($request));
Response
EncryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => MFGJoytdnyFPxv4Uz7qVnFVx0mtEbQwbT2RXK522paJ1mfcsnnUoSuUtmF/2Vv4v00ZABnU/yB08sLw67BvrDAv3kbpj0EZSLcUxH9DYTDwH48lapzHUvJ6eCoubbHSa/clN2ooT8vc2jJrO1Ys01Y0XRDsTDHjEkzJ+MuFwyT8=
)
[algorithm] => AES_256
)
Encrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name'=>'Cuong', 'age'=>37))); $request = new EncryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, Algorithm::AES_256, ContentType::LIST_JSON_OBJECT); print_r($kms->encrypt_with_data_key($request));
Response
EncryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"MFGJoytdnyFPxv4Uz7qVnDy6++aPI4QrFlHanVF3rstjXJP8SgGPU5tkVfDSzount1FopxvwyK7O4SKkBah78W/PiwuC5Kh5MhY5mht+hM/HFBItmQBZjA+EDOSe17wldd8lCdrfCZtyM0LWbVDQpSCLgbfaqr5yscH6RjnH+P4=","age":"MFGJoytdnyFPxv4Uz7qVnCzpvqs9FbpgYUEJMQeJjVj22WLChjjZvVgipK+d9EASugKDnOipLSDr5CDeE+B+FTgVdqWbsbxcGc2aadt4wBn/lDgiuZrhgFZExcgiwzyB0g0hxido7pSlyZi3GELUv3Sp8ex6DkjBRL/6Lf+axyY="}
)
[algorithm] => AES_256
)
Decrypt With Data Key
This function decrypt data with data key
Decrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DecryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'MFGJoytdnyFPxv4Uz7qVnHdLmv1q+1CA0ZYqnMHgXvvJNbEBFAnBw23wyiTsXBOTH/iv5HNY5anUPwFAcVe2wFjOnQlGGr2RrUITsD4yiv/+Kjh6oOVIAG4ZVfIHI7fiHaYZdjsfUikzcU8ZHH6m6GuISKknRmIVUEEbn/lV2YI=', ContentType::SINGLE_STRING); print_r($kms->decrypt_with_data_key($request));
Response
DecryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => cuong dep zai
)
Decrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array("MFGJoytdnyFPxv4Uz7qVnDkWZEc/PJQLoDmmGIyOCRUyNUaizVxQiGBi32O6xw+LKzqIE+JY14Guxm1mS5rQqVCg6B0kA83UhSYOJ2ST4lbY0apCgbfyjnKSmpRrPum8KpP9xnGJX4El8N2+zWFQehl8vsLuuFk9B4pycKtKGpI="); $request = new DecryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_STRING); print_r($kms->decrypt_with_data_key($request));
Response
DecryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => Volvo
)
)
Decrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name'=>'MFGJoytdnyFPxv4Uz7qVnFWHYCtnlHi3IrgLxukU+ZgVoLkJzGKTU2bBoXRNpTeoOCj6D3o75TDnNAEV795AuqC50Xo8Vk3GQFG1vKGXij5gcvbjpaiqxfLw9Ki0lxSQfTQh3VNv6ZOgI8uxQ3OpMZLn/XVGn8HlncdeZYwazfY=', 'age'=>'MFGJoytdnyFPxv4Uz7qVnJsEL/DR2V5IM/oUz5P5J+UC9ihuDtCMnY9EJi1erGz1aDmj/A0IdKM8uLt0OId8Xxz/PmYvogPZTYDY6CvF65NnlZEesJ3dnr8mrTTL+4Ue6/Ukgy/xi3KDzRWay2KMWaS2xG0uwsfbzrtqQq0fwgg='))); $request = new DecryptWithDataKeyRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_JSON_OBJECT); print_r($kms->decrypt_with_data_key($request));
Response
DecryptWithDataKeyResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"Cuong","age":"37"}
)
)
Encrypt With Data Key Pair
This function encrypt data with data key pair
Encrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new EncryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'cuong dep zai', Algorithm::RSA_2048, ContentType::SINGLE_STRING); print_r($kms->encrypt_with_data_key_pair($request));
Response
EncryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => MFGJoytdnyFPxv4Uz7qVnKUfMnTpsiN500MXTGryASYc/jssLN02FLqiqLUyaNn4lYb/f4PQGlQO6wOLItwuCKtCSnBtl7wY+Qb7lmlAw8EfphO0RgguRyYfsV69fs+qYyYNoHOlX5ngA1CwxXYMLXtYieUU2ZGgS3QgVN++SjjBah65edgDk+2Xw7ynOu1csvu9ZvH4IrsTOxmoqfW+GlvepzohZBkpSpUV0/lgHw3s7q8woFoFpQGBoZ+7Oy7SplObNqmvLKImbbh4DjM+y08lxqx7pDvSr2qPx20VDp0TVDZy+uO6m52DX0DDp/BD+fN5+mekpXEunt3cDyi9ZGL9AqGJsi7H2psV60QZmJfLRkdveR8ZxnBV9VaoixJGK76nFwbPY19dfMr+B9Sv2sI6CpRGC9LOmrhe+aFm59PpOZkDYuvlI5LwDWtSAWqO/ekVz+g5/6FEH5GsAnT/o735ZM0Jlq7CAsttj/TgW0Em8xpiokbI3mrRIqir8EDSMmsIG36lFyfp4rf25PnUIPEavoxVxobjZZyZvd0YaSw/cWkUvH8dPyGmi3UD3m2bC6QvASpl0IulNR4mikXFKB9TL6pNspDVboyy31tjhx2tOR3tgEmYmK7EWTiSoka37oGtJyko7pfrLmnk7KrHg6CqT3nXVx4ZGtRap29sDjyvMvKf/3SivE1CUXtpfF3sjAuIL2hjnree1AUiz6FpGR/7Pn6VKA+m98Esqgik0OarW+TdZ/E4h78i5iiAjX8ZPPYK6/or0YaVb68/BufoWvX4hzzYf3P4VZDjIQEJ0xxaH3oBIvVLJLSwsimkyfqe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3RTUsvXb6kA/xaLhed3zg47izcaG/y1qyq4QO/J31QnWnHz9Hze5qQFMDtV0BpNcxHUgb72MLNd6Cv+vl66W2k6dHWh7PnADgJY8gCkuUPvqIvdk/K6zPvqTYisesxoN9A7HLCr/sflBpRIGQOkxORdwSgbIDqCLPZfczvmgewesibbk6Q3amcPYYR7GPMmN5DfhSZohstc7LHaN3bywrTKGbE/aTMsFo9pZC3WvxeMqxKFfCekw1Rh9jM2Dqu2peZXHYqI2uijzPhFjTGign5f4SnkNrvRaHyrpcgiWi/H1Afbf8Yk+9EVlKBRvBDIKXWMByjRjVQyg4lYr70f2WPrvb12yZBSzn7o4V3sr+sK3eOdyGPg+fypgIWRcUVJ+HvKep5OsdWUPcyW+c96f3v5P0UQ==
[algorithm] => RSA_2048
)
Encrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $input = array("Volvo"); $request = new EncryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, Algorithm::RSA_2048, ContentType::LIST_STRING); print_r($kms->encrypt_with_data_key_pair($request));
Response
EncryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => MFGJoytdnyFPxv4Uz7qVnE+drJ6XeijljwHPQdFsypVE115Oc4iT7hydFV40zxgtpKbIEyuF1kmhdG1A2VUTWiYKcD5CD1S3lIdTSBn0kZmaSU6wYpNEKkNh7pmtRW172BN78S1gTU5lSCLb3mK2jbrfuVAa2iEbYMZ5uQw4l+cLYFrGxslYlj5v+VX81Uh2JvEKzJxm+gimGobmWtYmlCcZP1bMIjNn90wkcuDk/Mo10HTAeFjG1llDZa6C9hmU+X01M71gzofnKnMcQH+UrY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N3enXV7fS63vZjcF/DE2IqHmWdsKmjJ5/dEGFvSMHHZwPXWg43fqoNgSvRk2k1RbUMWWsd1d9NFsHkV9YT8ARz3L3crRfxKZPhIMsiTHUspzwdb2s0U/w5aGY3JD2/AP5B2BcWAh9MTBlqjVPJW5gWJ2w3esxcu5hAofENNFgYd28O20db9t9A048D8Kfp6jRbdj7zpENHFcgF9VF6+cYzNRRRUUtwvexYALTFdwQ9euy+Qm+j9XeGLtbXhXlbZVC5+ih9zjmAfPIdD+fvCplMrdD23w+ugBIgosfn4d3lDCdSx66++CC7yMhBcgHVJ2YDpg9SRNWmuMmVg9Rs0rfGTylS2uv/mT4YKr+C+LLyd4XD/dvUAtM7GKzQdQ0m4PlOcGzNjqBORf54NnEFbp6S2vraF00naTJiHtsw1aZmpkD/KhBdBtbTvR+qT5lgJsBhsm9Gln67swm10qeE/2o4pKWi3TiSFN3HnDxR/q/JJch1M3LLI2KF9DDMkeSxJyT3COd91JdmB1auNH4C9p2YGRq5qUxTme7dNj9xSYnfLeM2/VsY7HkAcN9pwLrTgOO+KxObGJdFjlv1wUGMLZ3fB5t/ZKdPUzUf8EqTRDEUGGdHmtm2kCSYKLr9UsxtUSgTmeIM3pNuxuUOgWGRUuQ9s4tEAHcsC0x8S8+FT4ZZNpBFjSSCSU/5SPiUnJzTjBuaZhjSHMzIna/JUFMkQYvk83XtSVkdlVIa8GfEsokSTaPU+S8eAqSaKhOBTsEP1qqpR+HQB4dYzC7jivjf/3S8uwk+PfF0+jGPfCW3TgJ+/aVZdekDZyOAk/X4fFuxlWAMl4nod6iTU3dTdUY/HMr7Zcjs4SIClVe7G83bRbFAVYlsxJhLg4Tg0qgHsJgEUfecK8hMeyZCXbM080mkqJfX6t49M7ttIKpXJUTH1eOzbvWyZJOL5QHz2PqU4WtWUbfP+frVo+ZKNSc3KOg==
)
[algorithm] => RSA_2048
)
Encrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EncryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name'=>'Cuong', 'age'=>37))); $request = new EncryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, Algorithm::RSA_2048, ContentType::LIST_JSON_OBJECT); print_r($kms->encrypt_with_data_key_pair($request));
Response
EncryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"MFGJoytdnyFPxv4Uz7qVnHTAvUGQONgV8oSTB+OIeyVN/dmWLSRB0On/JS/T0E7vxnwOJEXN66UPiXwNBqPAQIeb04i+7d+roSSDFP/HIMdivOidG9wpnssYA9taKg7ynfsyzPDWwCZCvC8Sk1ThkbY3fe8vUUx1Yex8Cox74gdcwh6APtZlSqd7NqDSs/JKWqSmnpiJ8PY7m1K3W470cYSnqLz0CBm6VwuOh3nk4DGmLWjq1u3VKmiyBhXWv5WOge6Vi3KIpV9MittyC79xE9EQhz7LJTwA+874fKtrtpraQL7B+Agi0NR4lnqjTpXdXCq4+LQbByJ9FwSnFUs8EYbY+l/KZAf5E4b6xayOuffTcAA1mOsqab8achhdUMGPb3j+BJKZQs5J/S7gjH5a3IcLR85YZTRjMqq4eZhmL99FsFpcRPZLmomnV05IYZyAXV6VrzLs/zZxYHzE8nzSGMHa44Mx9OKGZbjo/FcxrFPPCbxMT3qVhGqdyFvK9MgdaqXlNqFGUxkMZb9pKdFO/6eiI5pJRpTf0fv6ykg7zpkTSZs4oVek3qzsh2u76j7BTs6dPz435abatAztNsdR+SqekzPyV1hEpHrRohxl24QxJmhIrHybwEL54cGq/3q2cADIpatzj3SOWeLYtWDpdvXtd+R7tQvMXerivK/udsIQUqUpxMBs4LrMMtwls+fWdGEUCGW6iVUgYGFj7jjp3wN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LtogJpFTmw3J7VrK74nTFoE5L6kj4O/Q30FZh3UOLnOEv8yARGzTc8B253/n1L9JaHJ8NFJG3IVTk0QW6NprnNPzC1hhS53BVie1QVwg66KPy1CfCxA3z8K187tMf+oTylDaiINT0cIs2uUb7MyBbSrVs6xu+jLu3NXFY4iZeYXaoxeU5yTQUPFnsmjOtPdU2UD6JPita6qP6QxD4r9IlU7E8luHjZ/hxNpxr7dNmilVSJtCxmC/1EjRIwrPtlLHMRP0nnixHTvd/bCEHbU7kl87lyOlTSPRHpwUkmccBtlDrTRi5xLaoL5dInKkrYY9Z+g7De9emCjSq7CxnfIwNoPRYunoz/GxunRQa9js/ipdJr1vZdizbjPouUsEkKlIlEp4LP/CTjCd64pkDtcpqIDVYFPrhVzPw2Eq8xcnyT5CeuFExi5E7r7DhgXvMqyL6HNDLcFhjOlqgoAm9l0JGEcTsRTfKTrsMLNM/Dk8ZAR89s+OF9Y6lOeb9UnDVY0xQ9uc0HLdsZrDM+/kCd0pwWRvPskxKXjJzMdUiIa6zXQq0oS+bh9JaxnDl+WFP+0qqlgRSn33fGKfvOvU1vcFNRSu7SRmQgWIkQhOWdT9qOg2qI6pJ0/Z1Brvb3TA1zz7XEkbtqMaShoE3SdLX5bdLOoFfNFiaHxAn6+jHbAmBMlR8ADB2HMoUpRpYxpAxYT+NTn1ldjBC5Pb0AsLe9wCXMgy9Yg=="}
)
[algorithm] => RSA_2048
)
Decrypt With Data Key Pair
This function decrypt data with data key pair
Decrypt single text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DecryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', 'MFGJoytdnyFPxv4Uz7qVnER9M9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s5U0v6AUVi1vewk/w4GXp0Tm44tg4an0snYzdrcEnEGBiswEl4rZaq6YUkJfMta+u2r469lgHgBaNYdZpd+Yz302bbON4z2glalUqZASZ4qL3D7zsY36dkrnuaQCluJMq/caSXaI6g==', ContentType::SINGLE_STRING); print_r($kms->decrypt_with_data_key_pair($request));
Response
DecryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => cuong dep zai
)
Decrypt list text
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array("MFGJoytdnyFPxv4Uz7qVnDryXX1mF9oCT9w47HZtQncS+SOCaPQvmWh6Pi9dlW/xywuKvlsPQcAmxMvtTUb+E9Ir7Pz7EsZnlhPRkyJLd3w48cvzsI7dqPE/AFQ6GrjKc1sFqheJvOD9Vh6DMDoG9b7JBuILFXro6eQ+YHRe605I8P6oYm+dMxSaIPnEKCA9KYxXkAcNUu031Md2MAUISAYH1n/Bt/i3rSm54E8ZH03c582bs6ygIzCW01yrvdT6o6eAlAmyMAhXAlpnE4ycoWDOK/F4b4cJp63bnlX+Ipbzf+vK3v5kzWzKPoRGTXTBGEio/6+zxcepREz6Ej3EYfQWm6hYUvPcuxYhEYBgqOuiHS7Si4eTlxzTESfl7C6Bv7rtAIMbCPnG6PXe0Oe2TWbeenAXszUg/2AF3abLC3GAbIjA0scCPZLacKlY8Mb8vZgpnIyWxB0czd1/mr8EwAN4iIL4Ps+PRx24w1baFVUqK3jY4/D9lyTEniUiAk/iumQnxQA1v3AlS8KXC7WX750MnfR2MZiAzsXHdPRC/rO95AF8Gme6vG1n2IhAmQSx6/qeFOylzn9Z4IxRYdi2qxreCoZfyy8n1hZ7Y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PXNz1qifiYxrO1BHBqXn8n7VkebixU7sGR26EZh9bn2bd5D3fB/QdJXmI6ASeDWto4LwTcERbjKe7ICTy97cG1OfeUv1KqsP9McDklQ3BiU4s1GMMChj6/zn1nf2JR23Ur1uuhPxUB9HEYqPEFQ0Mmiib13TDXhyemJoHB7G4T6icHvIZzP5y4PIYj3kOMYY+nwSH6OUL03E/24Yspzb+FbZSrO8UCVsdqw19oX6oLqqmV6fDBATkgGApAjPHLzEi471t5nYw4RlJui84R1yu8j2ALWm0MWv73WacTj6q3b9p4i/HHe61udXIkikfV+4F7KdUeis3umNTL497BCySS2ihyUR5/G/fC+gCT/HebxemE4vr68uf1hYnpHfpOHrIlj0wpITyd8isJf9Q10HycrCOYgBp66WdP1L/sC9JKRFI7ZHUnzlLVhrjAwI/o6NT8O2bGRt217olU00Ysx7OjjsDM9P4oJGTeTs5iBVsnaG1K7v9boFxP/e7vAFZovhr3bgE8qSSUrlXJhfSFPHaBIf9I1fu5xYsvKIXZMvd4bk5l2iZ0UCPid4FKOW9Hete+mITRkl9NToxn/SQliqdKRbACsBzxGZvyAwEIfd3JOL4GJn4SZqzgk620FVotI9vwI4ktgC/CyvHgkVjhw=="); $request = new DecryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_STRING); print_r($kms->decrypt_with_data_key_pair($request));
Response
DecryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => Volvo
)
)
Decrypt list json
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DecryptWithDataKeyPairRequest.php'; require_once '../src/vcc_kms_client/models/ContentType.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $input = array(json_encode(array('name'=>'MFGJoytdnyFPxv4Uz7qVnEHabCotTyIzwRiAgBv9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mB84A+cqRrYRWyrHprRVotjQeDdIuHAbfe76n/CFWG0+DDwptlU7Psm+n7lJA8PtV+Z2xXl710CRvkcojbp00eQlV+pa4TUSVB4KGmstmf9rxoABo215B8B8MkJV3msaR8bqH/LG3h9/ckE84b7Kvaj6pE3Xe8zM4OTJlRCz52R5y3qNwlkm2mqoT5rqear40Wy3/fmjdyKocp8jtrjqYhVDs8O9Kbnnh2xCO7JICDi/hxrF1+b8KWKRP/gS4CgsB2wNa9Eg=='))); $request = new DecryptWithDataKeyPairRequest('01H0ENF8BREJDN9SB7G7AP5M9N', $input, ContentType::LIST_JSON_OBJECT); print_r($kms->decrypt_with_data_key_pair($request));
Response
DecryptWithDataKeyPairResult Object
(
[key_id] => 01H0ENF8BREJDN9SB7G7AP5M9N
[output] => Array
(
[0] => {"name":"Cuong","age":"37"}
)
)
Update Alias
This function update alias key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/UpdateAliasKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new UpdateAliasKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G','cxacascas'); print($kms->update_alias_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G, alias = cxacascas
Delete Alias
This function delete alias key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DeleteAliasKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DeleteAliasKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G'); print($kms->delete_alias_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G
Describe KMS Key
This function view KMS Key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DescribeKMSKeyRequest.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DescribeKMSKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G'); print($kms->describe_kms_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G, alias = , algorithm = AES_256, state = ENABLED, description = xxxxxx
Disable KMS Key
This function disable KMS key, when in this state Disable, KMS Key will not be able to use the encrypted, decrypted and generated
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DisableKMSKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DisableKMSKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G'); print($kms->disable_kms_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G, state = DISABLED
Enable KMS Key
This function enable KMS key, when in this state Enable, KMS Key will be able to use the encrypted, decrypted and generated
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/EnableKMSKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new EnableKMSKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G'); print($kms->enable_kms_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G, state = ENABLED
Delete KMS Key
This function delete KMS, key will not be deleted immediately but will be deleted after 7 days
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/DeleteKMSKeyRequest.php'; require_once '../src/vcc_kms_client/models/Algorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new DeleteKMSKeyRequest('01H0M06NHYRK32VS44JQKRASSZ'); print($kms->delete_kms_key($request));
Response
key_id = 01H0M06NHYRK32VS44JQKRASSZ, state = SCHEDULED_DELETION
List KMS Key By Alias
This function list KMS Key by alias when the user has permission view those keys
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/ListKMSKeyByAliasRequest.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new ListKMSKeyByAliasRequest(1, 0, 'cuong dep zai'); print_r($kms->list_key_by_alias($request));
Response
ListKMSKeyByAliasResult Object
(
[keys] => Array
(
[0] => KMSKey Object
(
[key_id] => 01GZJT8VX8ZD3TVNN0VZXD3J69
[alias] => cuong dep zai
[algorithm] => AES_256
[state] => ENABLED
[description] => dsafasfasfasasfasf
)
)
[alias] => cuong dep zai
)
List KMS Key
This function list key when the user has permission view those keys
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/ListKMSKeyRequest.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new ListKMSKeyRequest(3, 0); print_r($kms->list_key($request));
Response
ListKMSKeyResult Object
(
[keys] => Array
(
[0] => KMSKey Object
(
[key_id] => 01GVD5HP5NSS0AZAX9D4E6Y1RX
[alias] => cuongdepzai3
[algorithm] => AES_256
[state] => ENABLED
[description] =>
)
[1] => KMSKey Object
(
[key_id] => 01GVD5JGAX1ESW09PN3BFQ7XBE
[alias] => cuongdepzai4
[algorithm] => RSA_2048
[state] => ENABLED
[description] =>
)
[2] => KMSKey Object
(
[key_id] => 01GVD5MX66PRTEJGD08ZTPXS4S
[alias] => cuongdepzai5
[algorithm] => RSA_3072
[state] => ENABLED
[description] =>
)
)
)
Update Description Key
This function update description key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/UpdateDescriptionKeyRequest.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new UpdateDescriptionKeyRequest('01H0FB74RH8Z3C9CP696ACPC1G','xxxxxx'); print($kms->update_description_key($request));
Response
key_id = 01H0FB74RH8Z3C9CP696ACPC1G, description = xxxxxx
Sign
This function sign message with KMS key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/SignRequest.php'; require_once '../src/vcc_kms_client/models/SignAlgorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new SignRequest('01GZX850ZW3W4HC40T1ZX6V8NA', 'cuong dep zai', SignAlgorithm::SHA512_RSA); print($kms->sign($request));
Response
key_id = 01GZX850ZW3W4HC40T1ZX6V8NA, signature = C/PDWwJ2NpsqbwJTVDKqosFue+rs3dl+vKPbdVqh9zIc6Lnm33/WadCA2X+tMs87UOxaeuIn+NtgL6Jnh3ZgkkWB086ltp/YbccG+H9mxCc/OXKSP2hOZdO7bE5HXi4RyoXG3Mcv/ckXlgP02v9U2gehvQCOA9mcP3XDTZvHxCvU+WQpIt/QiNW3Ov150X7HrHt9vRFlX8cY1ciLH4esDcqshLY0Cw/SinB4hUJ8eX5DanQ/5VMZY12SLMQL+y9sifrmJNIe9WP0Gysp8yGPCwcO+zP49TrEs/zmMvkUscf3+0tJTFYetF4a4+zhI7QoaV/4FWPVaBVoh7kkb0HolQ==, sign_algorithm = SHA512withRSA
Verify
This function verify message with KMS key
<?php require_once '../src/vcc_kms_client/auth/KMSCredentials.php'; require_once '../src/vcc_kms_client/KMSClient.php'; require_once '../src/vcc_kms_client/models/VerifyRequest.php'; require_once '../src/vcc_kms_client/models/SignAlgorithm.php'; $credentials = new KMSCredentials('security_file.json'); $kms = new KMSClient($credentials); $request = new VerifyRequest('01GZX850ZW3W4HC40T1ZX6V8NA', 'cuong dep zai', SignAlgorithm::SHA512_RSA, 'C/PDWwJ2NpsqbwJTVDKqosFue+rs3dl+vKPbdVqh9zIc6Lnm33/WadCA2X+tMs87UOxaeuIn+NtgL6Jnh3ZgkkWB086ltp/YbccG+H9mxCc/OXKSP2hOZdO7bE5HXi4RyoXG3Mcv/ckXlgP02v9U2gehvQCOA9mcP3XDTZvHxCvU+WQpIt/QiNW3Ov150X7HrHt9vRFlX8cY1ciLH4esDcqshLY0Cw/SinB4hUJ8eX5DanQ/5VMZY12SLMQL+y9sifrmJNIe9WP0Gysp8yGPCwcO+zP49TrEs/zmMvkUscf3+0tJTFYetF4a4+zhI7QoaV/4FWPVaBVoh7kkb0HolQ=='); print($kms->verify($request));
Response
key_id = 01GZX850ZW3W4HC40T1ZX6V8NA, signature_valid = 1, sign_algorithm = SHA512withRSA