I need to encrypt a large file using aws asymmetric key. How to encrypt and decrypt files using aws asymetric key using python
We can't use asymmetric keys to encrypt large files. So generate a symmetric key locally and encrypt the files then get the public part of asymmetric key from the KMS. Using that public asymmetric key encrypt the symmetric key used to encrypt the files and save this with the encrypted files. When uploading the files to S3 upload both the encrypted file and encrypted key.
And when decrypting file in s3 first decrypt the symmetric key file using the private asymmetric key from KMS and use the decrypted symmetric key to decrypt the files.