client = new FTPSClient(implictSSL)
KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509")
kmf.init(KeyStore.getInstance("BKS"), "wshr.ut".toCharArray())
client.setTrustManager(new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() { return null}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { }
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { }
})
client.setKeyManager(kmf.getKeyManagers()[0])
client.setNeedClientAuth(false)
client.setUseClientMode(false)
在Linux服务器上开个FTP吧,然后Java通过FTP去访问。这样比较简单。
通过ssh也可以,找个Java的ssh Jar包
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)