use of won.cryptography.service.KeyPairService in project webofneeds by researchstudio-sat.
the class TestSigningUtils method generateKeystoreForNodeAndOwner.
/**
* Not a test - but sometimes can be useful for generating test keys.
*
* @throws Exception
*/
// @Test
public void generateKeystoreForNodeAndOwner() throws Exception {
Security.addProvider(new BouncyCastleProvider());
// KeyStoreService storeServiceOnNode = new KeyStoreService(new
// File("node-keys.jks"));
FileBasedKeyStoreService storeServiceOnOwner = new FileBasedKeyStoreService(new File("owner-keys.jks"), "temp");
storeServiceOnOwner.init();
// KeyStoreService storeServiceOnMatcher = new KeyStoreService(new
// File("matcher-keys.jks"));
KeyPairService keyPairService = new KeyPairService();
CertificateService certificateService = new CertificateService();
// addKeyByUris(new String[]{
// "http://rsa021.researchstudio.at:8080/won/resource",
// "http://sat016.researchstudio.at:8080/won/resource",
// "http://localhost:8080/won/resource"},
// keyPairService, certificateService, storeServiceOnNode);
addKeyByUris(new String[] { "http://rsa021.researchstudio.at:8080/owner/rest/keys", "http://sat016.researchstudio.at:8080/owner/rest/keys", "http://localhost:8080/owner/rest/keys" }, keyPairService, certificateService, storeServiceOnOwner);
// addKeyByUris(new String[]{
// "http://sat001.researchstudio.at:8080/matcher/resource",
// "http://localhost:8080/matcher/resource"},
// keyPairService, certificateService, storeServiceOnMatcher);
}
use of won.cryptography.service.KeyPairService in project webofneeds by researchstudio-sat.
the class CryptographyServiceTest method testInfoExractorOfKeyPairBrainpoolp384r1.
@Test
public void testInfoExractorOfKeyPairBrainpoolp384r1() {
KeyPairService keyPairService = context.getBean("keyPairService", KeyPairService.class);
KeyPair keypair = keyPairService.generateNewKeyPairInBrainpoolp384r1();
KeyInformationExtractorBouncyCastle extractor = new KeyInformationExtractorBouncyCastle();
try {
Assert.assertEquals("ECDSA", extractor.getAlgorithm(keypair.getPublic()));
logger.debug("algorithm: " + extractor.getAlgorithm(keypair.getPublic()));
Assert.assertEquals("brainpoolp384r1", extractor.getCurveID(keypair.getPublic()));
logger.debug("curveID: " + extractor.getCurveID(keypair.getPublic()));
Assert.assertNotNull(extractor.getQX(keypair.getPublic()));
logger.debug("qx: " + extractor.getQX(keypair.getPublic()));
Assert.assertNotNull(extractor.getQY(keypair.getPublic()));
logger.debug("qy: " + extractor.getQY(keypair.getPublic()));
} catch (KeyNotSupportedException ex) {
Assert.fail(ex.getMessage());
}
}
use of won.cryptography.service.KeyPairService in project webofneeds by researchstudio-sat.
the class CryptographyServiceTest method testInfoExtractorOfKeyPairSecp384r1.
@Test
public void testInfoExtractorOfKeyPairSecp384r1() {
KeyPairService keyPairService = context.getBean("keyPairService", KeyPairService.class);
KeyPair keypair = keyPairService.generateNewKeyPairInSecp384r1();
KeyInformationExtractorBouncyCastle extractor = new KeyInformationExtractorBouncyCastle();
try {
Assert.assertEquals("ECDSA", extractor.getAlgorithm(keypair.getPublic()));
logger.debug("algorithm: " + extractor.getAlgorithm(keypair.getPublic()));
Assert.assertEquals("secp384r1", extractor.getCurveID(keypair.getPublic()));
logger.debug("curveID: " + extractor.getCurveID(keypair.getPublic()));
Assert.assertNotNull(extractor.getQX(keypair.getPublic()));
logger.debug("qx: " + extractor.getQX(keypair.getPublic()));
Assert.assertNotNull(extractor.getQY(keypair.getPublic()));
logger.debug("qy: " + extractor.getQY(keypair.getPublic()));
} catch (KeyNotSupportedException ex) {
Assert.fail(ex.getMessage());
}
}
use of won.cryptography.service.KeyPairService in project webofneeds by researchstudio-sat.
the class CryptographyServiceTest method testGenerateKeyPairBrainpoolp384r1.
@Test
public void testGenerateKeyPairBrainpoolp384r1() {
KeyPairService keyPairService = context.getBean("keyPairService", KeyPairService.class);
KeyPair keypair = keyPairService.generateNewKeyPairInBrainpoolp384r1();
Assert.assertNotNull(keypair.getPublic());
Assert.assertNotNull(keypair.getPrivate());
}
use of won.cryptography.service.KeyPairService in project webofneeds by researchstudio-sat.
the class CryptographyServiceTest method testGenerateKeyPairSecp384r1.
@Test
public void testGenerateKeyPairSecp384r1() {
KeyPairService keyPairService = context.getBean("keyPairService", KeyPairService.class);
KeyPair keypair = keyPairService.generateNewKeyPairInSecp384r1();
Assert.assertNotNull(keypair.getPublic());
Assert.assertNotNull(keypair.getPrivate());
}
Aggregations