[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user asfgit closed the pull request at: https://github.com/apache/incubator-pirk/pull/81 --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user tellison commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76517695 --- Diff: src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java --- @@ -163,8 +144,8 @@ public void encrypt(int numThreads) throws InterruptedException, PIRException query.generateExpTable(); } -// Set the Querier object -querier = new Querier(selectors, paillier, query, embedSelectorMap); +// Answer the Querier object. --- End diff -- Sure, I do tend to get creative when it is impl comments, as opposed to the javadoc :-) --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user tellison commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76517506 --- Diff: src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java --- @@ -56,103 +56,84 @@ { private static final Logger logger = LoggerFactory.getLogger(EncryptQuery.class); - private final QueryInfo queryInfo; // contains basic query information and functionality + // Contains basic query information. + private final QueryInfo queryInfo; - private Query query = null; // contains the query vectors + // Selectors for this query. + private final List selectors; - private Querier querier = null; // contains the query vectors and encryption object + // Paillier encryption functionality. + private final Paillier paillier; - private final Paillier paillier; // Paillier encryption functionality - - private List selectors = null; // selectors for the query - - // Map to check the embedded selectors in the results for false positives; - // if the selector is a fixed size < 32 bits, it is included as is - // if the selector is of variable lengths - private HashMapembedSelectorMap = null; - - public EncryptQuery(QueryInfo queryInfoInput, List selectorsInput, Paillier paillierInput) - { -queryInfo = queryInfoInput; - -selectors = selectorsInput; - -paillier = paillierInput; - -embedSelectorMap = new HashMap<>(); - } - - public Paillier getPaillier() - { -return paillier; - } - - public QueryInfo getQueryInfo() - { -return queryInfo; - } - - public Query getQuery() - { -return query; - } - - public Querier getQuerier() - { -return querier; - } - - public List getSelectors() - { -return selectors; - } - - public HashMap getEmbedSelectorMap() + /** + * Constructs a query encryptor using the given query information, selectors, and Paillier cryptosystem. + * + * @param queryInfo + * Fundamental information about the query. + * @param selectors + * the list of selectors for this query. + * @param paillier + * the Paillier cryptosystem to use. + */ + public EncryptQuery(QueryInfo queryInfo, List selectors, Paillier paillier) { -return embedSelectorMap; +this.queryInfo = queryInfo; +this.selectors = selectors; +this.paillier = paillier; } /** - * Encrypt, building the Query object, calculating and setting the query vectors. + * Encrypts the query described by the query information using Paillier encryption. + * + * The encryption builds a Querier object, calculating and setting the query vectors. * * Uses the system configured number of threads to conduct the encryption, or a single thread if the configuration has not been set. * * @throws InterruptedException - * if the task was interrupted during encryption. + * If the task was interrupted during encryption. * @throws PIRException + * If a problem occurs performing the encryption. + * @return The querier containing the query, and all information required to perform decryption. */ - public void encrypt() throws InterruptedException, PIRException + public Querier encrypt() throws InterruptedException, PIRException { int numThreads = SystemConfiguration.getIntProperty("numThreads", 1); -encrypt(numThreads); +return encrypt(numThreads); } /** - * Encrypt, building the Query object, calculating and setting the query vectors - * - * If we have hash collisions over our selector set, we will append integers to the key starting with 0 until we no longer have collisions. - * - * For encrypted query vector E = : + * Encrypts the query described by the query information using Paillier encryption using the given number of threads. * - * E_i = 2^{j*dataPartitionBitSize} if i = H_k(selector_j) 0 otherwise --- End diff -- Sure! Any thoughts on how we can get this to render a bit better for the reader? I removed it because it seems like an implementation detail rather than an API usage / spec description; and the markup [is not rendered well in javadoc](http://pirk.incubator.apache.org/javadocs/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.html#encrypt(int)). Putting it back now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user ellisonanne commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76517354 --- Diff: src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java --- @@ -200,31 +181,29 @@ public void encrypt(int numThreads) throws InterruptedException, PIRException return selectorQueryVecMapping; } - private void populateEmbeddedSelectorMap() + private MapcomputeEmbeddedSelectorMap() throws PIRException { QuerySchema qSchema = QuerySchemaRegistry.get(queryInfo.getQueryType()); +String selectorName = qSchema.getSelectorName(); DataSchema dSchema = DataSchemaRegistry.get(qSchema.getDataSchemaName()); -String type = dSchema.getElementType(qSchema.getSelectorName()); +String type = dSchema.getElementType(selectorName); + +Map embedSelectorMap = new HashMap<>(selectors.size()); + int sNum = 0; for (String selector : selectors) { - String embeddedSelector = null; - try - { -embeddedSelector = QueryUtils.getEmbeddedSelector(selector, type, dSchema.getPartitionerForElement(qSchema.getSelectorName())); - } catch (Exception e) - { -logger.info("Caught exception for selector = " + selector); -e.printStackTrace(); -// TODO: Check: should continue? - } - - embedSelectorMap.put(sNum, embeddedSelector); - ++sNum; + String embeddedSelector = QueryUtils.getEmbeddedSelector(selector, type, dSchema.getPartitionerForElement(selectorName)); + embedSelectorMap.put(sNum++, embeddedSelector); --- End diff -- Correct, but readability? ;) --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user ellisonanne commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76517343 --- Diff: src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java --- @@ -163,8 +144,8 @@ public void encrypt(int numThreads) throws InterruptedException, PIRException query.generateExpTable(); } -// Set the Querier object -querier = new Querier(selectors, paillier, query, embedSelectorMap); +// Answer the Querier object. --- End diff -- Should be 'Return' the Querier object - or 'Set and Return'... --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user ellisonanne commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76517300 --- Diff: src/main/java/org/apache/pirk/querier/wideskies/encrypt/EncryptQuery.java --- @@ -56,103 +56,84 @@ { private static final Logger logger = LoggerFactory.getLogger(EncryptQuery.class); - private final QueryInfo queryInfo; // contains basic query information and functionality + // Contains basic query information. + private final QueryInfo queryInfo; - private Query query = null; // contains the query vectors + // Selectors for this query. + private final List selectors; - private Querier querier = null; // contains the query vectors and encryption object + // Paillier encryption functionality. + private final Paillier paillier; - private final Paillier paillier; // Paillier encryption functionality - - private List selectors = null; // selectors for the query - - // Map to check the embedded selectors in the results for false positives; - // if the selector is a fixed size < 32 bits, it is included as is - // if the selector is of variable lengths - private HashMapembedSelectorMap = null; - - public EncryptQuery(QueryInfo queryInfoInput, List selectorsInput, Paillier paillierInput) - { -queryInfo = queryInfoInput; - -selectors = selectorsInput; - -paillier = paillierInput; - -embedSelectorMap = new HashMap<>(); - } - - public Paillier getPaillier() - { -return paillier; - } - - public QueryInfo getQueryInfo() - { -return queryInfo; - } - - public Query getQuery() - { -return query; - } - - public Querier getQuerier() - { -return querier; - } - - public List getSelectors() - { -return selectors; - } - - public HashMap getEmbedSelectorMap() + /** + * Constructs a query encryptor using the given query information, selectors, and Paillier cryptosystem. + * + * @param queryInfo + * Fundamental information about the query. + * @param selectors + * the list of selectors for this query. + * @param paillier + * the Paillier cryptosystem to use. + */ + public EncryptQuery(QueryInfo queryInfo, List selectors, Paillier paillier) { -return embedSelectorMap; +this.queryInfo = queryInfo; +this.selectors = selectors; +this.paillier = paillier; } /** - * Encrypt, building the Query object, calculating and setting the query vectors. + * Encrypts the query described by the query information using Paillier encryption. + * + * The encryption builds a Querier object, calculating and setting the query vectors. * * Uses the system configured number of threads to conduct the encryption, or a single thread if the configuration has not been set. * * @throws InterruptedException - * if the task was interrupted during encryption. + * If the task was interrupted during encryption. * @throws PIRException + * If a problem occurs performing the encryption. + * @return The querier containing the query, and all information required to perform decryption. */ - public void encrypt() throws InterruptedException, PIRException + public Querier encrypt() throws InterruptedException, PIRException { int numThreads = SystemConfiguration.getIntProperty("numThreads", 1); -encrypt(numThreads); +return encrypt(numThreads); } /** - * Encrypt, building the Query object, calculating and setting the query vectors - * - * If we have hash collisions over our selector set, we will append integers to the key starting with 0 until we no longer have collisions. - * - * For encrypted query vector E = : + * Encrypts the query described by the query information using Paillier encryption using the given number of threads. * - * E_i = 2^{j*dataPartitionBitSize} if i = H_k(selector_j) 0 otherwise --- End diff -- Can we please leave in the E_i definition for this javadoc? --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user tellison commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76516765 --- Diff: src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java --- @@ -32,7 +32,7 @@ * Class for partitioning objects with primitive Java types * */ -public class PrimitiveTypePartitioner implements DataPartitioner +final public class PrimitiveTypePartitioner implements DataPartitioner --- End diff -- ...and I thought I was pedantic ;-) Yep, will fix that in next round of clean-up over this code --thanks. --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
Github user smarthi commented on a diff in the pull request: https://github.com/apache/incubator-pirk/pull/81#discussion_r76514978 --- Diff: src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java --- @@ -32,7 +32,7 @@ * Class for partitioning objects with primitive Java types * */ -public class PrimitiveTypePartitioner implements DataPartitioner +final public class PrimitiveTypePartitioner implements DataPartitioner --- End diff -- Nitpick: How 'bout public final class :-) --- 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. ---
[GitHub] incubator-pirk pull request #81: Enhancements to Wideskies encrypt/decrypt.
GitHub user tellison opened a pull request: https://github.com/apache/incubator-pirk/pull/81 Enhancements to Wideskies encrypt/decrypt. - encrypt/decrypt now return their results, rather than have side-effect on their instances. - decryptor no longer responsible for storing results as JSON. - Marked primitive partitioner as final. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tellison/incubator-pirk EncryptDecrypt Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-pirk/pull/81.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #81 commit 101e3e1f8e9daae82d99178216c2411eb128ea10 Author: Tim EllisonDate: 2016-08-26T13:37:27Z Enhancements to Wideskies encrypt/decrypt. - encrypt/decrypt now return their results, rather than have side-effect on their instances. - decryptor no longer responsible for storing results as JSON. - Marked primitive partitioner as final. --- 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. ---