static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PfxOptions obj) { for (java.util.Map.Entry<String, Object> member : json) { switch (member.getKey()) { case "password": if (member.getValue() instanceof String) { obj.setPassword((String)member.getValue()); } break; case "path": if (member.getValue() instanceof String) { obj.setPath((String)member.getValue()); } break; case "value": if (member.getValue() instanceof String) { obj.setValue(io.vertx.core.buffer.Buffer.buffer(java.util.Base64.getDecoder().decode((String)member.getValue()))); } break; } } }
@Test public void testPKCS12Value() throws Exception { PfxOptions options = Cert.SERVER_PKCS12.get(); Buffer store = vertx.fileSystem().readFileBlocking(options.getPath()); options.setPath(null).setValue(store); testKeyStore(options); }
@Test public void testCopyPKCS12Options() throws Exception { PfxOptions options = new PfxOptions(); 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 PfxOptions(options); assertEquals(password, options.getPassword()); assertEquals(path, options.getPath()); assertEquals(value, options.getValue()); options = new PfxOptions(options.toJson()); assertEquals(password, options.getPassword()); assertEquals(path, options.getPath()); assertEquals(value, options.getValue()); }
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PfxOptions obj) { for (java.util.Map.Entry<String, Object> member : json) { switch (member.getKey()) { case "password": if (member.getValue() instanceof String) { obj.setPassword((String)member.getValue()); } break; case "path": if (member.getValue() instanceof String) { obj.setPath((String)member.getValue()); } break; case "value": if (member.getValue() instanceof String) { obj.setValue(io.vertx.core.buffer.Buffer.buffer(java.util.Base64.getDecoder().decode((String)member.getValue()))); } break; } } }
@Test public void testPKCS12Value() throws Exception { PfxOptions options = Cert.SERVER_PKCS12.get(); Buffer store = vertx.fileSystem().readFileBlocking(options.getPath()); options.setPath(null).setValue(store); testKeyStore(options); }
pfxOptions.setPath(pkcs12TrustStore.getPath()); } else { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12TrustStore.getContent())); pfxOptions.setPath(pkcs12KeyStore.getPath()); } else if (pkcs12KeyStore.getContent() != null && !pkcs12KeyStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12KeyStore.getContent()));
pfxOptions.setPath(pkcs12TrustStore.getPath()); } else { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12TrustStore.getContent())); pfxOptions.setPath(pkcs12KeyStore.getPath()); } else if (pkcs12KeyStore.getContent() != null && !pkcs12KeyStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12KeyStore.getContent()));
@Test public void testCopyPKCS12Options() throws Exception { PfxOptions options = new PfxOptions(); 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 PfxOptions(options); assertEquals(password, options.getPassword()); assertEquals(path, options.getPath()); assertEquals(value, options.getValue()); options = new PfxOptions(options.toJson()); assertEquals(password, options.getPassword()); assertEquals(path, options.getPath()); assertEquals(value, options.getValue()); }
pfxOptions.setPath(pkcs12TrustStore.getPath()); } else if (pkcs12TrustStore.getContent() != null && !pkcs12TrustStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12TrustStore.getContent())); } else { throw new EndpointException("Missing PKCS12 value for endpoint " + endpoint.getName()); pfxOptions.setPath(pkcs12KeyStore.getPath()); } else if (pkcs12KeyStore.getContent() != null && !pkcs12KeyStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12KeyStore.getContent()));
pfxOptions.setPath(pkcs12TrustStore.getPath()); } else if (pkcs12TrustStore.getContent() != null && !pkcs12TrustStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12TrustStore.getContent())); } else { throw new EndpointException("Missing PKCS12 value for endpoint " + endpoint.getName()); pfxOptions.setPath(pkcs12KeyStore.getPath()); } else if (pkcs12KeyStore.getContent() != null && !pkcs12KeyStore.getContent().isEmpty()) { pfxOptions.setValue(io.vertx.core.buffer.Buffer.buffer(pkcs12KeyStore.getContent()));