Search in sources :

Example 21 with PemKeyCertOptions

use of io.vertx.core.net.PemKeyCertOptions in project vert.x by eclipse.

the class KeyStoreHelperTest method testKeyStoreHelperSupportsRSAPrivateKeys.

/**
 * Verifies that the key store helper can read a PKCS#8 encoded RSA private key
 * from a PEM file.
 *
 * @throws Exception if the key cannot be read.
 */
@Test
public void testKeyStoreHelperSupportsRSAPrivateKeys() throws Exception {
    PemKeyCertOptions options = new PemKeyCertOptions().addKeyPath("target/test-classes/tls/server-key.pem").addCertPath("target/test-classes/tls/server-cert.pem");
    KeyStoreHelper helper = options.getHelper(vertx);
    assertKeyType(helper.store(), RSAPrivateKey.class);
}
Also used : PemKeyCertOptions(io.vertx.core.net.PemKeyCertOptions) KeyStoreHelper(io.vertx.core.net.impl.KeyStoreHelper) Test(org.junit.Test)

Example 22 with PemKeyCertOptions

use of io.vertx.core.net.PemKeyCertOptions in project vert.x by eclipse.

the class KeyStoreHelperTest method testKeyStoreHelperSupportsECPrivateKeys.

/**
 * Verifies that the key store helper can read a PKCS#8 encoded EC private key
 * from a PEM file.
 *
 * @throws Exception if the key cannot be read.
 */
@Test
public void testKeyStoreHelperSupportsECPrivateKeys() throws Exception {
    Assume.assumeTrue("ECC is not supported by VM's security providers", isECCSupportedByVM());
    PemKeyCertOptions options = new PemKeyCertOptions().addKeyPath("target/test-classes/tls/server-key-ec.pem").addCertPath("target/test-classes/tls/server-cert-ec.pem");
    KeyStoreHelper helper = options.getHelper(vertx);
    assertKeyType(helper.store(), ECPrivateKey.class);
}
Also used : PemKeyCertOptions(io.vertx.core.net.PemKeyCertOptions) KeyStoreHelper(io.vertx.core.net.impl.KeyStoreHelper) Test(org.junit.Test)

Aggregations

PemKeyCertOptions (io.vertx.core.net.PemKeyCertOptions)22 Test (org.junit.Test)10 HttpServerOptions (io.vertx.core.http.HttpServerOptions)9 HttpServer (io.vertx.core.http.HttpServer)7 AbstractVerticle (io.vertx.core.AbstractVerticle)4 Buffer (io.vertx.core.buffer.Buffer)4 PfxOptions (io.vertx.core.net.PfxOptions)4 Router (io.vertx.ext.web.Router)4 HttpServerResponse (io.vertx.core.http.HttpServerResponse)3 JsonObject (io.vertx.core.json.JsonObject)3 JksOptions (io.vertx.core.net.JksOptions)3 HttpClient (io.vertx.core.http.HttpClient)2 HttpClientOptions (io.vertx.core.http.HttpClientOptions)2 HttpClientRequest (io.vertx.core.http.HttpClientRequest)2 HttpMethod (io.vertx.core.http.HttpMethod)2 HttpVersion (io.vertx.core.http.HttpVersion)2 JsonArray (io.vertx.core.json.JsonArray)2 OpenSSLEngineOptions (io.vertx.core.net.OpenSSLEngineOptions)2 PemTrustOptions (io.vertx.core.net.PemTrustOptions)2 KeyStoreHelper (io.vertx.core.net.impl.KeyStoreHelper)2