Github user tellison commented on a diff in the pull request:

    https://github.com/apache/incubator-pirk/pull/111#discussion_r84029515
  
    --- Diff: 
src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java ---
    @@ -64,9 +67,33 @@
       // Paillier encryption functionality.
       private final Paillier paillier;
     
    +  private static final SecureRandom secureRandom;
    +
    +  static
    +  {
    +    try
    +    {
    +      String alg = 
SystemConfiguration.getProperty("pallier.secureRandom.algorithm");
    +      if (alg == null)
    +      {
    +        secureRandom = new SecureRandom();
    +      }
    +      else
    +      {
    +        String provider = 
SystemConfiguration.getProperty("pallier.secureRandom.provider");
    +        secureRandom = (provider == null) ? SecureRandom.getInstance(alg) 
: SecureRandom.getInstance(alg, provider);
    +      }
    +      logger.info("Using secure random from " + 
secureRandom.getProvider().getName() + ":" + secureRandom.getAlgorithm());
    +    } catch (GeneralSecurityException e)
    +    {
    +      logger.error("Unable to instantiate a SecureRandom object with the 
requested algorithm.", e);
    +      throw new RuntimeException("Unable to instantiate a SecureRandom 
object with the requested algorithm.", e);
    +    }
    +  }
    +
    --- End diff --
    
    How about we move this logic out to o.a.pirk.utils rather than copying it 
in EncryptQuery and Paillier?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to