summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-26 10:16:48 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-26 10:16:48 +0200
commit83fcf4af33e216351f46646aa8c9a6b32bdfd44d (patch)
tree456c00bd8fb416447c905c3cb0e976db06c162cb
parente38d73c4a3d2b44ba3fbf3231ca08b7393f722aa (diff)
downloadgnutls-83fcf4af33e216351f46646aa8c9a6b32bdfd44d.tar.gz
p11tool: Warn when no --outfile has been specified on key generation
-rw-r--r--src/pkcs11.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pkcs11.c b/src/pkcs11.c
index 8e60120ab2..b83346f3d0 100644
--- a/src/pkcs11.c
+++ b/src/pkcs11.c
@@ -43,7 +43,7 @@
#define CHECK_LOGIN_FLAG(flag) \
if (flag == 0) \
fprintf(stderr, \
- "note: --login was not specified and it may be required for this operation.\n")
+ "warning: --login was not specified and it may be required for this operation.\n")
void
pkcs11_delete(FILE * outfile, const char *url, int batch,
@@ -503,6 +503,12 @@ pkcs11_generate(FILE * outfile, const char *url, gnutls_pk_algorithm_t pk,
FIX(url);
CHECK_LOGIN_FLAG(login_flags);
+ if (outfile == stderr || outfile == stdout) {
+ fprintf(stderr, "warning: no --outfile was specified and the generated public key will be printed on screen.\n");
+ fprintf(stderr, "note: in some tokens it is impossible to obtain the public key in any other way after generation.\n");
+ sleep(3);
+ }
+
if (private == 1)
flags |= GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE;
else if (private == 0)