简体   繁体   中英

Decrypt audio file using pgp private key | Python

I am trying to decrypt audio file using PGP private key and passphrase but getting following error. I am not sure were to add "User ID"

prv_key, _ = pgpy.PGPKey.from_file(str(PRIVATE_KEY_FILE))
PASSPHRASE  = "PASSPHRASE1124124"
print(" is key protected " ,prv_key.is_protected)  
with prv_key.unlock(PASSPHRASE):
   print("is key unlocked ",prv_key.is_unlocked) 
   decrpted_file = prv_key.decrypt("encryptedfilename")

errro: raise PGPError("Key is not complete - please add a User ID.") pgpy.errors:PGPError: Key is not complete - please add a User ID!

According to pgpy documentation , you could try:

uid = pgpy.PGPUID.new('your id', comment='your comment', email='your email')

then

prv_key.add_uid(uid, [+options])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM