schooner_101
schooner_101

Reputation: 319

Importing Certificate to cacerts giving file I/O exception on Mac OS Mojave

Hello I am trying to import a certificate into cacerts on Mac OSX Mojave 10.14.4. I am using OpenJDK if that makes any difference.

My cert file is .p12.

Here is the path I tried to take

keytool -import -alias nulogix -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -file/Users/user/Desktop/cert.p12

This gave me an key tool error

keytool error: java.io.FileNotFoundException: /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home/jre/lib/security/cacerts (No such file or directory)

What is the correct path?

Upvotes: 4

Views: 15821

Answers (1)

schooner_101
schooner_101

Reputation: 319

Figured it out.

Typing in

/usr/libexec/java_home

will give you the location of cacerts on your system.

Then you can either put that as part of your -keystore input or you can just simply do this

keytool -import -alias nulogix -keystore $(/usr/libexec/java_home)/lib/security/cacerts
  -file /Users/user/Desktop/cert.p12

Upvotes: 7

Related Questions