keytool error Keystore was tampered with, or password was incorrect, generate a Self Signed JKS Certificate using keytool
What is a TrustStore and KeyStore?
TrustStore is used to store the public certificates into the KeyStore.
Example: google.com, Load balancer certificates
KeyStore is used to store the private certificates of client or the server.
Example: Certificate related to private information will be inside the KeyStore.
Create a Self Signed Certificate
Press windows+r and type cmd or open command prompt and type the below commands to create a certificate.
Reuse the same password i.e., “changeit” in further password prompts.
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass changeit -validity 360 -keysize 2048
C:\Users\cldee>keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass changeit -validity 360 -keysize 2048 What is your first and last name? [Unknown]: CL Deepak What is the name of your organizational unit? [Unknown]: IT What is the name of your organization? [Unknown]: Behind Java What is the name of your City or Locality? [Unknown]: Nellore What is the name of your State or Province? [Unknown]: AP What is the two-letter country code for this unit? [Unknown]: IN Is CN=CL Deepak, OU=IT, O=Behind Java, L=Nellore, ST=AP, C=IN correct? [no]: yes Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 360 days for: CN=CL Deepak, OU=IT, O=Behind Java, L=Nellore, ST=AP, C=IN
Now JKS is generated under C:\Users\cldee in windows and in MAX it is under /Users/apple.