Add Self Signed Certificate without promting Yes/No from User

60,893

The option -noprompt doesn't prompt the input Y/N from a user and assumes yes.

More details can found by running command keytool -importcert -help on terminal.

Share:
60,893

Related videos on Youtube

Arun Kumar
Author by

Arun Kumar

Experienced Team Leader / Senior Software Developer with a demonstrated history of working in domains like Banking & Financial services, Healthcare and Sports information industry. Skilled in Java/J2EE, Spring Boot , Microservices, Hibernate, Spring Mvc , Web Services(REST, SOAP), Apache Camel , CI/CD,Jenkins, Test Driven Development (TDD) Junit, Behavior driven development (BDD) Cucumber and SQL.

Updated on March 12, 2020

Comments

  • Arun Kumar
    Arun Kumar about 4 years

    Using some batch file, I want to add the untrusted self signed certificate within Java Keystore.

    Command is

    %JAVA_HOME%/bin/keytool -import -v -trustcacerts -alias server-alias
    -file server.cer -keystore cacerts.jks -keypass changeit -storepass changeit
    

    After running above command, the screen promts for Trust of certificate using Y/N.

    Trust this certificate? [no]:
    

    But I don't want to provide Y/N here.

    Is there a way to complete the import using a single command or some additional import switch if any?

    • ticktockhouse
      ticktockhouse almost 7 years
      ^^ Personally, I would consider a succinct answer on here preferable to wading through documentation. Perhaps the original questioner read the docs and missed it..
  • m1m1k
    m1m1k about 4 years
    si, gracias. No es siempre claro quando debemos usar lengua local.
  • user1708042
    user1708042 about 2 years
    well correct, but the help is not very informative, it tells only "-noprompt: do not prompt" not telling what to prompt for. If the password is omitted it should fail, not prompt for password.