-ext san=dns:localhost: includes an X.509 extension for Subject Alternate Name (SAN) – a SAN is required so the certificate will be trusted by browsers on localhost.-validity 365: specifies the expiration date will be 365 days from now. -keystore local-ssl.p12: species name of the file that stores the key pair is local-ssl.p12.-storetype PKCS12: specifies the file format to store the key pair is PKCS12.-keysize 2048: specifies the size of the key is 2048 bit.-keyalg RSA: specifies the algorithm to be used is RSA.-alias local_ssl: specifies the alias of the keypair is local_ssl, which uniquely identifies it.Let me explain the arguments for the keytool program: Keytool -genkeypair -alias local_ssl -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore local-ssl.p12 –validity 365 -ext san=dns:localhostThis command will generate a key pair (public key and private key) using RSA cryptography algorithm. For development on localhost, you can create a self-signed certificate which is then installed to be trusted by your web browsers.Open a new command prompt window, and type the following command: Then clients will be able to establish a secure connection to your application. Generate Self-Signed Certificate using Java keytoolThe SSL protocol requires a server provide a digital certificate which is trusted by an authority. In this Spring Boot tutorial, I’d be happy to share with you about HTTPS configuration for a Spring Boot application, for local development purpose, with a self-signed certificate.To follow this guide, you must have JDK ( Java Development Kit) installed on your computer so you can use its keytool for creating SSL certificate, and I suppose that you’re developing a Spring Boot project. Secure web connection is required and becomes standard today.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |