Skip to content

Instantly share code, notes, and snippets.

@yusuke
Created January 14, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusuke/47ddf134057874332366247dedaa29ce to your computer and use it in GitHub Desktop.
Save yusuke/47ddf134057874332366247dedaa29ce to your computer and use it in GitHub Desktop.
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
public class ClientCertificate {
public static void main(String[] args) throws IOException {
System.setProperty("javax.net.ssl.keyStore", "myClientCert.p12");
System.setProperty("javax.net.ssl.keyStorePassword", "mypassword");
final URLConnection urlConnection = new URL("https://bizstn.bk.mufg.jp/biz/yen/dfw/Login").openConnection();
try (InputStream is = urlConnection.getInputStream()) {
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int data;
while(-1 != (data = is.read())){
byteArrayOutputStream.write(data);
}
System.out.println(byteArrayOutputStream.toString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment