I'm trying to load the trusted certificates on a OS X/Java 7 system. According to Java's Class KeyStore, there is a KeyStore.TrustedCertificateEntry
type.
The following code:
KeyStore ks = KeyStore.getInstance(KeyStore.TrustedCertificateEntry);
Produces the following error:
HttpsCiphers.java:34: error: cannot find symbol
KeyStore ks = KeyStore.getInstance(KeyStore.TrustedCertificateEntry);
^
symbol: variable TrustedCertificateEntry
location: class KeyStore
I'm importing both KeyStore
and TrustedCertificateEntry
.
How does one utilize TrustedCertificateEntry
or load the trusted certificate store?
$ java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: OS X 10.8.5 (12F45)
Kernel Version: Darwin 12.5.0
...
KeyStore.TrustedCertificateEntry
was introduced in 1.5. You must be using an earlier Java, or maybe you have your own class called KeyStore.
In any case the code is nonsense. It should be KeyStore.getInstance(KeyStore.getDefaultType())
, or a String
argument naming an explicit keystore type.