summaryrefslogtreecommitdiff
path: root/tests/cert-tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-15 12:58:02 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-15 16:26:53 +0200
commitfa1091c64669df1c0c78cd1bd20aad0745ea7ac4 (patch)
tree0ee4adc7e8d836e75763b093e051907f58c581b6 /tests/cert-tests
parent120ee97b931adabff587101bbf8c57a379b93e01 (diff)
downloadgnutls-fa1091c64669df1c0c78cd1bd20aad0745ea7ac4.tar.gz
tests: use certtool to check RSA-PSS to RSA conversion
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/cert-tests')
-rw-r--r--tests/cert-tests/Makefile.am1
-rwxr-xr-xtests/cert-tests/certtool-rsa-pss21
-rw-r--r--tests/cert-tests/data/key-rsa-pss-raw.pem27
-rw-r--r--tests/cert-tests/data/key-rsa-pss.pem29
4 files changed, 78 insertions, 0 deletions
diff --git a/tests/cert-tests/Makefile.am b/tests/cert-tests/Makefile.am
index 82a837b2af..a5b5178626 100644
--- a/tests/cert-tests/Makefile.am
+++ b/tests/cert-tests/Makefile.am
@@ -63,6 +63,7 @@ EXTRA_DIST = data/ca-no-pathlen.pem data/no-ca-or-pathlen.pem data/aki-cert.pem
data/openssl-keyid.p7b data/openssl-keyid.p7b.out data/openssl.p12 \
data/x509-v1-with-sid.pem data/x509-v1-with-iid.pem data/x509-v3-with-fractional-time.pem \
templates/template-long-dns.tmpl \
+ data/key-rsa-pss-raw.pem data/key-rsa-pss.pem \
data/long-dns.pem data/template-long-dns-crq.pem data/chain-with-critical-on-root.pem \
data/chain-with-critical-on-intermediate.pem data/chain-with-critical-on-endcert.pem \
templates/crit-extensions.tmpl data/crit-extensions.pem data/x509-with-zero-version.pem \
diff --git a/tests/cert-tests/certtool-rsa-pss b/tests/cert-tests/certtool-rsa-pss
index 81417d199b..f8126a5523 100755
--- a/tests/cert-tests/certtool-rsa-pss
+++ b/tests/cert-tests/certtool-rsa-pss
@@ -112,6 +112,27 @@ if test "${rc}" != "0"; then
fi
done
+# Convert an RSA-PSS key to an RSA key
+#
+
+${VALGRIND} "${CERTTOOL}" --to-rsa --infile "${srcdir}/data/key-rsa-pss.pem" --outfile ${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "Could not convert an RSA-PSS certificate"
+ exit 1
+fi
+
+${DIFF} "${srcdir}/data/key-rsa-pss-raw.pem" ${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "RSA-PSS decoding failed"
+ exit ${rc}
+fi
+
+echo "RSA-PSS to RSA conversion was successful"
+
export TZ="UTC"
. ${srcdir}/../scripts/common.sh
diff --git a/tests/cert-tests/data/key-rsa-pss-raw.pem b/tests/cert-tests/data/key-rsa-pss-raw.pem
new file mode 100644
index 0000000000..6ef9e8b611
--- /dev/null
+++ b/tests/cert-tests/data/key-rsa-pss-raw.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAndjwZ1p/m9BbCDGxvn/yvqINoivwaCwrCQ94/ckTUhw+sE4n
+2MDU23tSxf/Ac8XMFUQg9M6W6RUGsG48W5gUs616kJVBRRtdQ7zQWsOfK4BxqN02
+Aq7RSAXy284sgdcP71nl9MR77/DDCdYkUnWPu2N+mtnFfrPOT3TuAU6WZS38vCzz
++qevnYFaAvvbU7th9cAEWDlaIPo7fQNx8dC9ccVVk3nRaIitrFaLs3y0Y36eXDsL
+kR0g9qm6RjgHjVVWjhPPAb96SBj4LjMNKgHRA6NtIUWB9tyyMrwcAaAp8hTZwFYj
+LS2tkJV0pYlfWvQSjl2I1swHrKNkheKXR3L3eQIDAQABAoIBAAKf1QzSR52AQCPH
+RbwBjMqaYaQA7af9KNwnYeFpcZmKa5sdTGUV/RZG8gOcgrBw7bBQHI4ERNtntI1f
+dPbMvi1euUD7WJMRdN3A6G0xUcj5MRzcXqyxPpgD2ZcAmxELI+2lx/LedP5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Yu++P/oa5a8Ha1rk4vjyfkqcZST4CHitTJLQgNwQUPMRkg==
+-----END RSA PRIVATE KEY-----
diff --git a/tests/cert-tests/data/key-rsa-pss.pem b/tests/cert-tests/data/key-rsa-pss.pem
new file mode 100644
index 0000000000..1339318c9b
--- /dev/null
+++ b/tests/cert-tests/data/key-rsa-pss.pem
@@ -0,0 +1,29 @@
+-----BEGIN PRIVATE KEY-----
+MIIE/QIBADALBgkqhkiG9w0BAQoEggSoMIIEpAIBAAKCAQEAndjwZ1p/m9BbCDGx
+vn/yvqINoivwaCwrCQ94/ckTUhw+sE4n2MDU23tSxf/Ac8XMFUQg9M6W6RUGsG48
+W5gUs616kJVBRRtdQ7zQWsOfK4BxqN02Aq7RSAXy284sgdcP71nl9MR77/DDCdYk
+UnWPu2N+mtnFfrPOT3TuAU6WZS38vCzz+qevnYFaAvvbU7th9cAEWDlaIPo7fQNx
+8dC9ccVVk3nRaIitrFaLs3y0Y36eXDsLkR0g9qm6RjgHjVVWjhPPAb96SBj4LjMN
+KgHRA6NtIUWB9tyyMrwcAaAp8hTZwFYjLS2tkJV0pYlfWvQSjl2I1swHrKNkheKX
+R3L3eQIDAQABAoIBAAKf1QzSR52AQCPHRbwBjMqaYaQA7af9KNwnYeFpcZmKa5sd
+TGUV/RZG8gOcgrBw7bBQHI4ERNtntI1fdPbMvi1euUD7WJMRdN3A6G0xUcj5MRzc
+XqyxPpgD2ZcAmxELI+2lx/LedP5XFM1XmbZaivL4c1PO1N+nld0QinEwelYlW3sl
+HPT2ogpx2MuA9vcmgHjwooblZOwZFVrf43GZ2JGwoqpSeKJP0VeKGrgjrHRlkaR3
+jBNZ9wj/Kq4pkW8a3pxL/sbwAxvqbNcdvjaolnXv7rOy2DcxyN4CZ6SXJGWn8DC5
+SCbF5UnoUY5I3Kvd3CKFbGuV9z4z+g5BXMJ90EECgYEAtsIcY/YrAHdDn9BrOp0F
+hdYdalBN1GXqx0o8euCjtVeh3nh9ZAj7q3xYJiv8seLe8kucGL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