小编dan*_*nny的帖子

how to add unsupported cipher suites(not included in the default cipher suites) to client hello message

the requirement is client shall support following cipher suites for TLS encryption?

  private String[] cipherSuites = new String[] {
          "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
          "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
          "TLS_DHE_RSA_WITH_AES_256_CBC_SHA ",
          "TLS_RSA_WITH_AES_256_GCM_SHA384",
          "TLS_RSA_WITH_AES_256_CBC_SHA256",
          "TLS_RSA_WITH_AES_256_CBC_SHA",
          "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
          "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
          "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
          "TLS_RSA_WITH_AES_128_GCM_SHA256",
          "TLS_RSA_WITH_AES_128_CBC_SHA256",
      };
Run Code Online (Sandbox Code Playgroud)

this is the main code:

public static void main(String []args) throws IOException {
        Hashtable<String, String> env = new Hashtable<>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://10.159.218.169:636/ou=LDAPConfData,ou=Nokia,dc=solution,dc=com");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, "uid=username,ou=People,dc=solution,dc=com");
        env.put(Context.SECURITY_CREDENTIALS, "123456");
        env.put(Context.SECURITY_PROTOCOL, "ssl");
        env.put("java.naming.ldap.factory.socket", CustomSocketFactory.class.getName());

        try {
            InitialDirContext context = new InitialDirContext(env);
        } catch (NamingException e) {
            // TODO Auto-generated …
Run Code Online (Sandbox Code Playgroud)

java

2
推荐指数
1
解决办法
8405
查看次数

如何通过名称字符串获取枚举值

我想通过名称字符串获取枚举值,

这个枚举代码:包实践;

enum Mobile {
  Samsung(400),
  Nokia(250),
  Motorola(325);

  int price;
  Mobile(int p) {
    price = p;
  }
  int showPrice() {
    return price;
  }
}
Run Code Online (Sandbox Code Playgroud)

我可以获取类名和名称字符串

Class enumClass = Class.forName("practice.Mobile");
String name = "Samsung";
Run Code Online (Sandbox Code Playgroud)

如何才能获得三星值400仅使用enumClass和名称?非常感谢

java enums

1
推荐指数
1
解决办法
2589
查看次数

标签 统计

java ×2

enums ×1