Hi @Kaniz Fatma ,
I used the code that you've given above to encrypt the file, however, I am facing some issues as below:
- I generated a key from azure portal (under key vault - > keys -> generate new key) which then I downloaded (download public key) and stored it into a secret which I retrieved in Databricks using dbutils.secrets.get and stored in a variable called publicb64. The file with public key in it I got was .PEM file and had beginning with data "-----BEGIN PUBLIC KEY----- a long alphanumeric string -----END PUBLIC KEY-----" . While executing pub_key.parse(KEY_PUB), it gives ValueError: Expected: ASCII-armored PGP.
- Used Kleopatra software to generate a PGP key pair which had a file format .asc and I uploaded it to a new secret in key vault. I used the same method to fetch this key in Databricks. It had a format as "-----BEGIN PGP PRIVATE KEY BLOCK--------- a long alphanumeric string -----END PGP PRIVATE KEY BLOCK----------" . With this, I am getting this error at the stage of encrypted_message = pub_key.encrypt(msg), and the error is "PGPError: Expected: is_public == True. Got: False"
I am looking out for the actual file format of a public key which we can use and the code can work. Is there a specific source you would like me to go to generate this public key file? Your advice on this will be a highly appreciated.