Tomcat Server/Client Self-Signed SSL Certificate

后端 未结 4 2151
死守一世寂寞
死守一世寂寞 2020-11-28 01:46

I have an Apache Tomcat 6.x server running with a self-signed SSL certificate. I want the client to present their own certificate to the server so I can authenticate them b

4条回答
  •  盖世英雄少女心
    2020-11-28 02:40

    The previous answers are useful to me, but don't have a shell tool version. So I wrote one.

    key_gen.sh:

    #! /bin/bash
    # a key generator for https,
    
    basename=server
    key_algorithm=RSA
    password_key=123456
    password_store=123456
    country=US
    
    # clean - pre
    rm "${basename}.jks"
    
    # generate server side
    keytool -genkeypair -alias "${basename}cert" -keyalg $key_algorithm -dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=${country}" -keypass $password_key -keystore "${basename}.jks" -storepass $password_store
    

    For tomcat8, could add following config to server.xml:

        
    

提交回复
热议问题