diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-14 20:30:22 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-14 20:30:22 +0100 |
commit | 99b7023aba5c09f069badc35d05ea3ef53f3a6d2 (patch) | |
tree | 5e4559a79f5823d3927439c928c2d424fdb1ff70 /src/test/java/pl/edu | |
parent | 3159df80ee02f6f65fe8e8ae1bae8fecb8fad070 (diff) |
Add query uninstall calls
Diffstat (limited to 'src/test/java/pl/edu')
-rw-r--r-- | src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java index 70aad63..29d53d2 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java @@ -18,7 +18,7 @@ import java.security.PublicKey; public class QuerySignerApiImplementationTest { @Test - public void testQueryVerification() { + public void testQueryInstallVerification() { QuerySignerApiImplementation queryApi; try { @@ -29,21 +29,24 @@ public class QuerySignerApiImplementationTest { queryApi = new QuerySignerApiImplementation(publicKey, privateKey); QueryData signedQuery = queryApi.signInstallQuery("&a", "SELECT 1 AS ONE"); QuerySignerApiImplementation.validateInstallQuery("&a", signedQuery, publicKey); - } catch (IOException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (QuerySigner.InvalidQueryException e) { + } catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | QuerySigner.InvalidQueryException e) { e.printStackTrace(); } + } + @Test + public void testQueryUninstallVerification() { + QuerySignerApiImplementation queryApi; + try { + String publicKeyFile = "build/tmp/query_signer.pub"; + String privateKeyFile = "build/tmp/query_signer"; + PublicKey publicKey = KeyUtils.getPublicKey(publicKeyFile); + PrivateKey privateKey = KeyUtils.getPrivateKey(privateKeyFile); + queryApi = new QuerySignerApiImplementation(publicKey, privateKey); + QueryData signedQuery = queryApi.signUninstallQuery("&a"); + QuerySignerApiImplementation.validateUninstallQuery("&a", signedQuery, publicKey); + } catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | QuerySigner.InvalidQueryException e) { + e.printStackTrace(); + } } } |