简体   繁体   中英

SSL with Spring and Jetty

I am tryign to implement SSL to my Spring App. I generated SSL key by keytool and put it to my application.properties. During compilation i get message:

Jetty started on port(s) 8443 (ssl, http/1.1)

but when i try to send rest query from my Angular 2 i got response: "Aborted". Also from terminal crud query i get :

Trying ::1...
Connected to localhost (::1) port 8443 (#0)
found 173 certificates in /etc/ssl/certs/ca-certificates.crt
found 694 certificates in /etc/ssl/certs
ALPN, offering http/1.1
gnutls_handshake() failed: Handshake failed
Closing connection 0
curl: (35) gnutls_handshake() failed: Handshake failed

Any idea? Thank you in advance.

Try to create your self signed certificate with following

keytool -genkeypair -keystore keystore.jks -storepass PASSWORD -keypass PASSWORD -alias jetty -keyalg RSA -keysize 2048 -validity 5000 -dname "CN=HOSTNAME, OU=Example, O=Example, L=Unspecified, ST=Unspecified, C=US" -ext "SAN=DNS:HOSTNAME,IP:IPADDRESS" -ext "BC=ca:true"

Change PASSWORD, HOSTNAME and IPADDRESS where needed.

Check if Angular 2 connecting via HTTP/1.1 protocol, also verify localhost:8443 with curl, curl performs SSL certificate verification by default, if there's any error, please write it here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM