@Test public void testSetupDHParams( ) throws Exception { BCSslSetup.initBouncyCastleDHParamsInternal(); }
@SuppressWarnings( "unchecked" ) static void initBouncyCastleDHParamsInternal( ) throws NoSuchFieldException, IllegalAccessException { final Class<?> DH = KeyPairGeneratorSpi.class; final Field paramsField = DH.getDeclaredField( "params" ); paramsField.setAccessible( true ); final Hashtable<Integer,DHKeyGenerationParameters> params = (Hashtable<Integer,DHKeyGenerationParameters>) paramsField.get( null ); if ( params.isEmpty() ) { final SecureRandom random = new SecureRandom(); for ( final DHParameterSpec parameterSpec : parameterSpecs ) { params.put( parameterSpec.getL( ), new DHKeyGenerationParameters( random, new DHParameters( parameterSpec.getP( ), parameterSpec.getG( ), null, 0 ) ) ); } } }
BCSslSetup { @SuppressWarnings( "unchecked" ) static void initBouncyCastleDHParamsInternal( ) throws NoSuchFieldException, IllegalAccessException { final Class<?> DH = KeyPairGeneratorSpi.class; final Field paramsField = DH.getDeclaredField( "params" ); paramsField.setAccessible( true ); final Hashtable<Integer,DHKeyGenerationParameters> params = (Hashtable<Integer,DHKeyGenerationParameters>) paramsField.get( null ); if ( params.isEmpty() ) { final SecureRandom random = new SecureRandom(); for ( final DHParameterSpec parameterSpec : parameterSpecs ) { params.put( parameterSpec.getL( ), new DHKeyGenerationParameters( random, new DHParameters( parameterSpec.getP( ), parameterSpec.getG( ), null, 0 ) ) ); } } } }
BCSslSetup { @SuppressWarnings( "unchecked" ) static void initBouncyCastleDHParamsInternal( ) throws NoSuchFieldException, IllegalAccessException { final Class<?> DH = KeyPairGeneratorSpi.class; final Field paramsField = DH.getDeclaredField( "params" ); paramsField.setAccessible( true ); final Hashtable<Integer,DHKeyGenerationParameters> params = (Hashtable<Integer,DHKeyGenerationParameters>) paramsField.get( null ); if ( params.isEmpty() ) { final SecureRandom random = new SecureRandom(); for ( final DHParameterSpec parameterSpec : parameterSpecs ) { params.put( parameterSpec.getL( ), new DHKeyGenerationParameters( random, new DHParameters( parameterSpec.getP( ), parameterSpec.getG( ), null, 0 ) ) ); } } }  }
BCSslSetup { @SuppressWarnings( "unchecked" ) static void initBouncyCastleDHParamsInternal( ) throws NoSuchFieldException, IllegalAccessException { final Class<?> DH = KeyPairGeneratorSpi.class; final Field paramsField = DH.getDeclaredField( "params" ); paramsField.setAccessible( true ); final Hashtable<Integer,DHKeyGenerationParameters> params = (Hashtable<Integer,DHKeyGenerationParameters>) paramsField.get( null ); if ( params.isEmpty() ) { final SecureRandom random = new SecureRandom(); for ( final DHParameterSpec parameterSpec : parameterSpecs ) { params.put( parameterSpec.getL( ), new DHKeyGenerationParameters( random, new DHParameters( parameterSpec.getP( ), parameterSpec.getG( ), null, 0 ) ) ); } } }   }
BCSslSetup { @SuppressWarnings( "unchecked" ) static void initBouncyCastleDHParamsInternal( ) throws NoSuchFieldException, IllegalAccessException { final Class<?> DH = KeyPairGeneratorSpi.class; final Field paramsField = DH.getDeclaredField( "params" ); paramsField.setAccessible( true ); final Hashtable<Integer,DHKeyGenerationParameters> params = (Hashtable<Integer,DHKeyGenerationParameters>) paramsField.get( null ); if ( params.isEmpty() ) { final SecureRandom random = new SecureRandom(); for ( final DHParameterSpec parameterSpec : parameterSpecs ) { params.put( parameterSpec.getL( ), new DHKeyGenerationParameters( random, new DHParameters( parameterSpec.getP( ), parameterSpec.getG( ), null, 0 ) ) ); } } }    }