aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport-certificate-creation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-transport-certificate-creation.c')
-rw-r--r--src/transport/gnunet-transport-certificate-creation.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c
index 258c9e69a..a63c21c60 100644
--- a/src/transport/gnunet-transport-certificate-creation.c
+++ b/src/transport/gnunet-transport-certificate-creation.c
@@ -29,20 +29,19 @@
29#include "gnunet_os_lib.h" 29#include "gnunet_os_lib.h"
30 30
31 31
32static void 32static void
33removecerts (const char *file1, 33removecerts (const char *file1, const char *file2)
34 const char *file2)
35{ 34{
36 if (GNUNET_DISK_file_test (file1) == GNUNET_YES) 35 if (GNUNET_DISK_file_test (file1) == GNUNET_YES)
37 { 36 {
38 CHMOD (file1, S_IWUSR | S_IRUSR); 37 CHMOD (file1, S_IWUSR | S_IRUSR);
39 REMOVE (file1); 38 REMOVE (file1);
40 } 39 }
41 if (GNUNET_DISK_file_test (file2) == GNUNET_YES) 40 if (GNUNET_DISK_file_test (file2) == GNUNET_YES)
42 { 41 {
43 CHMOD (file2, S_IWUSR | S_IRUSR); 42 CHMOD (file2, S_IWUSR | S_IRUSR);
44 REMOVE (file2); 43 REMOVE (file2);
45 } 44 }
46} 45}
47 46
48 47
@@ -54,27 +53,26 @@ main (int argc, char **argv)
54 if (argc != 3) 53 if (argc != 3)
55 return 1; 54 return 1;
56 removecerts (argv[1], argv[2]); 55 removecerts (argv[1], argv[2]);
57 close (2); /* eliminate stderr */ 56 close (2); /* eliminate stderr */
58 /* Create RSA Private Key */ 57 /* Create RSA Private Key */
59 /* openssl genrsa -out $1 1024 2> /dev/null */ 58 /* openssl genrsa -out $1 1024 2> /dev/null */
60 openssl = GNUNET_OS_start_process (NULL, NULL, 59 openssl = GNUNET_OS_start_process (NULL, NULL,
61 "openssl", 60 "openssl",
62 "openssl", 61 "openssl",
63 "genrsa", "-out", argv[1], "1024", 62 "genrsa", "-out", argv[1], "1024", NULL);
64 NULL);
65 if (openssl == NULL) 63 if (openssl == NULL)
66 return 2; 64 return 2;
67 GNUNET_assert (GNUNET_OS_process_wait (openssl) == GNUNET_OK); 65 GNUNET_assert (GNUNET_OS_process_wait (openssl) == GNUNET_OK);
68 GNUNET_OS_process_close (openssl); 66 GNUNET_OS_process_close (openssl);
69 67
70 /* Create a self-signed certificate in batch mode using rsa key*/ 68 /* Create a self-signed certificate in batch mode using rsa key */
71 /* openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null */ 69 /* openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null */
72 openssl = GNUNET_OS_start_process (NULL, NULL, 70 openssl = GNUNET_OS_start_process (NULL, NULL,
73 "openssl", 71 "openssl",
74 "openssl", 72 "openssl",
75 "req", "-batch", "-days", "365", 73 "req", "-batch", "-days", "365",
76 "-out", argv[2], "-new", "-x509", "-key", argv[1], 74 "-out", argv[2], "-new", "-x509", "-key",
77 NULL); 75 argv[1], NULL);
78 if (openssl == NULL) 76 if (openssl == NULL)
79 return 3; 77 return 3;
80 GNUNET_assert (GNUNET_OS_process_wait (openssl) == GNUNET_OK); 78 GNUNET_assert (GNUNET_OS_process_wait (openssl) == GNUNET_OK);