Examples of PKCS12Options


Examples of io.vertx.core.net.PKCS12Options

  protected TrustStoreOptions getClientTrustOptions(TS trust) {
    switch (trust) {
      case JKS:
        return new JKSOptions().setPath(findFileOnClasspath("tls/client-truststore.jks")).setPassword("wibble");
      case PKCS12:
        return new PKCS12Options().setPath(findFileOnClasspath("tls/client-truststore.p12")).setPassword("wibble");
      case PEM:
        return new CaOptions().addCertPath(findFileOnClasspath("tls/server-cert.pem"));
      case PEM_CA:
        return new CaOptions().addCertPath(findFileOnClasspath("tls/ca/ca-cert.pem"));
      default:
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

  protected KeyStoreOptions getClientCertOptions(KS cert) {
    switch (cert) {
      case JKS:
        return new JKSOptions().setPath(findFileOnClasspath("tls/client-keystore.jks")).setPassword("wibble");
      case PKCS12:
        return new PKCS12Options().setPath(findFileOnClasspath("tls/client-keystore.p12")).setPassword("wibble");
      case PEM:
        return new KeyCertOptions().setKeyPath(findFileOnClasspath("tls/client-key.pem")).setCertPath(findFileOnClasspath("tls/client-cert.pem"));
      case PEM_CA:
        return new KeyCertOptions().setKeyPath(findFileOnClasspath("tls/client-key.pem")).setCertPath(findFileOnClasspath("tls/client-cert-ca.pem"));
      default:
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

  protected TrustStoreOptions getServerTrustOptions(TS trust) {
    switch (trust) {
      case JKS:
        return new JKSOptions().setPath(findFileOnClasspath("tls/server-truststore.jks")).setPassword("wibble");
      case PKCS12:
        return new PKCS12Options().setPath(findFileOnClasspath("tls/server-truststore.p12")).setPassword("wibble");
      case PEM:
        return new CaOptions().addCertPath(findFileOnClasspath("tls/client-cert.pem"));
      case PEM_CA:
        return new CaOptions().addCertPath(findFileOnClasspath("tls/ca/ca-cert.pem"));
      default:
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

  protected KeyStoreOptions getServerCertOptions(KS cert) {
    switch (cert) {
      case JKS:
        return new JKSOptions().setPath(findFileOnClasspath("tls/server-keystore.jks")).setPassword("wibble");
      case PKCS12:
        return new PKCS12Options().setPath(findFileOnClasspath("tls/server-keystore.p12")).setPassword("wibble");
      case PEM:
        return new KeyCertOptions().setKeyPath(findFileOnClasspath("tls/server-key.pem")).setCertPath(findFileOnClasspath("tls/server-cert.pem"));
      case PEM_CA:
        return new KeyCertOptions().setKeyPath(findFileOnClasspath("tls/server-key.pem")).setCertPath(findFileOnClasspath("tls/server-cert-ca.pem"));
      default:
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

    assertEquals(value, options.getValue());
  }

  @Test
  public void testPKCS12Options() throws Exception {
    PKCS12Options options = new PKCS12Options();

    assertNull(options.getPath());
    String randString = TestUtils.randomAlphaString(100);
    assertEquals(options, options.setPath(randString));
    assertEquals(randString, options.getPath());

    assertNull(options.getPassword());
    randString = TestUtils.randomAlphaString(100);
    assertEquals(options, options.setPassword(randString));
    assertEquals(randString, options.getPassword());
  }
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

    assertEquals(randString, options.getPassword());
  }

  @Test
  public void testDefaultPKCS12OptionsJson() {
    PKCS12Options def = new PKCS12Options();
    PKCS12Options json = new PKCS12Options(new JsonObject());
    assertEquals(def.getPassword(), json.getPassword());
    assertEquals(def.getPath(), json.getPath());
    assertEquals(def.getValue(), json.getValue());
  }
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

    assertEquals(def.getValue(), json.getValue());
  }

  @Test
  public void testPKCS12OptionsJson() throws Exception {
    PKCS12Options options = new PKCS12Options(new JsonObject());
    assertEquals(null, options.getPassword());
    assertEquals(null, options.getPath());
    assertEquals(null, options.getValue());

    String password = TestUtils.randomAlphaString(100);
    String path = TestUtils.randomAlphaString(100);
    String value = TestUtils.randomAlphaString(100);
    options = new PKCS12Options(new JsonObject().
        put("password", password).
        put("path", path).
        put("value", value.getBytes()));
    assertEquals(password, options.getPassword());
    assertEquals(path, options.getPath());
    assertEquals(Buffer.buffer(value), options.getValue());
  }
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

    assertEquals(Buffer.buffer(value), options.getValue());
  }

  @Test
  public void testCopyPKCS12Options() throws Exception {
    PKCS12Options options = new PKCS12Options();
    String password = TestUtils.randomAlphaString(100);
    String path = TestUtils.randomAlphaString(100);
    Buffer value = Buffer.buffer(TestUtils.randomAlphaString(100));
    options.setPassword(password);
    options.setPath(path);
    options.setValue(value);
    options = new PKCS12Options(options);
    assertEquals(password, options.getPassword());
    assertEquals(path, options.getPath());
    assertEquals(value, options.getValue());
  }
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

    testKeyStore(getServerCertOptions(KS.PKCS12));
  }

  @Test
  public void testPKCS12Value() throws Exception {
    PKCS12Options options = (PKCS12Options) getServerCertOptions(KS.PKCS12);
    Buffer store = vertx.fileSystem().readFileSync(options.getPath());
    options.setPath(null).setValue(store);
    testKeyStore(options);
  }
View Full Code Here

Examples of io.vertx.core.net.PKCS12Options

      } else {
        return null;
      }
      return new JKSOrPKCS12("JKS", jks.getPassword(), value);
    } else if (options instanceof PKCS12Options) {
      PKCS12Options pkcs12 = (PKCS12Options) options;
      Callable<Buffer> value;
      if (pkcs12.getPath() != null) {
        value = () -> vertx.fileSystem().readFileSync(vertx.resolveFile(pkcs12.getPath()).getAbsolutePath());
      } else if (pkcs12.getValue() != null) {
        value = () -> pkcs12.getValue();
      } else {
        return null;
      }
      return new JKSOrPKCS12("PKCS12", pkcs12.getPassword(), value);
    } else if (options instanceof KeyCertOptions) {
      KeyCertOptions keyCert = (KeyCertOptions) options;
      Callable<Buffer> key = () -> {
        if (keyCert.getKeyPath() != null) {
          return vertx.fileSystem().readFileSync(vertx.resolveFile(keyCert.getKeyPath()).getAbsolutePath());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.