How do I initialize a TrustManagerFactory with multiple sources of trust?

后端 未结 6 1414
伪装坚强ぢ
伪装坚强ぢ 2020-12-25 15:42

My application has a personal keystore containing trusted self-signed certificates for use in the local network - say mykeystore.jks. I wish to be able to conne

6条回答
  •  無奈伤痛
    2020-12-25 16:10

    For Android developers, this can be much easier. In summary, you can add a xml res file to config your custom certs.

    Step 1: open your manifest xml add an attribute.

    
        
            ...
        
    
    

    Step 2: Add network_security_config.xml to res/xml, config certs as you want.

    
    
        
            
                
                
            
        
    
    

    Note: this xml can support many other usage, and this solution only works on api24+.

    Official reference: here

提交回复
热议问题