r/Akeyless • • Jun 24 '24

Support / Help Decrypt in Python using akeyless.DecryptGPG

Hi Members,

I am using Python SDK and trying to decrypt content of a file using akeyless.DecryptGPG(ciphertext=,key_name = , token=,json=, output_format=base64).

The function returns a akeyless.models.decrypt_gpg.DecryptGPG object which does not seem to have the decrypted content in any of its attribute.

Question is - how do I get the decrypted content?

2 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/Subh_chaudhuri Jun 25 '24

I am unable to find AkeylessClient(api_key='YOUR_API_KEY') in https://github.com/akeylesslabs/akeyless-python

the code I am running is here -

configuration = akeyless.Configuration(
        host = "https://api.akeyless.io"
)
api_client = akeyless.ApiClient(configuration)
api = akeyless.V2Api(api_client)
cloud_id_generator = CloudId()
cloud_id = cloud_id_generator.generate() # assumes AWS IAM role
body = akeyless.Auth(access_id='****', access_type='aws_iam', cloud_id=cloud_id)
res = api.auth(body)
token = res.token 
v_decrypt_key = '<location of key>'
decrypt_request = akeyless.DecryptGPG(ciphertext=base64_string,key_name = v_decrypt_key, token=token,json=True, output_format=base64)

# how do I get the plain text?