m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagdalena GrodziƄska <mag.grodzinska@gmail.com>2020-01-14 23:55:05 +0100
committerGitHub <noreply@github.com>2020-01-14 23:55:05 +0100
commit1986aaadaf6dd4316dce0186616a515e6721628c (patch)
treedf8981a8cfc019f651245b4bca30479fd92cebaa
parent7972afc9cab164615116f494e6824b88f8f873a7 (diff)
parentbecf7ebe358740ca082d4147ab3e1a3c99106e57 (diff)
Merge pull request #121 from m-chrzan/last_fixes
Last fixes
-rw-r--r--README.md10
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java24
2 files changed, 23 insertions, 11 deletions
diff --git a/README.md b/README.md
index 47cdd3e..3a5ad5b 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,14 @@
The agent, fetcher, and interpreter take an optional `-Dhostname=<agent's external hostname`
argument, which defaults to `localhost`.
+### Query Signer
+ # start rmiregistry
+ ./scripts/registry
+ # generate keys
+ ./scripts/generate_keys.sh
+ # run Query Signer
+ ./gradlew runQuerySigner
+
### API Agent
# start rmiregistry
@@ -12,6 +20,8 @@ argument, which defaults to `localhost`.
# start agent to bind API
./gradlew runAgent
+Relies on keys generated during query signer setup.
+
### Client
./gradlew runClient
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
index efc5605..382160e 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
@@ -226,23 +226,25 @@ public class Stanik extends Module {
for (Entry<Attribute, ValueQuery> entry : message.getQueries().entrySet()) {
Attribute attribute = entry.getKey();
ValueQuery query = entry.getValue();
- try {
- if (query.isInstalled()) {
+ if (query.getSignature() != null) {
+ try {
+ if (query.isInstalled()) {
QuerySignerApiImplementation.validateInstallQuery(
attribute.getName(),
QueryUtils.constructQueryData(query),
this.publicKey);
- } else {
- QuerySignerApiImplementation.validateUninstallQuery(
- attribute.getName(),
- QueryUtils.constructQueryData(query),
- this.publicKey);
+ } else {
+ QuerySignerApiImplementation.validateUninstallQuery(
+ attribute.getName(),
+ QueryUtils.constructQueryData(query),
+ this.publicKey);
+ }
+ } catch (RemoteException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException | QuerySigner.InvalidQueryException e) {
+ System.out.println("ERROR: Query " + attribute.getName() + " was not updated in Stanik with error message " + e.getMessage());
+ e.printStackTrace();
+ continue;
}
- } catch (RemoteException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException | QuerySigner.InvalidQueryException e) {
- System.out.println("ERROR: Query " + attribute.getName() + " was not updated in Stanik with error message " + e.getMessage());
- e.printStackTrace();
- continue;
}
ValueTime timestamp = new ValueTime(entry.getValue().getTimestamp());
ValueQuery currentTimestampedQuery = queries.get(attribute);