Page MenuHome GnuPG

Encryption using python for international characters not working properly
Closed, WontfixPublic

Description

I am trying to encrypt the the file with filename which has international characters. for eg : "abc_越智プロファイルーwork.docx" using below code. But it fails. I am running the below code in Windows.

#Code
import gnupg
gpg = gnupg.GPG(gpgbinary="C:/Program Files (x86)/Gnu/GnuPG/gpg2")

with open(r'C:\home\encryption\abc_越智プロファイルーwork.docx', "rb") as f:
status = gpg.encrypt_file(
file=f,
symmetric='AES256',
passphrase='abc@123',
recipients=None,
output=r'C:\home\encryption\abc_越智プロファイルーwork.docx.gpg',
)

Error:
gpg: can't create C:\home\encryption\abc_?????????work.docx.gpg': Invalid argument [GNUPG:] FAILURE symencrypt 33587248 gpg: symmetric encryption of [stdin]' failed: Invalid argument

Event Timeline

werner added a subscriber: werner.

Which gpg version?
Which Python library? (gnupg is pretty generic)
How does the Python library call gpg?
Are you aware that gpg uses utf8 and not Windows Unicode?

  1. >>gpg2 --version

gpg (GnuPG) 2.0.30 (Gpg4win 2.3.3)
libgcrypt 1.6.6

  1. python-gnupg
werner claimed this task.
werner edited projects, added Too Old, gnupg (gpg20); removed gnupg.

GnuPG 2.0 reached end-of-life nearly 4 years ago. See https://gnupg.org/download/index.html#end-of-life . Same for Gpg4win. They are not maintained and its use is very risky due to unfixed bugs. Please update to a recent version.