From 227436f2a5a839d85e76f1ad1d823de2137b8cbb Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Wed, 4 Feb 2009 00:58:25 -0500 Subject: [PATCH] add test of key conversion (openpgp2ssh and pem2openpgp) in test script. --- tests/basic | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/tests/basic b/tests/basic index a3d0b4f..ad72a22 100755 --- a/tests/basic +++ b/tests/basic @@ -120,7 +120,6 @@ if [ -e "$TEMPDIR" ] ; then echo "tempdir '$TEMPDIR' already exists." exit 1 fi -mkdir "$TEMPDIR" # Use the local copy of executables first, instead of system ones. # This should help us test without installing. @@ -143,6 +142,41 @@ export SOCKET="$TEMPDIR"/ssh-socket # *anything* with any running X11 session. export DISPLAY=monkeys +###################################################################### +### TEST KEY CONVERSION + +mkdir -p "$TEMPDIR" + +echo "##################################################" +echo "### test key conversion..." +export GNUPGHOME="$TEMPDIR" +# generate a key +gpg --batch --quick-random --gen-key < \ + "$TEMPDIR"/test.pem +# reconvert key, and compare to key in gpg keyring +diff -u \ + <(gpg --export-secret-key | hd) \ + <(PEM2OPENPGP_USAGE_FLAGS=sign,certify \ + PEM2OPENPGP_TIMESTAMP="$timestamp" pem2openpgp testtest < \ + "$TEMPDIR"/test.pem | hd ) + +# clear out the temp dir +rm -rf "$TEMPDIR" +mkdir -p "$TEMPDIR" ###################################################################### ### CONFIGURE ENVIRONMENTS @@ -154,7 +188,7 @@ cp -a "$TESTDIR"/home/admin "$TEMPDIR"/ cp -a "$TESTDIR"/home/testuser "$TEMPDIR"/ # set up environment for testuser -TESTHOME="$TEMPDIR"/testuser +export TESTHOME="$TEMPDIR"/testuser export GNUPGHOME="$TESTHOME"/.gnupg export SSH_ASKPASS="$TESTHOME"/.ssh/askpass export MONKEYSPHERE_HOME="$TESTHOME"/.monkeysphere -- 2.25.1