gpt4 book ai didi

android - 标题 : self signing server certificate

转载 作者:行者123 更新时间:2023-11-29 02:13:33 25 4
gpt4 key购买 nike

我需要在我的 android 应用程序中使用“https:\”post web 服务,但我收到类似“不受信任的服务器证书”的错误。

有什么解决办法吗???

以下是我的代码。

public static String callservice() {



String response = "";



HashMap<String, String> valuemap = new HashMap<String, String>();



valuemap.put("name", "nandlal");

valuemap.put("date_of_birth", "12-01-1986");

valuemap.put("gender", "women");

valuemap.put("user_name", "nandlal80.840947");

valuemap.put("confirm_password", "qqqq");

valuemap.put("email", nandlal@dignizant.com);

valuemap.put("confirm_email", "nandlal@dignizant.com");

valuemap.put("co_address", "surat");

valuemap.put("address_information", "surat");

valuemap.put("postcode", "45454");

valuemap.put("country", "india");

valuemap.put("town", "surat");

valuemap.put("doorcode", "800");

valuemap.put("language", "English");

valuemap.put("telephone_home", "840947");

valuemap.put("telephone_work", "866");

valuemap.put("cellphone", "56656");

valuemap.put("skype_name", "myskype");



HttpRequest httpRequest = new HttpRequest();



try {



response = httpRequest

.doPost("https://www.buzzador.com/apps/present_software/webservice/index.php?op=Registration1",

valuemap);



System.out.println("RESPONCE :" + response);



} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("ERROR :" + e.toString());

response = e.toString();

}

return response;



}

最佳答案

由于证书是自签名的,因此不受 android 默认信任管理器的信任。您可以遵循 Bob Lee 教程 Android: Trusting SSL certificates 旨在信任您在应用程序中的服务器证书:

关于android - 标题 : self signing server certificate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5828278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com