I am using AWS KMS (Key Management Service) programmatically using Python3 and Boto3. I have created an asymmetric key pair (public and private) in the KMS itself. Now is there a way to save public and private file locally onto the disk that is created on KMS.
Here is my code :
import boto3
import base64
def get_keys_from_kms(key_id):
client = boto3.client('kms')
response = client.get_public_key(KeyId=key_id)
pub_key_dec = base64.b64encode(response['PublicKey']).decode()
Now my point is how can I save the content of pub_key_dec
to a file and converting it to pem format. And similarly is there a way I can download Private Key as well. Hope my question is clear.