1
votes

I am pretty new to Mac OS, or Bouncy Castle/Encryption at all, hence I am following the guide here and downloaded the PGP-JDK1.5-1.7 version of Bouncy Castle jar.

I issued the below command to see where Java is installed:

bash-3.2$ sudo find / -name "*.security"
Password: 
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib/security/java.security
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/java.security
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security
/Users/fn.lastname/code/vault/security_java_jars_Aug11/java.security

I then added security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/java.security and also added the bouncy castle jar to /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext

The changed java.security content is as below:

security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=sun.security.ec.SunEC
security.provider.4=com.sun.net.ssl.internal.ssl.Provider
security.provider.5=com.sun.crypto.provider.SunJCE
security.provider.6=sun.security.jgss.SunProvider
security.provider.7=com.sun.security.sasl.Provider
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.9=sun.security.smartcardio.SunPCSC
security.provider.10=apple.security.AppleProvider
security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider

I went to eclipse(STS) and executed the program here to see if the Bouncy Castle is successfully installed. It just returned "BC provider not installed".

I tried the same on the location at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security

Again ran the program with out any success. I also tried googling other sites, alas much help. Seems to have good support for Windows, but for mac I need help even to find if I am at the right Java version.

Could any of you please let me know where I could sense issues? Thanks in advance.

2
Thanks @Rachael. I noted that I had issues with inappropriate jar file. I had set bcprov-jdk15on-151.jar, bcprov-ext-jdk15on-151.jar, bcpg-jdk15on-151.jar into classpath but did removed the one from ext location. I did retain the changes to java.security. I was not able to try out with each of the jar files into ext one-by-one to see which was important, but to me bcprov-jdk15on-151.jar seemed to be the most important.oneworld
Here's my answer to a similar question.Rahil

2 Answers

0
votes

Bouncy Castle is a set of libraries. There is the core library with the provider, called jcprov-*. To use (a subset of) the Bouncy Castle core cryptography you need to install the provider using the signed .jar. This .jar is the only one containing the provider.

The bcpkix (ANSI X standards PKI), bcpg (PGP) and bcmail (SMIME/CMS/PKCS#7) libraries are standalone libraries that provide specific functionality on top of JCE. You may not even have to install the provider for a lot of the functionality. They do not contain the provider themselves.

So you can use the .jar directly, and if required, download the .jar containing the provider and put it in your classpath...

-1
votes

I remember having to run a key tool command...

Found it here:

How Do You Configure BouncyCastle For Mac OSX Maverick