X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcapputil.c;h=a79ee597549e91a21c7ae838b3cb6335a64e8202;hb=c257b555225193e54d85daf541d29578b3c93882;hp=1210b0a9a04b346037ee734c366ba3083a10846f;hpb=a6305f1463c2abd488e2ef88920a9283ff562c4a;p=silc.git diff --git a/lib/silcutil/silcapputil.c b/lib/silcutil/silcapputil.c index 1210b0a9..a79ee597 100644 --- a/lib/silcutil/silcapputil.c +++ b/lib/silcutil/silcapputil.c @@ -175,11 +175,25 @@ New pair of keys will be created. Please, answer to following questions.\n\ } if (!pass) { - memset(line, 0, sizeof(line)); - snprintf(line, sizeof(line), "Private key passphrase: "); - pass = silc_get_input(line, TRUE); - if (!pass) - pass = strdup(""); + while (TRUE) { + char *pass2 = NULL; + pass = silc_get_input("Private key passphrase: ", TRUE); + if (!pass) { + pass = strdup(""); + break; + } else { + bool match; + printf("\n"); + pass2 = silc_get_input("Retype private key passphrase: ", TRUE); + if (!pass2) + pass2 = strdup(""); + match = !strcmp(pass, pass2); + silc_free(pass2); + if (match) + break; + fprintf(stderr, "\nPassphrases do not match\n\n"); + } + } } /* Generate keys */ @@ -383,10 +397,23 @@ bool silc_change_private_key_passphrase(const char *prv_filename, pass = new_passphrase ? strdup(new_passphrase) : NULL; if (!pass) { + char *pass2 = NULL; fprintf(stdout, "\n"); pass = silc_get_input("New passphrase: ", TRUE); - if (!pass) + if (!pass) { pass = strdup(""); + } else { + while (TRUE) { + printf("\n"); + pass2 = silc_get_input("Retype new passphrase: ", TRUE); + if (!pass2) + pass2 = strdup(""); + if (!strcmp(pass, pass2)) + break; + fprintf(stderr, "\nPassphrases do not match"); + } + silc_free(pass2); + } } silc_pkcs_save_private_key((char *)prv_filename, private_key,