Search in sources :

Example 1 with CertificateService

use of won.cryptography.service.CertificateService 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);
}
Also used : FileBasedKeyStoreService(won.cryptography.service.keystore.FileBasedKeyStoreService) CertificateService(won.cryptography.service.CertificateService) File(java.io.File) KeyPairService(won.cryptography.service.KeyPairService) BouncyCastleProvider(org.bouncycastle.jce.provider.BouncyCastleProvider)

Example 2 with CertificateService

use of won.cryptography.service.CertificateService in project webofneeds by researchstudio-sat.

the class TestSigningUtils method generateTestKeystore.

/**
 * Not a test - but sometimes can be useful for generating test keys.
 *
 * @throws Exception
 */
// @Test
public void generateTestKeystore() throws Exception {
    Security.addProvider(new BouncyCastleProvider());
    File keysFile = new File("test-keys2.jks");
    FileBasedKeyStoreService storeService = new FileBasedKeyStoreService(keysFile, "temp");
    storeService.init();
    KeyPairService keyPairService = new KeyPairService();
    CertificateService certificateService = new CertificateService();
    addKeyByUri(atomCertUri, keyPairService, certificateService, storeService);
    addKeyByUri(ownerCertUri, keyPairService, certificateService, storeService);
    addKeyByUri(nodeCertUri, keyPairService, certificateService, storeService);
}
Also used : FileBasedKeyStoreService(won.cryptography.service.keystore.FileBasedKeyStoreService) CertificateService(won.cryptography.service.CertificateService) File(java.io.File) KeyPairService(won.cryptography.service.KeyPairService) BouncyCastleProvider(org.bouncycastle.jce.provider.BouncyCastleProvider)

Aggregations

File (java.io.File)2 BouncyCastleProvider (org.bouncycastle.jce.provider.BouncyCastleProvider)2 CertificateService (won.cryptography.service.CertificateService)2 KeyPairService (won.cryptography.service.KeyPairService)2 FileBasedKeyStoreService (won.cryptography.service.keystore.FileBasedKeyStoreService)2