gpg --gen-key keyring behaviour

zem zem at vigilant.tv
Sat May 24 05:08:03 CEST 2003


On Sat, 24 May 2003 04:47 am, John Clizbe wrote:

> Environment variables in Win32 need '%' on both ends of the name to
> be expanded.
>
> C:\> echo %PATH   results in '%PATH'
>
> C:\> echo %PATH%  results in the full path string
>
> What happens if you use %pubring% and %secring% instead of %pubring
> and %secring ?

That's not the problem.  The '%' commands are in data files piped to 
gpg; they're never parsed by the shell.  If I change them as you 
suggest, gpg ignores them:

	gpg: skipping control `%pubring%' (.\test.pub)

Besides, the problem isn't that the directives are failing to work.  
win32 gpg is correctly following the directive and using the specified 
keyrings.  The problem is that on subsequent runs it overwrites the 
secret keyring.

Here's some sample data that illustrates the problem.  The .bat file 
generates two keys in batch mode, placing them in 'test.pub' and 
'test.sec' in the current directory (the same problem occurs using 
absolute paths, in case you're wondering).  After each keygen it lists 
the secret keys.  Following the second keygen, the first secret key has 
disappeared.

First, here's some sample output.  The second '--list-secret-keys' 
should show two keys, but as you can see only the second one is there:

C:\gpgtest>type keygen1.txt   | gpg.exe --batch --status-fd 2 
--secret-keyring .\test.sec --keyring .\test.pub --no-default-keyring 
-v --gen-key -
C:\gpgtest>gpg.exe --batch --status-fd 2 --no-default-keyring 
--secret-keyring .\test.sec --keyring .\test.pub --list-secret-keys 
.\test.sec
----------
sec  1024D/200F0368 2003-05-24 test 1 (test 1) <none>
ssb  1536g/EA3B5524 2003-05-24

C:\gpgtest>type keygen2.txt   | gpg.exe --batch --status-fd 2 
--secret-keyring .\test.sec --keyring .\test.pub --no-default-keyring 
-v --gen-key - 
C:\gpgtest>gpg.exe --batch --status-fd 2 --no-default-keyring 
--secret-keyring .\test.sec --keyring .\test.pub --list-secret-keys 
.\test.sec
----------
sec  1024D/62B48BF3 2003-05-24 test 2 (test 2) <none>
ssb  1536g/8FC87742 2003-05-24



Here's the batch file and data files to reproduce the problem (please 
excuse the wordwrap):

--- kgtest.bat
type keygen1.txt | gpg.exe --batch --status-fd 2 --secret-keyring 
.\test.sec --keyring .\test.pub --no-default-keyring -v --gen-key -

gpg.exe --batch --status-fd 2 --no-default-keyring --secret-keyring 
.\test.sec --keyring .\test.pub --list-secret-keys

type keygen2.txt | gpg.exe --batch --status-fd 2 --secret-keyring 
.\test.sec --keyring .\test.pub --no-default-keyring -v --gen-key -

gpg.exe --batch --status-fd 2 --no-default-keyring --secret-keyring 
.\test.sec --keyring .\test.pub --list-secret-keys


--- keygen1.txt

%echo Generating a key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1536
Name-Real: test 1
Name-Comment: test 1
Name-Email: none
Expire-Date: 0
Passphrase: test
%pubring .\test.pub
%secring .\test.sec
%commit
%echo done

--- keygen2.txt

%echo Generating a key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1536
Name-Real: test 2
Name-Comment: test 2
Name-Email: none
Expire-Date: 0
Passphrase: test
%pubring .\test.pub
%secring .\test.sec
%commit
%echo done



-- 
mailto:zem at vigilant.tv F289 2BDB 1DA0 F4C4 DC87 EC36 B2E3 4E75 C853 FD93
http://vigilant.tv/    "..I'm invisible, I'm invisible, I'm invisible.." 






More information about the Gnupg-devel mailing list