@Test public void testDuplicateRegistrationOfSecurityProvider() { SslEngineFacadeFactory factory = new SslEngineFacadeFactory(); try { SslEngineFacadeFactory.registerBouncyCastleProvider(); } catch (Exception e) { fail("Exception thrown when re-registering BouncyCastle provider " + e.getMessage()); } }
static void registerBouncyCastleProvider() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance(); synchronized (Security.class) { if(Security.getProvider(bouncyCastleProvider.getName()) == null) { Security.addProvider(bouncyCastleProvider); } } }
SslEngineFacadeFactory { static void registerBouncyCastleProvider() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance(); synchronized (Security.class) { if(Security.getProvider(bouncyCastleProvider.getName()) == null) { Security.addProvider(bouncyCastleProvider); } } } }
SslEngineFacadeFactory { static void registerBouncyCastleProvider() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance(); synchronized (Security.class) { if(Security.getProvider(bouncyCastleProvider.getName()) == null) { Security.addProvider(bouncyCastleProvider); } } } SslEngineFacadeFactory(); }
SslEngineFacadeFactory { static void registerBouncyCastleProvider() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance(); synchronized (Security.class) { if(Security.getProvider(bouncyCastleProvider.getName()) == null) { Security.addProvider(bouncyCastleProvider); } } } SslEngineFacadeFactory(); ProtonSslEngine createProtonSslEngine(SslDomain domain, SslPeerDetails peerDetails); void resetCache(); }
SslEngineFacadeFactory { static void registerBouncyCastleProvider() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class<?> klass = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Provider bouncyCastleProvider = (Provider) klass.getConstructor().newInstance(); synchronized (Security.class) { if(Security.getProvider(bouncyCastleProvider.getName()) == null) { Security.addProvider(bouncyCastleProvider); } } } SslEngineFacadeFactory(); ProtonSslEngine createProtonSslEngine(SslDomain domain, SslPeerDetails peerDetails); void resetCache();  }