New PortableApps.com Platform 12.0.5. Better, stronger, faster. Download or Buy on Drive
Instant access to over 300 free and legal portable apps including the new Firefox Developer (Nov 10, 2014)
PortableApps.com needs your help: Please donate today

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

ogoshi - November 6, 2011 - 1:01am
Share on Facebook

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.


( categories: )

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!

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

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!

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.

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.<

it is not only the TEMP which is involved, the gpg has the bad habid also to use place under ..user\apdata.. for example. This is the hard one when we have unicode there.
So sorry, only setting the temp will not solve the problem completely, but may help with part of it.

The gpg 1.x is simply not able to follow a path with unicode.

You could meanwhile try the java based portable pgp:
http://ppgp.sourceforge.net/

or you can get it with portable launcher and all components included from here:
http://www.box.net/shared/402l6p4lml

I am not sure now, but I think this one does support unicode.

Otherwise we have to see if the gp4usb now would work with gpg2 or the GPA could be made portable somehow. The GPA under linux works with gpg2, but then with gpg2 only...

---

one thing I forgot: if there is java installed on the PC or there is java portable installed on the usb stick the software is run from, the ppgp will attempt to use it. In such case however, the unlimited jurisdiction policy files have to be installed in the java.

You can get them from:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-arc...

and look for file jce-policy-6.zip

http://download.oracle.com/otn-pub/java/jce_policy/6//jce_policy-6.zip

unzip the files and copy contents into
....\Java\jre6\lib\security

it will replace 4 existing files there and the encryption/decryption will work.

if the program does not find java on the host pc, or on the stick in the usual place, it will use its own java stored in its folders, there all the jce things are included.

@ogoshi

could you make a test if possible with the ppgp and let me know if this would work on unicode path?
I have myself no computer with such setup at the moment and doubt that the authors of the software have either.
Let us know pls your findings.

Otto Sykora
Basel, Switzerland

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?

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

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)

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.

>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

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

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.

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

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.

I thought this previous topic

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