Why is TrustManagerFactory undefined? - (novice question)
Why are the following 2 error messages reported by javac :
URLAuth.java:22: cannot find symbol
symbol : class TrustManagerFactory
location: class URLAuth
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
^
URLAuth.java:22: cannot find symbol
symbol : variable TrustManagerFactory
location: class URLAuth
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
when compiling the following code:
import java.net.*;
import java.io.*;
import java.security.*;
/*
* This example illustrates using a URL to access resources
* on a secure site.
*/
publicclass URLAuth{
publicstaticvoid main(String[] args)throws Exception{
System.setProperty("javax.net.ssl.trustStore","C:\\jdk1.5.0_01\\jre\\lib\\security\\cacerts");
// System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
System.setProperty("javax.net.ssl.keyStore","d:\\projects\\java\\TheCert.p12");
System.setProperty("javax.net.ssl.keyStorePassword","ThePassword");
System.setProperty("javax.net.ssl.keyStoreType","pkcs12");
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509","SunJSSE");
tmf.init(java.security.KeyStore.getInstance("PKCS12"));
URL testhttps =new URL("https://www.test.agency.gov/testhttps/");
BufferedReader in =new BufferedReader(new InputStreamReader(testhttps.openStream()));
String inputLine;
while ((inputLine = in.readLine()) !=null)
System.out.println(inputLine);
in.close();
}
}

