You are here

GPG for Thunderbird portable has a problem handling file has multibyte character path

16 posts / 0 new
Last post
ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
GPG for Thunderbird portable has a problem handling file has multibyte character path

Hi, all.

I'm using Thunderbird portable 7.0.1 with enigmail 1.3.2 and GnuPG for
Thunderbird portable 1.4.11 on windows vista (or 7).

Then, I'm facing a problem that case if the windows user has registered his
name using multibyte character name (e.g. Japanese), to encrypt the attached
file failed.

The gpg application complains me;

> gpg: can't create `C:\\Users\\2.\\AppData\Local\Temp\ENCFIL~1' : No such file or directory
> gpg: C:\\var\test.txt: encryption failed: file create error

Of course my username is not '2.'.

Same trouble has been occurred in importing public key file.
If the public key is in user's desktop folder, to attempt to import
the file failed.

Is there any workaround for these issues?

Thanks in advance.

John T. Haller
John T. Haller's picture
Offline
Last seen: 5 hours 8 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
No Unicode

GPG is an Ansi applicaton and can't be run from a path containing Unicode characters. GPG2 for Windows supports Unicode, I think, but as the filenames have all changed won't work with Enigmail. Does anybody else have more info on this?

Sometimes, the impossible can become possible, if you're awesome!

ottosykora
Offline
Last seen: 18 hours 59 min ago
Joined: 2007-10-11 17:48
will work

well the gpg2 does work with current versions of enigmail, thought I have not tested or seen it portable, but friends use it on local install that way.
The use of unicode was not meant in the pgp(open pgp) earlier, but well this all is decades old and world probably got on moving in the meantime.

gpg(1) should handle keys and for sure text with all sorts of chars, setting in gpg.conf should be possible also for japanese. The handling of path...?..did myself not come to that problem yet, have just now no idea if force setting the charset will cure that problem too.

Otto Sykora
Basel, Switzerland

John T. Haller
John T. Haller's picture
Offline
Last seen: 5 hours 8 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
It Won't

While GPG1 can be switched to display other codepages language-wise, it doesn't understand Unicode paths, so that won't help. I'll figure out if we can get GPG2 working portably.

Sometimes, the impossible can become possible, if you're awesome!

ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
Thank you

Thank you for your prompt replies.

ottosykora wrote:

well the gpg2 does work with current versions of enigmail, thought I have not tested or seen it portable, but friends use it on local install that way.

I see, though I need to use enigmail with gpg on any accounts
even if the user has set the account contains Unicode character.

I guess if environment variable TEMP/TMP are set as contains
no Unicode path (e.g. C:\Windows\Temp), I will succeed in my attempt
to encrypt attached file. But I would like to run enigmail in
anywhere even if to set environment variable does not allowed.

John T. Haller wrote:

While GPG1 can be switched to display other codepages language-wise, it doesn't understand Unicode paths, so that won't help. I'll figure out if we can get GPG2 working portably.

Thank you John. I'm looking forward to hearing good news.

ottosykora
Offline
Last seen: 18 hours 59 min ago
Joined: 2007-10-11 17:48
not so simple

>I guess if environment variable TEMP/TMP are set as contains
no Unicode path (e.g. C:\Windows\Temp), I will succeed in my attempt
to encrypt attached file.

Otto Sykora
Basel, Switzerland

ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
decrypting failed

I have tried to examine the ppgp on the desktop has Unicode path.
It appears that I've only succeeded in encrypting file contains
Unicode name, but failed to decrypt it.

When I pushed the ppgp decrypt button, error dialogue poped up
with unreadable message that may contain Japanese character.

Captured dialogue image here:
https://lh4.googleusercontent.com/-WtbPXnXD7Xw/Tr4cGAeBl2I/AAAAAAAAAIE/-...

Testing environment info are follows:

  • Windows Vista Business SP2
  • JAVA_HOME=C:\Program Files\Java\jdk1.6.0_29
  • jce_policy-6.zip is extracted to %JAVA_HOME%\jre\lib\security and overwrited 2 jars.
  • USERPROFILE=C:\Users\日本人

Are these information enough for you?

ottosykora
Offline
Last seen: 18 hours 59 min ago
Joined: 2007-10-11 17:48
ok thanks

it is not clear so far, as encryption and decryption should in fact use same resources , with other words if it encrypts it should be able to do so for decryption too.

But will try to invite the authors to clear the question.

Otto Sykora
Basel, Switzerland

primiano
Offline
Last seen: 12 years 4 months ago
Joined: 2008-07-12 14:13
PPGP Debug

Hello,
could you make a further investigation with PPGP?

Open a command prompt in windows and type:
> cd "\Program Files (x86)\PortablePGP" (or whatever ppgp directory is)
> java -jar PortablePGP.jar

at this point PPGP will run regularly, with the additional advantage that in the case of an exception (as the one shown in your screenshot) you will be able to read the backtrace on the command prompt.

If a backtrace is shown when the message box comes out, could you copy and paste the output on the forum?

Regards,
Primiano (developer of PPGP)

ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
No error, but an other problem has happened

I've tried run ppgp in command environment as:

> java -jar PortablePGP.jar

