Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Java KeyStore generates keystore files with commands

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1. Generate keyStore file

Execute the following command from the command line:

Shell Code Collection Code

Keytool-genkey-validity 36000-alias www.zlex.org-keyalg RSA-keystore d:\ zlex.keystore

Among them

-genkey indicates generation key

-validity specifies the validity period of the certificate. Here it is 36000 days.

-alias specifies an alias. This is www.zlex.org.

-keyalg specifies the algorithm. This is RSA.

-keystore specifies the storage location, here is d:\ zlex.keystore

The password I use here is 123456.

Console output:

Console Code Collection Code

Enter the keystore password: enter the new password again: what is your first and last name? [Unknown]: www.zlex.org what is the name of your organizational unit? [Unknown]: zlex what is the name of your organization? [Unknown]: zlex what is the name of your city or region? [Unknown]: BJ what is the name of your state or province? [Unknown]: what is the two-letter country code of BJ [Unknown]: is CN CN=www.zlex.org, OU=zlex, O=zlex, L=BJ, ST=BJ, C=CN correct? [no]: enter the master password entered by Y (press enter if the password is the same as keystore): enter the new password again:

At this point, a zlex.keystore file will be generated under disk D.

two。 Generate a self-signed certificate

It is not enough to have keyStore files, but also need certificate files. Certificates are the public key certificates that are provided directly to the outside world.

Export Certificate:

Shell Code Collection Code

Keytool-export-keystore d:\ zlex.keystore-alias www.zlex.org-file d:\ zlex.cer-rfc

Among them

-export is specified as an export operation

-keystore specifies the keystore file

-alias specifies the alias in the exported keystore file

-file points to the export path

-rfc output in text format, that is, output in BASE64 encoding

The password here is 123456.

Console output:

Console Code Collection Code

Enter the keystore password: authentication saved in the file

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report