GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SSL-By-Example/SSLClientExample.java at master · anishnath/SSL-By-Example

Expand file tree

/

SSLClientExample.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
62 lines (48 loc) · 1.58 KB
/

SSLClientExample.java

Copy path

File metadata and controls

62 lines (48 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package ssl;
//ani
import java.io.OutputStream;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
/**
Visit the channel http://youtube.com/zarigatongy
*/
//Writing SSL Client in Java
public class SSLClientExample {
/*
* Where do we find the trustores ?
*/
final static String pathToStores = "/tmp/ssl/client"; // The Directory
final static String trustStoreFile = "keystore1.jks"; //The FileName
final static String passwd = "123456"; //The Password
/*
* Where is the Server and the Port
*/
final static String theServerName = "localhost";
final static int theServerPort = 12345;
/*
* Turn on SSL debugging?
*/
static boolean debug = false;
/*
* Define the client side of the test.
*/
void doClientSide() throws Exception {
SSLSocketFactory sslsf = (SSLSocketFactory) SSLSocketFactory
.getDefault();
SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(theServerName,
12345);
OutputStream sslOS = sslSocket.getOutputStream();
sslOS.write("Hello SSL Server".getBytes()); // Write to the Server
sslOS.flush();
sslSocket.close();
}
public static void main(String[] args) throws Exception {
String trustFilename = pathToStores + "/"+ trustStoreFile;
System.setProperty("javax.net.ssl.trustStore", trustFilename);
System.setProperty("javax.net.ssl.trustStorePassword", passwd);
if (debug)
System.setProperty("javax.net.debug", "all");
// java -Djavax.net.ssl.trustStore=/tmp/trustFilename -Djavax.net.ssl.trustStorePassword=123456 SSLClientExample
new SSLClientExample().doClientSide();
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.