Used only for non\-TLS static key encryption mode.
.\"*********************************************************
.TP
-.B \-\-genkey
+.B \-\-genkey file
(Standalone)
-Generate a random key to be used as a shared secret,
-for use with the
+Generate a random key to be used as a shared secret, for use with the
.B \-\-secret
-option. This file must be shared with the
-peer over a pre\-existing secure channel such as
-.BR scp (1)
-.
-.\"*********************************************************
-.TP
-.B \-\-secret file
-Write key to
-.B file.
+,
+.B \-\-tls-auth
+or
+.B \-\-tls-crypt
+options. Stores the key in
+.B file\fR.
+
+If using this for
+.B \-\-secret
+, this file must be shared with the peer over a pre\-existing secure channel
+such as
+.BR scp (1)\fR.
.\"*********************************************************
.SS TUN/TAP persistent tunnel config mode:
Available with Linux 2.4.7+. These options comprise a standalone mode
" to access TAP adapter.\n"
#endif /* ifdef _WIN32 */
"\n"
- "Generate a random key (only for non-TLS static key encryption mode):\n"
- "--genkey : Generate a random key to be used as a shared secret,\n"
- " for use with the --secret option.\n"
- "--secret file : Write key to file.\n"
+ "Generate a new key (for use with --secret, --tls-auth or --tls-crypt):\n"
+ "--genkey file : Generate a new random key and write to file.\n"
#ifdef ENABLE_FEATURE_TUN_PERSIST
"\n"
"Tun/tap config mode (available with linux 2.4+):\n"
}
options->shared_secret_file = p[1];
}
- else if (streq(p[0], "genkey") && !p[1])
+ else if (streq(p[0], "genkey") && !p[2])
{
VERIFY_PERMISSION(OPT_P_GENERAL);
options->genkey = true;
+ if (p[1])
+ {
+ options->shared_secret_file = p[1];
+ }
}
else if (streq(p[0], "auth") && p[1] && !p[2])
{