Am 27.02.2025 um 19:41 schrieb Ingo Klöcker:
> On Donnerstag, 27. Februar 2025 16:32:29 Mitteleuropäische Normalzeit Thomas
> Schweikle via Gnupg-users wrote:
>> Hi!
>>
>> Within Windows gnupg uses "%APPDATA%\gnupg" for its keyring and
>> configurations.
>> MSYS2 gpg uses "/c/msys/home/%USERNAME%/.gnupg". Now I had the idea to set
>> GNUPGHOME so both could work with the same directory:
>>
>> set GNUPGHOME=%APPDATA%\gnupg
>>
>> This worked for gnupg from the gnupg-package. It worked for Gpg4Win
>> included gpg as well, but the MSYS included version gave
>>
>> gpg: keyblock resource
>> '/c/Users/<user>/AppData/Roaming/gnupg/C:\\Users\\<user>\\AppData\\Roaming\\
>> gnupg/pubring.kbx': No such file or directory
>> gpg: Fatal:
>> /c/Users/<user>/AppData/Roaming/gnupg/C:\\Users\\<user>\\AppData\\Roaming\\g
>> nupg: directory does not exist!
>>
>> from an MSYS shell. Any idea how to overcome this problem?
> 
> I doubt that it helps but try
> set GNUPGHOME=%APPDATA%/gnupg
> i.e with a forward slash instead of a backslash. Or try
> set GNUPGHOME=C:/Users/<user>/AppData/Roaming/gnupg

Your doupts where correct it just lead to paths like:
C:\\Users\\<user>\\AppData\\Roaming\\/gnupg

The only way was to redefine the variable for MSYS -- but then:
$ set GNUPGHOME=%APPDATA%\gnupg
2025-02-28 09:34:27 gpg[9252] enabled debug flags: memstat
2025-02-28 09:34:27 gpg[9252] enabled compatibility flags:
2025-02-28 09:34:27 gpg[9252] verwende Vertrauensmodell pgp
[...]
2025-02-28 09:34:28 gpg[9252] keydb: handles=1 locks=0 parse=0 get=692
2025-02-28 09:34:28 gpg[9252]        build=0 update=0 insert=0 delete=0
2025-02-28 09:34:28 gpg[9252]        reset=1 found=692 not=1 cache=0 not=0
2025-02-28 09:34:28 gpg[9252] kid_not_found_cache: count=0 peak=0 flushes=0
2025-02-28 09:34:28 gpg[9252] sig_cache: total=47 cached=47 good=47 bad=0
2025-02-28 09:34:28 gpg[9252] objcache: keys=0/0/0 chains=0,0..0 
buckets=0/0 attic=0
2025-02-28 09:34:28 gpg[9252] objcache: uids=0/0/0 chains=0,0..0 buckets=0/0
2025-02-28 09:34:28 gpg[9252] random usage: poolsize=600 mixed=0 
polls=0/0 added=0/0
               outmix=0 getlvl1=0/0 getlvl2=0/0
2025-02-28 09:34:28 gpg[9252] rndjent stat: collector=0x0000000000000000 
calls=0 bytes=0
2025-02-28 09:34:28 gpg[9252] secmem usage: 0/32768 bytes in 0 blocks

And within MSYS (bash):
$ export GNUPGHOME=/c/Users/<user>/AppData/Roaming/gnupg
$ gpg --debug-all --list-secret-keys
gpg: reading options from '/c/Users/<user>/AppData/Roaming/gnupg/gpg.conf'
gpg: reading options from '[cmdline]'
2025-02-28 09:47:28 gpg[464] enabled debug flags: memstat
2025-02-28 09:47:28 gpg[464] enabled compatibility flags:
2025-02-28 09:47:28 gpg[464] using pgp trust model
2025-02-28 09:47:28 gpg[464] no running gpg-agent - starting 
'/usr/bin/gpg-agent'
2025-02-28 09:47:28 gpg[464] invalid size of lockfile 
'/c/Users/<user>/AppData/Roaming/gnupg/gnupg_spawn_agent_sentinel.lock'
2025-02-28 09:47:28 gpg[464] cannot read lockfile
[...]
2025-02-28 09:47:34 gpg[464] can't connect to the gpg-agent: Invalid 
argument
2025-02-28 09:47:34 gpg[464] keydb: handles=1 locks=0 parse=0 get=692
2025-02-28 09:47:34 gpg[464]        build=0 update=0 insert=0 delete=0
2025-02-28 09:47:34 gpg[464]        reset=1 found=692 not=1 cache=0 not=0
2025-02-28 09:47:34 gpg[464] kid_not_found_cache: count=0 peak=0 flushes=0
2025-02-28 09:47:34 gpg[464] sig_cache: total=0 cached=0 good=0 bad=0
2025-02-28 09:47:34 gpg[464] objcache: keys=0/0/0 chains=0,0..0 
buckets=0/0 attic=0
2025-02-28 09:47:34 gpg[464] objcache: uids=0/0/0 chains=0,0..0 buckets=0/0
2025-02-28 09:47:34 gpg[464] random usage: poolsize=600 mixed=0 
polls=0/0 added=0/0
               outmix=0 getlvl1=0/0 getlvl2=0/0
2025-02-28 09:47:34 gpg[464] rndjent stat: collector=0x0000000000000000 
calls=0 bytes=0
2025-02-28 09:47:34 gpg[464] secmem usage: 0/65536 bytes in 0 blocks

Looks like the configuration files have to be different to, to make it 
work. ;-(

MSYS (bash, GNUPGHOME=/c/Users/<user>/AppData/Roaming/gnupg):
$ gpg --version
gpg (GnuPG) 2.4.7
libgcrypt 1.11.0-unknown
Copyright (C) 2024 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /c/Users/<user>/AppData/Roaming/gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
         CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Windows (cmd.exe, GNUPGHOME=C:\Users\<user>\AppData\Roaming\gnupg):
$ gpg --version
gpg (GnuPG) 2.5.4
libgcrypt 1.11.0
Copyright (C) 2025 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: C:\Users\<user>\AppData\Roaming\gnupg
Unterstützte Verfahren:
Öff. Schlüssel: RSA, Kyber, ELG, DSA, ECDH, ECDSA, EDDSA
Verschlü.: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
            CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Komprimierung: nicht komprimiert, ZIP, ZLIB, BZIP2
-- 
Thomas
_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to