[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Sun Mar 29 02:30:03 UTC 2015


The branch master has been updated
       via  79a578b90244b890c8a6a8fc26c03943da71c054 (commit)
      from  b1f3442857c1fd76e91941141bf671d19e90a79d (commit)


- Log -----------------------------------------------------------------
commit 79a578b90244b890c8a6a8fc26c03943da71c054
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Thu Mar 26 15:56:00 2015 +0000

    Add private/public key conversion tests
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 test/Makefile           | 13 +++++--
 test/testdsa.pem        | 12 ++++++
 test/testdsapub.pem     | 12 ++++++
 test/testec-p256.pem    |  5 +++
 test/testecpub-p256.pem |  4 ++
 test/testrsapub.pem     |  4 ++
 test/tkey               | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
 test/trsa               | 83 -----------------------------------------
 8 files changed, 145 insertions(+), 87 deletions(-)
 create mode 100644 test/testdsa.pem
 create mode 100644 test/testdsapub.pem
 create mode 100644 test/testec-p256.pem
 create mode 100644 test/testecpub-p256.pem
 create mode 100644 test/testrsapub.pem
 create mode 100644 test/tkey
 delete mode 100644 test/trsa

diff --git a/test/Makefile b/test/Makefile
index fc16227..f4635b8 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -231,8 +231,9 @@ test_x509: ../apps/openssl$(EXE_EXT) tx509 testx509.pem v3-cert1.pem v3-cert2.pe
 	echo test second x509v3 certificate
 	sh ./tx509 v3-cert2.pem 2>/dev/null
 
-test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl$(EXE_EXT) trsa testrsa.pem
-	@sh ./trsa 2>/dev/null
+test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl$(EXE_EXT) tkey testrsa.pem
+	@sh ./tkey testrsa.pem rsa private 2>/dev/null
+	@sh ./tkey testrsapub.pem rsa public 2>/dev/null
 	../util/shlib_wrap.sh ./$(RSATEST)
 
 test_crl: ../apps/openssl$(EXE_EXT) tcrl testcrl.pem
@@ -258,9 +259,11 @@ test_bn: $(BNTEST)$(EXE_EXT) $(EXPTEST)$(EXE_EXT) bctest
 	@echo 'test a^b%c implementations'
 	../util/shlib_wrap.sh ./$(EXPTEST)
 
-test_ec: $(ECTEST)$(EXE_EXT)
+test_ec: $(ECTEST)$(EXE_EXT) tkey testec-p256.pem
 	@echo 'test elliptic curves'
 	../util/shlib_wrap.sh ./$(ECTEST)
+	@sh ./tkey testec-p256.pem ec private 2>/dev/null
+	@sh ./tkey testecpub-p256.pem ec public 2>/dev/null
 
 test_ecdsa: $(ECDSATEST)$(EXE_EXT)
 	@echo 'test ecdsa'
@@ -279,10 +282,12 @@ test_dh: $(DHTEST)$(EXE_EXT)
 	@echo "Generate a set of DH parameters"
 	../util/shlib_wrap.sh ./$(DHTEST)
 
-test_dsa: $(DSATEST)$(EXE_EXT)
+test_dsa: $(DSATEST)$(EXE_EXT) tkey testdsa.pem
 	@echo "Generate a set of DSA parameters"
 	../util/shlib_wrap.sh ./$(DSATEST)
 	../util/shlib_wrap.sh ./$(DSATEST) -app2_1
+	@sh ./tkey testdsa.pem dsa private 2>/dev/null
+	@sh ./tkey testdsapub.pem dsa public 2>/dev/null
 
 test_gen testreq.pem: ../apps/openssl$(EXE_EXT) testgen test.cnf
 	@echo "Generate and verify a certificate request"
diff --git a/test/testdsa.pem b/test/testdsa.pem
new file mode 100644
index 0000000..b2ca5ba
--- /dev/null
+++ b/test/testdsa.pem
@@ -0,0 +1,12 @@
+-----BEGIN DSA PRIVATE KEY-----
+MIIBvQIBAAKBgQD9Ko2Ezy2mKeOV4oJsjy8Ves9Av6bPvr5y6iFTVpGQewjzsAHS
+l3eAxwyrvE0cx8cQ4ODieVRnWibZIEoF2NRUBw3l/6o8wo1BZTnF7wtZpNr6QcCQ
+QNC3CaQZ0lw2rOewGxqZpeXmYurfceRnsZBSpQiw8kW+JTgCbRJtVAYF1wIVAN+X
+sK/vqcIQlD6ZV055LoV4qv0jAoGBAL52x3C4paZkU61ZTiIgUKPXBpanQ4a7nsjd
+iSjzgnto+rveVuFkZQKaD7Wts8SLpojBat7supr+qF1pWVpRwxOXofdO72XdKm5u
+3co7sLnqf/WVCmzX9/unlAsGfDG1R6RqA71MnQJ5q56LwAzqK23ZfGt5v1Wpho36
+FY/JnLZ2AoGBAMyZoH2YF7/wO7CbGD6bGet3q+zxksOp+6gz2+ae23Gajpd3u4Jz
+bOxqjk4vrQaTrMPRRWXWJxC5WwLMalzwke75wi8gGT6+EUxFoLXlSmRQN+h4f+Ab
+OHFQiiW9v3xrgUKPiYWPEz/bhYw5DC73vPfkHXxmV495KiSIx4fvfH1BAhUAv3HU
+l7iXVdDF5BKF2B+Vd8w9+MI=
+-----END DSA PRIVATE KEY-----
diff --git a/test/testdsapub.pem b/test/testdsapub.pem
new file mode 100644
index 0000000..70e7d5c
--- /dev/null
+++ b/test/testdsapub.pem
@@ -0,0 +1,12 @@
+-----BEGIN PUBLIC KEY-----
+MIIBuDCCASwGByqGSM44BAEwggEfAoGBAP0qjYTPLaYp45XigmyPLxV6z0C/ps++
+vnLqIVNWkZB7CPOwAdKXd4DHDKu8TRzHxxDg4OJ5VGdaJtkgSgXY1FQHDeX/qjzC
+jUFlOcXvC1mk2vpBwJBA0LcJpBnSXDas57AbGpml5eZi6t9x5GexkFKlCLDyRb4l
+OAJtEm1UBgXXAhUA35ewr++pwhCUPplXTnkuhXiq/SMCgYEAvnbHcLilpmRTrVlO
+IiBQo9cGlqdDhrueyN2JKPOCe2j6u95W4WRlApoPta2zxIumiMFq3uy6mv6oXWlZ
+WlHDE5eh907vZd0qbm7dyjuwuep/9ZUKbNf3+6eUCwZ8MbVHpGoDvUydAnmrnovA
+DOorbdl8a3m/VamGjfoVj8mctnYDgYUAAoGBAMyZoH2YF7/wO7CbGD6bGet3q+zx
+ksOp+6gz2+ae23Gajpd3u4JzbOxqjk4vrQaTrMPRRWXWJxC5WwLMalzwke75wi8g
+GT6+EUxFoLXlSmRQN+h4f+AbOHFQiiW9v3xrgUKPiYWPEz/bhYw5DC73vPfkHXxm
+V495KiSIx4fvfH1B
+-----END PUBLIC KEY-----
diff --git a/test/testec-p256.pem b/test/testec-p256.pem
new file mode 100644
index 0000000..fb79a4c
--- /dev/null
+++ b/test/testec-p256.pem
@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIDYEX2yQlhJXDIwBEwcfyAn2eICEKJxqsAPGChey1a2toAoGCCqGSM49
+AwEHoUQDQgAEJXwAdITiPFcSUsaRI2nlzTNRn++q6F38XrH8m8sf28DQ+2Oob5SU
+zvgjVS0e70pIqH6bSXDgPc8mKtSs9Zi26Q==
+-----END EC PRIVATE KEY-----
diff --git a/test/testecpub-p256.pem b/test/testecpub-p256.pem
new file mode 100644
index 0000000..60695b8
--- /dev/null
+++ b/test/testecpub-p256.pem
@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJXwAdITiPFcSUsaRI2nlzTNRn++q
+6F38XrH8m8sf28DQ+2Oob5SUzvgjVS0e70pIqH6bSXDgPc8mKtSs9Zi26Q==
+-----END PUBLIC KEY-----
diff --git a/test/testrsapub.pem b/test/testrsapub.pem
new file mode 100644
index 0000000..bee2b95
--- /dev/null
+++ b/test/testrsapub.pem
@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKrbeqkuRk8VcRmWFmtP+LviMB3+6diz
+WW3DwaffznyHGAFwUJ/ITv0XtbsCyl3QoyKGhrOAy3RvPK5M38iuXT0CAwEAAQ==
+-----END PUBLIC KEY-----
diff --git a/test/tkey b/test/tkey
new file mode 100644
index 0000000..611ed7d
--- /dev/null
+++ b/test/tkey
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+t=$1
+ktype=$2
+ptype=$3
+
+if ../util/shlib_wrap.sh ../apps/openssl no-$ktype; then
+  echo skipping $ktype $ptype conversion test
+  exit 0
+fi
+
+if [ $ptype = "public" ]; then
+    cmd="../util/shlib_wrap.sh ../apps/openssl $ktype -pubin -pubout"
+else
+    cmd="../util/shlib_wrap.sh ../apps/openssl $ktype"
+fi
+
+echo testing $ktype $ptype conversions
+cp $t $ktype-fff.p
+
+echo "p -> d"
+$cmd -in $ktype-fff.p -inform p -outform d >$ktype-f.d
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> p"
+$cmd -in $ktype-fff.p -inform p -outform p >$ktype-f.p
+if [ $? != 0 ]; then exit 1; fi
+
+echo "d -> d"
+$cmd -in $ktype-f.d -inform d -outform d >$ktype-ff.d1
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> d"
+$cmd -in $ktype-f.p -inform p -outform d >$ktype-ff.d3
+if [ $? != 0 ]; then exit 1; fi
+
+echo "d -> p"
+$cmd -in $ktype-f.d -inform d -outform p >$ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> p"
+$cmd -in $ktype-f.p -inform p -outform p >$ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+cmp $ktype-fff.p $ktype-f.p
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-fff.p $ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-fff.p $ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+cmp $ktype-f.p $ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-f.p $ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+/bin/rm -f $ktype-f.* $ktype-ff.* $ktype-fff.*
+
+if [ $ptype = "public" ]; then
+    exit 0
+fi
+
+cmd="../util/shlib_wrap.sh ../apps/openssl pkey"
+
+echo testing $ktype PKCS#8 conversions
+
+$cmd -in $t -out $ktype-fff.p
+
+echo "p -> d"
+$cmd -in $ktype-fff.p -inform p -outform d >$ktype-f.d
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> p"
+$cmd -in $ktype-fff.p -inform p -outform p >$ktype-f.p
+if [ $? != 0 ]; then exit 1; fi
+
+echo "d -> d"
+$cmd -in $ktype-f.d -inform d -outform d >$ktype-ff.d1
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> d"
+$cmd -in $ktype-f.p -inform p -outform d >$ktype-ff.d3
+if [ $? != 0 ]; then exit 1; fi
+
+echo "d -> p"
+$cmd -in $ktype-f.d -inform d -outform p >$ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+echo "p -> p"
+$cmd -in $ktype-f.p -inform p -outform p >$ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+cmp $ktype-fff.p $ktype-f.p
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-fff.p $ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-fff.p $ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+cmp $ktype-f.p $ktype-ff.p1
+if [ $? != 0 ]; then exit 1; fi
+cmp $ktype-f.p $ktype-ff.p3
+if [ $? != 0 ]; then exit 1; fi
+
+/bin/rm -f $ktype-f.* $ktype-ff.* $ktype-fff.*
diff --git a/test/trsa b/test/trsa
deleted file mode 100644
index 5a2290f..0000000
--- a/test/trsa
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
-  echo skipping rsa conversion test
-  exit 0
-fi
-
-cmd='../util/shlib_wrap.sh ../apps/openssl rsa'
-
-if [ "$1"x != "x" ]; then
-	t=$1
-else
-	t=testrsa.pem
-fi
-
-echo testing rsa conversions
-cp $t rsa-fff.p
-
-echo "p -> d"
-$cmd -in rsa-fff.p -inform p -outform d >rsa-f.d
-if [ $? != 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in rsa-fff.p -inform p -outform t >rsa-f.t
-#if [ $? != 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in rsa-fff.p -inform p -outform p >rsa-f.p
-if [ $? != 0 ]; then exit 1; fi
-
-echo "d -> d"
-$cmd -in rsa-f.d -inform d -outform d >rsa-ff.d1
-if [ $? != 0 ]; then exit 1; fi
-#echo "t -> d"
-#$cmd -in rsa-f.t -inform t -outform d >rsa-ff.d2
-#if [ $? != 0 ]; then exit 1; fi
-echo "p -> d"
-$cmd -in rsa-f.p -inform p -outform d >rsa-ff.d3
-if [ $? != 0 ]; then exit 1; fi
-
-#echo "d -> t"
-#$cmd -in rsa-f.d -inform d -outform t >rsa-ff.t1
-#if [ $? != 0 ]; then exit 1; fi
-#echo "t -> t"
-#$cmd -in rsa-f.t -inform t -outform t >rsa-ff.t2
-#if [ $? != 0 ]; then exit 1; fi
-#echo "p -> t"
-#$cmd -in rsa-f.p -inform p -outform t >rsa-ff.t3
-#if [ $? != 0 ]; then exit 1; fi
-
-echo "d -> p"
-$cmd -in rsa-f.d -inform d -outform p >rsa-ff.p1
-if [ $? != 0 ]; then exit 1; fi
-#echo "t -> p"
-#$cmd -in rsa-f.t -inform t -outform p >rsa-ff.p2
-#if [ $? != 0 ]; then exit 1; fi
-echo "p -> p"
-$cmd -in rsa-f.p -inform p -outform p >rsa-ff.p3
-if [ $? != 0 ]; then exit 1; fi
-
-cmp rsa-fff.p rsa-f.p
-if [ $? != 0 ]; then exit 1; fi
-cmp rsa-fff.p rsa-ff.p1
-if [ $? != 0 ]; then exit 1; fi
-#cmp rsa-fff.p rsa-ff.p2
-#if [ $? != 0 ]; then exit 1; fi
-cmp rsa-fff.p rsa-ff.p3
-if [ $? != 0 ]; then exit 1; fi
-
-#cmp rsa-f.t rsa-ff.t1
-#if [ $? != 0 ]; then exit 1; fi
-#cmp rsa-f.t rsa-ff.t2
-#if [ $? != 0 ]; then exit 1; fi
-#cmp rsa-f.t rsa-ff.t3
-#if [ $? != 0 ]; then exit 1; fi
-
-cmp rsa-f.p rsa-ff.p1
-if [ $? != 0 ]; then exit 1; fi
-#cmp rsa-f.p rsa-ff.p2
-#if [ $? != 0 ]; then exit 1; fi
-cmp rsa-f.p rsa-ff.p3
-if [ $? != 0 ]; then exit 1; fi
-
-/bin/rm -f rsa-f.* rsa-ff.* rsa-fff.*
-exit 0


More information about the openssl-commits mailing list