@Test public void testReadAtomPublicKey() throws Exception { Dataset tempDataset = TestSigningUtils.prepareTestDataset(RESOURCE_FILE); Map<String, PublicKey> constructedKeys = extractor.readFromDataset(tempDataset); Assert.assertEquals(1, constructedKeys.size()); ECPublicKey expectedKey = (ECPublicKey) keys.getPublicKey(TestSigningUtils.atomCertUri); ECPublicKey constructedKey = (ECPublicKey) constructedKeys.get(ATOM_URI); ECParameterSpec specConsr = constructedKey.getParams(); ECParameterSpec specExpec = expectedKey.getParams(); Assert.assertEquals(specExpec.getCurve(), specConsr.getCurve()); Assert.assertEquals(expectedKey.getW().getAffineX(), constructedKey.getW().getAffineX()); Assert.assertEquals(expectedKey.getW().getAffineY(), constructedKey.getW().getAffineY()); Assert.assertEquals(expectedKey.getAlgorithm(), constructedKey.getAlgorithm()); }
public Map<String, PublicKey> readFromDataset(Dataset dataset) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { Map<String, PublicKey> keys = new HashMap<>(); readFromModel(dataset.getDefaultModel(), keys); for (String name : RdfUtils.getModelNames(dataset)) { readFromModel(dataset.getNamedModel(name), keys); } return keys; }
WonKeysReaderWriter { public Map<String, PublicKey> readFromDataset(Dataset dataset) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { Map<String, PublicKey> keys = new HashMap<>(); readFromModel(dataset.getDefaultModel(), keys); for (String name : RdfUtils.getModelNames(dataset)) { readFromModel(dataset.getNamedModel(name), keys); } return keys; } }
WonKeysReaderWriter { public Map<String, PublicKey> readFromDataset(Dataset dataset) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { Map<String, PublicKey> keys = new HashMap<>(); readFromModel(dataset.getDefaultModel(), keys); for (String name : RdfUtils.getModelNames(dataset)) { readFromModel(dataset.getNamedModel(name), keys); } return keys; } WonKeysReaderWriter(); }
WonKeysReaderWriter { public Map<String, PublicKey> readFromDataset(Dataset dataset) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { Map<String, PublicKey> keys = new HashMap<>(); readFromModel(dataset.getDefaultModel(), keys); for (String name : RdfUtils.getModelNames(dataset)) { readFromModel(dataset.getNamedModel(name), keys); } return keys; } WonKeysReaderWriter(); Map<String, PublicKey> readFromDataset(Dataset dataset); Set<PublicKey> readFromDataset(Dataset dataset, String keyUri); Map<String, PublicKey> readFromModel(Model model); Set<String> readKeyReferences(Dataset dataset); Model writeToModel(Resource keySubject, WonEccPublicKey pubKey); void writeToModel(Model model, Resource keySubject, PublicKey publicKey); }
WonKeysReaderWriter { public Map<String, PublicKey> readFromDataset(Dataset dataset) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { Map<String, PublicKey> keys = new HashMap<>(); readFromModel(dataset.getDefaultModel(), keys); for (String name : RdfUtils.getModelNames(dataset)) { readFromModel(dataset.getNamedModel(name), keys); } return keys; } WonKeysReaderWriter(); Map<String, PublicKey> readFromDataset(Dataset dataset); Set<PublicKey> readFromDataset(Dataset dataset, String keyUri); Map<String, PublicKey> readFromModel(Model model); Set<String> readKeyReferences(Dataset dataset); Model writeToModel(Resource keySubject, WonEccPublicKey pubKey); void writeToModel(Model model, Resource keySubject, PublicKey publicKey);  }