title: Installing Bouncy Castle on Mac
body: <p><em>I am pretty new to Mac OS, or Bouncy Castle/Encryption at all</em>, hence I am following the guide <a href="http://www.itcsolutions.eu/2011/08/22/how-to-use-bouncy-castle-cryptographic-api-in-netbeans-or-eclipse-for-java-jse-projects/" rel="nofollow">here</a> and downloaded the <a href="http://www.bouncycastle.org/download/bcpg-jdk15on-151.jar" rel="nofollow">PGP-JDK1.5-1.7</a> version of <a href="http://www.bouncycastle.org/latest_releases.html" rel="nofollow">Bouncy Castle jar</a>.</p>
  
  <p>I issued the below command to see where Java is installed:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I then added <strong>security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider</strong> 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</p>
  
  <p>The changed java.security content is as below:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I went to eclipse(STS) and executed the <a href="https://github.com/Languafe/Beginning-Cryptography-with-Java/blob/master/src/chapter1/SimpleProviderTest.java" rel="nofollow">program here</a> to see if the Bouncy Castle is successfully installed. It just returned "BC provider not installed".</p>
  
  <p>I tried the same on the location at <strong>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security</strong></p>
  
  <p>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.</p>
  
  <p>Could any of you please let me know where I could sense issues? Thanks in advance. </p>