use of org.jboss.resteasy.security.doseta.DosetaKeyRepository in project resteasy by resteasy.
the class LocalTest method setup.
@BeforeClass
public static void setup() throws Exception {
repository = new DosetaKeyRepository();
repository.setKeyStoreFile(filePath);
repository.setKeyStorePassword("password");
repository.setUseDns(false);
repository.start();
PrivateKey privateKey = repository.getKeyStore().getPrivateKey("test._domainKey.samplezone.org");
if (privateKey == null) {
throw new Exception("Private Key is null.");
}
PublicKey publicKey = repository.getKeyStore().getPublicKey("test._domainKey.samplezone.org");
keys = new KeyPair(publicKey, privateKey);
KeyPairGenerator.getInstance("RSA").generateKeyPair();
}
use of org.jboss.resteasy.security.doseta.DosetaKeyRepository in project resteasy by resteasy.
the class SigningTest method setup.
@BeforeClass
public static void setup() throws Exception {
server = new NettyJaxrsServer();
server.setPort(TestPortProvider.getPort());
server.setRootResourcePath("/");
deployment = server.getDeployment();
deployment.start();
repository = new DosetaKeyRepository();
repository.setKeyStorePath("test.jks");
repository.setKeyStorePassword("password");
repository.setUseDns(false);
repository.start();
PrivateKey privateKey = repository.getKeyStore().getPrivateKey("test._domainKey.samplezone.org");
if (privateKey == null)
throw new Exception("Private Key is null!!!");
PublicKey publicKey = repository.getKeyStore().getPublicKey("test._domainKey.samplezone.org");
keys = new KeyPair(publicKey, privateKey);
KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
badKey = keyPair.getPrivate();
deployment.getDispatcher().getDefaultContextObjects().put(KeyRepository.class, repository);
addPerRequestResource(SignedResource.class);
server.start();
client = (ResteasyClient) ClientBuilder.newClient();
}
use of org.jboss.resteasy.security.doseta.DosetaKeyRepository in project resteasy by resteasy.
the class SigningTest method setup.
@BeforeClass
public static void setup() throws Exception {
repository = new DosetaKeyRepository();
repository.setKeyStoreFile(testJksPath);
repository.setKeyStorePassword("password");
repository.setUseDns(false);
repository.start();
PrivateKey privateKey = repository.getKeyStore().getPrivateKey("test._domainKey.samplezone.org");
if (privateKey == null) {
throw new Exception("Private Key is null!!!");
}
PublicKey publicKey = repository.getKeyStore().getPublicKey("test._domainKey.samplezone.org");
keys = new KeyPair(publicKey, privateKey);
KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
badKey = keyPair.getPrivate();
}
use of org.jboss.resteasy.security.doseta.DosetaKeyRepository in project resteasy by resteasy.
the class SigningDnsTest method setup.
@BeforeClass
public static void setup() throws Exception {
server = new NettyJaxrsServer();
server.setPort(TestPortProvider.getPort());
server.setRootResourcePath("/");
deployment = server.getDeployment();
deployment.start();
clientRepository = new DosetaKeyRepository();
clientRepository.setKeyStorePath("test1.jks");
clientRepository.setKeyStorePassword("password");
clientRepository.setUseDns(true);
clientRepository.setDnsUri("dns://localhost:6363");
clientRepository.start();
serverRepository = new DosetaKeyRepository();
serverRepository.setKeyStorePath("test2.jks");
serverRepository.setKeyStorePassword("password");
serverRepository.setUseDns(true);
serverRepository.setDnsUri("dns://localhost:6363");
serverRepository.start();
KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
badKey = keyPair.getPrivate();
deployment.getDispatcher().getDefaultContextObjects().put(KeyRepository.class, serverRepository);
addPerRequestResource(SignedResource.class);
configureDNS();
server.start();
client = ClientBuilder.newClient();
}
Aggregations