[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20237 - in gnunet: doc/man src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20237 - in gnunet: doc/man src/util |
Date: |
Sun, 4 Mar 2012 15:37:52 +0100 |
Author: grothoff
Date: 2012-03-04 15:37:52 +0100 (Sun, 04 Mar 2012)
New Revision: 20237
Added:
gnunet/doc/man/gnunet-rsa.1
gnunet/src/util/gnunet-rsa.c
Modified:
gnunet/doc/man/Makefile.am
gnunet/src/util/Makefile.am
Log:
adding gnunet-rsa, a new tool to create RSA keys and to print the public key
Modified: gnunet/doc/man/Makefile.am
===================================================================
--- gnunet/doc/man/Makefile.am 2012-03-04 14:28:41 UTC (rev 20236)
+++ gnunet/doc/man/Makefile.am 2012-03-04 14:37:52 UTC (rev 20237)
@@ -8,6 +8,7 @@
gnunet-peerinfo.1 \
gnunet-pseudonym.1 \
gnunet-publish.1 \
+ gnunet-rsa.1 \
gnunet-search.1 \
gnunet-statistics.1 \
gnunet-transport.1 \
Added: gnunet/doc/man/gnunet-rsa.1
===================================================================
--- gnunet/doc/man/gnunet-rsa.1 (rev 0)
+++ gnunet/doc/man/gnunet-rsa.1 2012-03-04 14:37:52 UTC (rev 20237)
@@ -0,0 +1,34 @@
+.TH GNUNET\-RSA 1 "Jan 4, 2012" "GNUnet"
+
+.SH NAME
+gnunet\-rsa \- manipulate GNUnet RSA key files
+
+.SH SYNOPSIS
+.B gnunet\-rsa
+.RI [ options ] FILENAME
+.br
+
+.SH DESCRIPTION
+\fBgnunet\-rsa\fP can be used to create an RSA private key and to print the
corresponding public key. You must specify a filename containing an RSA
private key in GNUnet format as an argument. If the file does not exist,
gnunet\-rsa will create a key. This may then take a while. If the option \-p
is given, the corresponding public key will be printed to the console.
+
+.SH OPTIONS
+.B
+.IP "\-p, \-\-print"
+Print the corresponding public key (to stdout).
+.B
+.IP "\-c FILENAME, \-\-config=FILENAME"
+Use the configuration file FILENAME.
+.B
+.IP "\-h, \-\-help"
+Print short help on options.
+.B
+.IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL"
+Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR.
+.B
+.IP "\-v, \-\-version"
+Print GNUnet version number.
+
+
+.SH BUGS
+Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending
electronic mail to <address@hidden>
+
Modified: gnunet/src/util/Makefile.am
===================================================================
--- gnunet/src/util/Makefile.am 2012-03-04 14:28:41 UTC (rev 20236)
+++ gnunet/src/util/Makefile.am 2012-03-04 14:37:52 UTC (rev 20237)
@@ -37,6 +37,7 @@
gnunet-config-diff \
test_common_logging_dummy
+
gnunet_config_diff_SOURCES = \
gnunet-config-diff.c
gnunet_config_diff_LDADD = \
@@ -114,8 +115,10 @@
bin_PROGRAMS = \
gnunet-service-resolver \
- gnunet-resolver
+ gnunet-resolver \
+ gnunet-rsa
+
gnunet_service_resolver_SOURCES = \
gnunet-service-resolver.c
gnunet_service_resolver_LDADD = \
@@ -133,6 +136,15 @@
gnunet_resolver_DEPENDENCIES = \
libgnunetutil.la
+
+gnunet_rsa_SOURCES = \
+ gnunet-rsa.c
+gnunet_rsa_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(GN_LIBINTL)
+gnunet_resolver_DEPENDENCIES = \
+ libgnunetutil.la
+
plugin_LTLIBRARIES = \
libgnunet_plugin_test.la
Added: gnunet/src/util/gnunet-rsa.c
===================================================================
--- gnunet/src/util/gnunet-rsa.c (rev 0)
+++ gnunet/src/util/gnunet-rsa.c 2012-03-04 14:37:52 UTC (rev 20237)
@@ -0,0 +1,92 @@
+/*
+ This file is part of GNUnet.
+ (C) 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet 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, or (at your
+ option) any later version.
+
+ GNUnet 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 GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file util/gnunet-rsa.c
+ * @brief tool to manipulate RSA key files
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_rsa_service.h"
+
+
+/**
+ * Flag for reverse lookup.
+ */
+static int print;
+
+
+/**
+ * Main function that will be run by the scheduler.
+ *
+ * @param cls closure
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be
NULL!)
+ * @param cfg configuration
+ */
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ struct GNUNET_CRYPTO_RsaPrivateKey *pk;
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
+ char *s;
+
+ if (argc == 0)
+ {
+ fprintf (stderr, _("No hostkey file specified on command line\n"));
+ return;
+ }
+ pk = GNUNET_CRYPTO_rsa_key_create_from_file (argv[0]);
+ if (print)
+ {
+ GNUNET_CRYPTO_rsa_key_get_public (pk, &pub);
+ s = GNUNET_CRYPTO_rsa_public_key_to_string (&pub);
+ fprintf (stdout, "%s\n", s);
+ GNUNET_free (s);
+ }
+ GNUNET_CRYPTO_rsa_key_free (pk);
+}
+
+
+/**
+ * The main function to obtain statistics in GNUnet.
+ *
+ * @param argc number of arguments from the command line
+ * @param argv command line arguments
+ * @return 0 ok, 1 on error
+ */
+int
+main (int argc, char *const *argv)
+{
+ static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+ { 'p', "print", NULL,
+ gettext_noop ("print the public key in ASCII format"),
+ 0, &GNUNET_GETOPT_set_one, &print },
+ GNUNET_GETOPT_OPTION_END
+ };
+ return (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile",
+ gettext_noop ("Manipulate GNUnet private RSA key
files"),
+ options, &run, NULL)) ? 0 : 1;
+}
+
+/* end of gnunet-rsa.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20237 - in gnunet: doc/man src/util,
gnunet <=