HTTPS-证书

问题描述:

enter image description hereHTTPS-证书

我已创建使用以下命令

密钥工具-genkey -keyalg RSA -alias自署名-keystore keystore.jks -storepass密码-validity 360 -keysize 2048

密钥后我已用骆驼端点

公共类HTTPSCamelEndPoint {

public Endpoint httpsConfig(CamelContext context) throws Exception 
{ 
    KeyStoreParameters ksp = new KeyStoreParameters(); 
    ksp.setResource("C:\\Users\\sithamparamd\\keystore.jks"); 
    ksp.setPassword("123456"); 

    KeyManagersParameters kmp = new KeyManagersParameters(); 
    kmp.setKeyStore(ksp); 
    kmp.setKeyPassword("password"); 

    SSLContextParameters scp = new SSLContextParameters(); 
    scp.setKeyManagers(kmp); 

    JettyHttpComponent jettyComponent =context.getComponent("jetty", JettyHttpComponent.class); 

    jettyComponent.setSslContextParameters(scp); 

    //jettyComponent.createEndpoint("jetty:https://192.168.16.98:4443/myservice"); 


    return jettyComponent.createEndpoint("jetty:https://192.168.16.98:4443/myservice"); 
} 


public static void main(String[] args) throws Exception { 

    HTTPSCamelEndPoint httpsCamelEndPoint= new HTTPSCamelEndPoint(); 
    CamelContext camelContext=httpsCamelEndPoint.getContext(); 
    final Endpoint endpoint=httpsCamelEndPoint.httpsConfig(camelContext); 
    System.out.println(endpoint); 
    camelContext.addRoutes(new RouteBuilder() { 

     @Override 
     public void configure() throws Exception { 
      // TODO Auto-generated method stub 
      from(endpoint).process(new Processor() { 

       public void process(Exchange arg0) throws Exception { 
        // TODO Auto-generated method stub 
        System.out.println("GOT THE MSG !!!!"); 
       } 
      }); 
     } 
    }); 
    camelContext.start(); 


} 

public CamelContext getContext() 
{ 
    CamelContext camelContext=new DefaultCamelContext(); 
    JettyHttpComponent httpComponent=new JettyHttpComponent(); 
    camelContext.addComponent("jetty", httpComponent); 
    return camelContext; 
} 
01暴露HTTPS引黄

}

但是当我通过URL访问它显示为无效证书。请告诉我这个的原因,并给出解决办法来解决这个问题。

这是一个警告,因为您使用的是您生成的自签名证书不受浏览器信任。

当您使用CA证书What are CA Certificates

您可以通过将证书添加到受信任的根CA存储Example

+0

谢谢你了@Karikalan – 2014-09-29 11:07:20