summaryrefslogtreecommitdiffstats
path: root/tests/pkcs12_s2k_pem.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/pkcs12_s2k_pem.c289
1 files changed, 289 insertions, 0 deletions
diff --git a/tests/pkcs12_s2k_pem.c b/tests/pkcs12_s2k_pem.c
new file mode 100644
index 0000000..49715a1
--- /dev/null
+++ b/tests/pkcs12_s2k_pem.c
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ *
+ * Author: Simon Josefsson
+ *
+ * This file is part of GnuTLS.
+ *
+ * GnuTLS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuTLS is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GnuTLS; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*
+ * Regression check for buggy PKCS#12 string to key problem reported
+ * in <http://thread.gmane.org/gmane.network.gnutls.general/1663>.
+ *
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utils.h>
+
+#include <gnutls/gnutls.h>
+#include <gnutls/x509.h>
+
+#define X_9607 \
+ "-----BEGIN ENCRYPTED PRIVATE KEY-----\n" \
+ "MIICojAcBgoqhkiG9w0BDAEDMA4ECL9rjpW835n6AgIIAASCAoAjs558e/tWq5ho\n" \
+ "X3uYORURfasssTfqyZoSaTmEWJGbW7T+QK+ebZ8CyMVbR1ORD3rd6r7cWLsX3Ju0\n" \
+ "hGncPFVpwCtwApZKnWCunj4KcsRuWdm1vAauRV2CDkykMzNlsJz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vEXVOMRZB17F9PncpEiIBpnrisdD7h9MpS63LuJdEtiK\n" \
+ "jpPwFwV3orFJceurq/R3ql2aKYc9MZSzkKd71QImgHYWv+IPCctl40/PZV08yKMn\n" \
+ "RCMVFb/YYUrzaWSerroyjz4Kr8V0nEyKpk4YLv7o7WPGn4x8X30z0BRCA9CBwzHY\n" \
+ "JMxu1FhOGXr6nx1XeaoCOt9JV8GWb+VzkATABPzFG915ULz0ma1petQyb18QyBsl\n" \
+ "K9NZETrGzDYiNxkjqILhY6IRneB97C4kCH55qhXHFk5fjiWndpQ6+BFKqlCqm6Up\n" \
+ "d1EF3uuKN+vY6xQbGCgFE4FHL46nb2YaoaqhPp4dj4qnRSllgBvmZbGTd243lAbT\n" \
+ "J4dh/gzRwQYdIwbvcNVi9GGSOy/fezAwwXu3ZD9BqqqoCQJajrILuovbcPThy71k\n" \
+ "H5EaegQ1rB+0/sn91JUb6w4pwN/54gzZGaz2F0/2xB9u57+PIMC9R8dU7uW/xWfA\n" \
+ "WN7YTzPDNfevbx/LIa6VR5gsiRqCnthSsGvWFquRatMv1JrDfFUywFU9zk9W+iA2\n" \
+ "rtNpXV140+/BDfHbYYrUIaklJsNP0FRXKpPw9wPHHmbOjHfFK+o8PrtOp3HUsCJm\n" \
+ "2VpQtbNl66+rPLZLsbXhuJ5eY/BpRvrj6rDFPs19OAvYyrIsuQY8IdbZyGSKsq4u\n" \
+ "UBsHZgPBh718EtWFFrsTNxMlRKoh5MwUSqkLXeDduAFG4N7nhQpDHQ5/KRPrYOMK\n" \
+ "ixB1lLUK\n" \
+ "-----END ENCRYPTED PRIVATE KEY-----\n"
+
+#define X_9925 \
+ "-----BEGIN ENCRYPTED PRIVATE KEY-----\n" \
+ "MIICojAcBgoqhkiG9w0BDAEDMA4ECDnNkmSKl37mAgIIAASCAoAwttidBRLnnjti\n" \
+ "b5BEsc8cO2vzImhJbYCrVDjkTpmS6IYD4FsC8KFDdQJrEYIptrwXn4uDWDUu6bxB\n" \
+ "pb02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 "UWl07o3w\n" \
+ "-----END ENCRYPTED PRIVATE KEY-----\n"
+
+static struct {
+ const char *name;
+ const char *password;
+ const char *pkcs12key;
+ int expected_result;
+} keys[] = {
+ {
+ "x_9607", "123456", X_9607, 0}, {
+ "x_9671", "123456", X_9671, 0}, {
+ "x_9925", "123456", X_9925, 0}, {
+ "x_9926", "123456", X_9926, 0}, {
+ "x_9927", "123456", X_9927, 0}, {
+ "x_9928", "123456", X_9928, 0}, {
+ "x_9929", "123456", X_9929, 0}, {
+ "x_9930", "123456", X_9930, 0}, {
+ "x_9931", "123456", X_9931, 0}, {
+ "x_9932", "123456", X_9932, 0}
+};
+
+int main(void)
+{
+ gnutls_x509_privkey_t key;
+ size_t i;
+ int ret;
+
+ if (gnutls_fips140_mode_enabled())
+ exit(77);
+
+ global_init();
+
+ for (i = 0; i < sizeof(keys) / sizeof(keys[0]); i++) {
+ gnutls_datum_t tmp;
+
+ ret = gnutls_x509_privkey_init(&key);
+ if (ret < 0)
+ return 1;
+
+ tmp.data = (unsigned char *) keys[i].pkcs12key;
+ tmp.size = strlen((char *) tmp.data);
+
+ ret = gnutls_x509_privkey_import_pkcs8(key, &tmp,
+ GNUTLS_X509_FMT_PEM,
+ keys[i].password,
+ 0);
+ gnutls_x509_privkey_deinit(key);
+
+ if (ret != keys[i].expected_result) {
+ printf("fail[%d]: %d: %s\n", (int) i, ret,
+ gnutls_strerror(ret));
+ return 1;
+ }
+
+ }
+
+ gnutls_global_deinit();
+
+ return 0;
+}