我正在尝试用java创建到fortigate防火墙的ssl vpn连接。类似于openvpn的东西。我试过用c语言阅读源代码,但没有多大帮助。在java中建立套接字连接不是问题。但是我如何向防火墙进行身份验证并创建vpn隧道呢?不幸的是,我没有在这里找到任何教程或在fortinet的描述。也许有人能帮我。
public static void main(String[] args) throws IOException {
String vpnHost = "fortigateVPNHost";
int vpnPort = 443;
String vpnUser = "vpnUser";
String vpnPassword = "vpnPassword";
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory
.createSocket(vpnHost, vpnPort);
InputStream in = sslsocket.getInputStream();
OutputStream out = sslsocket.getOutputStream();
while (in.available() > 0) {
System.out.print(in.read());
}
System.out.println("Secured connection performed successfully");
}
暂无答案!
目前还没有任何答案,快来回答吧!