mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
12af2630cf
* agent/findkey.c (write_extended_private_key): New function. (agent_write_private_key): Detect if an existing file is in extended format and update the key within if it is. (read_key_file): Handle the new format. * agent/keyformat.txt: Document the new format. * common/Makefile.am: Add the new files. * common/private-keys.c: New file. * common/private-keys.h: Likewise. * common/t-private-keys.c: Likewise. * common/util.h (alphap, alnump): New macros. * tests/migrations: Add test demonstrating that we can cope with the new format. -- GnuPG 2.3+ will use a new format to store private keys that is both more flexible and easier to read and edit by human beings. The new format stores name,value-pairs using the common mail and http header convention. This patch adds the parser and support code and prepares GnuPG 2.1 for the new format. Signed-off-by: Justus Winter <justus@g10code.com>
58 lines
1.5 KiB
Bash
Executable File
58 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright 2016 g10 Code GmbH
|
|
#
|
|
# This file is free software; as a special exception the author gives
|
|
# unlimited permission to copy and/or distribute it, with or without
|
|
# modifications, as long as this notice is preserved. This file is
|
|
# distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY, to the extent permitted by law; without even the implied
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
if [ -z "$srcdir" ]; then
|
|
echo "not called from make" >&2
|
|
exit 1
|
|
fi
|
|
|
|
unset GNUPGHOME
|
|
set -e
|
|
|
|
# (We may not use a relative name for gpg-agent.)
|
|
GPG_AGENT="$(cd ../../agent && /bin/pwd)/gpg-agent"
|
|
GPG="../../g10/gpg --no-permission-warning --no-greeting --no-secmem-warning
|
|
--batch --agent-program=${GPG_AGENT}|--debug-quick-random"
|
|
|
|
TEST="extended-private-key-format"
|
|
|
|
setup_home()
|
|
{
|
|
XGNUPGHOME="`mktemp -d`"
|
|
mkdir -p "$XGNUPGHOME/private-keys-v1.d"
|
|
for F in $srcdir/$TEST.gpghome/*.asc; do
|
|
$GPG --dearmor <"$F" >"$XGNUPGHOME/`basename $F .asc`"
|
|
done
|
|
for F in $srcdir/$TEST.gpghome/private-keys-v1.d/*.asc; do
|
|
$GPG --dearmor <"$F" >"$XGNUPGHOME/private-keys-v1.d/`basename $F .asc`"
|
|
done
|
|
chmod go-rwx $XGNUPGHOME/* $XGNUPGHOME/*/*
|
|
export GNUPGHOME="$XGNUPGHOME"
|
|
}
|
|
|
|
cleanup_home()
|
|
{
|
|
rm -rf -- "$XGNUPGHOME"
|
|
}
|
|
|
|
assert_keys_usable()
|
|
{
|
|
for KEY in C40FDECF ECABF51D; do
|
|
$GPG --list-secret-keys $KEY >/dev/null
|
|
done
|
|
}
|
|
|
|
setup_home
|
|
assert_keys_usable
|
|
cleanup_home
|
|
|
|
|
|
# XXX try changing a key, and check that the format is not changed.
|