1 package org.bouncycastle.jcajce.util; 2 3 import java.security.Provider; 4 import java.security.Security; 5 6 import org.bouncycastle.jce.provider.BouncyCastleProvider; 7 8 /** 9 * A JCA/JCE helper that refers to the BC provider for all it's needs. 10 */ 11 public class BCJcaJceHelper 12 extends ProviderJcaJceHelper 13 { 14 private static volatile Provider bcProvider; 15 getBouncyCastleProvider()16 private static Provider getBouncyCastleProvider() 17 { 18 if (Security.getProvider("BC") != null) 19 { 20 return Security.getProvider("BC"); 21 } 22 else if (bcProvider != null) 23 { 24 return bcProvider; 25 } 26 else 27 { 28 bcProvider = new BouncyCastleProvider(); 29 30 return bcProvider; 31 } 32 } 33 BCJcaJceHelper()34 public BCJcaJceHelper() 35 { 36 super(getBouncyCastleProvider()); 37 } 38 } 39