import java.io.*;
import java.net.*;
import java.security.*;
import java.security.cert.*;
import java.util.*;
import javax.net.ssl.*;
public class HttpsTest {
// We would never hardcode this literal in a real system,
// this is only for this article.
private String url = "https://localhost/";
// Create an anonymous class to trust all certificates.
// This is bad style, you should create a separate class.
private X509TrustManager xtm = new X509TrustManager(
Java中请求HTTPS加密的源代码
最新推荐文章于 2024-08-31 16:44:28 发布