Search in sources :

Example 6 with KeyPairService

use of won.cryptography.service.KeyPairService 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

KeyPairService (won.cryptography.service.KeyPairService)6 KeyPair (java.security.KeyPair)4 Test (org.junit.Test)4 File (java.io.File)2 BouncyCastleProvider (org.bouncycastle.jce.provider.BouncyCastleProvider)2 KeyNotSupportedException (won.cryptography.exception.KeyNotSupportedException)2 KeyInformationExtractorBouncyCastle (won.cryptography.key.KeyInformationExtractorBouncyCastle)2 CertificateService (won.cryptography.service.CertificateService)2 FileBasedKeyStoreService (won.cryptography.service.keystore.FileBasedKeyStoreService)2