When 1st trying, the ppgp raised sort of security exception.
This cause of exception is found that PortablePGP.jar does not
take a look at environmental variable JAVA_HOME then it make an
attempt to search for *_policy.jar under default JRE path as
"C:\Program Files\jre6".

So I put some jars on "C:\Program Files\jre6\lib\security" and
retried to run the ppgp.

The 2nd trying does not raise any exception, but an other problem
has happen.
When I pushed the decrypt button, the save file dialogue was opened
with unreadable (mojibake) file name
because the file contained Unicode character name.

see the dialogue capture:
https://plus.google.com/u/2/photos/107607778873700048104/albums/56740034...

To save and decrypt the file has succeeded, though the saved file
has unreadable name there.

After that I have tried to run PortablePGP.exe because my java
environment has been made few changes, and have expected it won't
raise any errors. As a result of this attempt, it poped up same
error dialogue with same unreadable message.

primiano
Offline
Last seen: 12 years 4 months ago
Joined: 2008-07-12 14:13
>This cause of exception is

>This cause of exception is found that PortablePGP.jar does not
>take a look at environmental variable JAVA_HOME then it make an
>attempt to search for *_policy.jar under default JRE path as
>"C:\Program Files\jre6".

Mmm this is strange. It is not PPGP that looks for JAVA_HOME or policy.jar.
Perhaps you have some mess with multiple overlapping java installations.
I would try to remove all java installations, than install the latest available JRE, and then run PPGP setup (that would update bouncy castle libs and JCE policies)

I have not understood the outcome of your final experiment.
Did it work?

Regards,
Primiano

ottosykora
Offline
Last seen: 18 hours 59 min ago
Joined: 2007-10-11 17:48
oh I think something..

primiano,
he is using the complex full package with java and portable launcher and all the rest from my personal repository.

I think it will be simpler just for the testing to pick the pure version from SF

http://ppgp.sourceforge.net/

I am not sure, but it can be , that the version with the launcher could look for java different way?

Otto Sykora
Basel, Switzerland

ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
I'm sorry about my ambiguous explanation

and poor English.

Primiano wrote:

I have not understood the outcome of your final experiment.
Did it work?

I have installed the JDK1.6.0_29 and JRE6 both for to use Eclipse IDE,
so there are two jre environment in the system. The JAVA_HOME variable is set as
C:\Program Files\Java\jdk1.6.0_29 and the PATH only contains %JAVA_HOME%\bin
not the JRE6 side.

In the 1st trying, I ran the ppgp with verbose option. I found out that
it loaded many classes on the JRE6 side environment, had not jce policy jars
at that time.

Before the 2nd trying, I had installed the jars into JRE6 side environment.

The final experiment is retry of examination on November 12.
(please see above the article).

I thought the ppgp does not take a look at JAVA_HOME, and expected the
ppgp.exe would show different behavior after the jce jars had been installed
into the JRE6 side. The upshot of this attempt was that decrypting failed.

@ottosykora

I have used the pure version ppgp on sourceforge.net.

primiano
Offline
Last seen: 12 years 4 months ago
Joined: 2008-07-12 14:13
Ok, I am a bit confused

Ok, I am a bit confused now.
Let's make some clarifications.

1) If you install JDK on your machine, you are likely not to need a JRE install, since JDK usually embeds a JRE itself.
I expect a JRE to be found in your machine in C:\Program Files\Java\jdk1.6.0_29\jre

2) I hope that the JAVA home is set to the inner jre folder (C:\Program Files\Java\jdk1.6.0_29\jre) or to the publci JRE, but not JDK.

3) Furthermore, I have not understood if you are using it with Portable Apps (so another JVM is in the game or not)

3) Please try to install manually the unrestricted JCE policy files. You can download them from http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip.
Once downloaded you just need to copy (and replace) the two jar files into jre\lib\security. Since you have two JREs, you should repeat the operation twice, one in the folder C:\Program Files\Java\jdk1.6.0_29\jre\lib\security and another one in the folder C:\Program Files\Java\jre-something\lib\security

4) I have not understood if opening PPGP by command line (java -jar PPGP.jar) and using the exe launcher uses the same JVM or two different JVMs.
In order to discover it, perform a simple test:
- Launch PGP from command line (java -jar PPGP.jar), then when PPGP opens start task manager, right click on the "java.exe" process and select "Open file location". It will open an explorer windows that will reveal you which jre is in use.
- Repeat the experiment using the PPGP launcher.

Regards,
Primiano

ogoshi
Offline
Last seen: 12 years 4 months ago
Joined: 2011-11-06 00:02
Thanks for many pieces of valuable advice.

I found java.exe in C:\Windows\System32 and it was launched when I typed
plain 'java' from command line. This exe is just a dummy and it looks in the
registry to decide which real java.exe to use. Then it invokes the JRE side java.exe.

And I have looked into which JVM has been launched by PPGP from command or launcher.

From command line, it uses system's jre. (C:\Program Files\Java\jre6\bin\java)
From launcher, it uses own jre (.ppgp\jre\bin\java)

I hope this helps you.

ArthurL
Offline
Last seen: 8 years 8 months ago
Joined: 2011-03-05 10:34
I thought this previous topic

I thought this previous topic https://portableapps.com/node/27009 might help.

Log in or register to post comments