当前位置: 首页 > 知识库问答 >
问题:

如何获得HiveMQ客户机中使用的密码套件?

白学
2023-03-14

我将HiveMQ服务器配置为识别TLS,并创建了一个TLS通信。我想打印出正在使用的密码套件。我使用了getSslConfig(),但最后得到的输出是:

可选[com.hivemq.client.internal.mqtt.mqttclientsslconfigimpl@2710]

Mqtt5BlockingClient subscriber = Mqtt5Client.builder()
        .identifier(UUID.randomUUID().toString()) // the unique identifier of the MQTT client. The ID is randomly generated between 
        .serverHost("localhost")  // the host name or IP address of the MQTT server. Kept it localhost for testing. localhost is default if not specified.
        .serverPort(8883)  // specifies the port of the server
        .addConnectedListener(context -> ClientConnectionRetreiver.printConnected("Subscriber1"))        // prints a string that the client is connected
        .addDisconnectedListener(context -> ClientConnectionRetreiver.printDisconnected("Subscriber1"))  // prints a string that the client is disconnected
        .sslWithDefaultConfig()  // << How can I specify a particular cipher suite?
        .buildBlocking();  // creates the client builder
Mqtt5ClientConfig clientConfig = client.getConfig();
System.out.println(" Ssl Configuration: " + clientConfig.getSslConfig());

共有1个答案

海信鸥
2023-03-14
Mqtt5Client.builder()
        ...
        .sslConfig()
            .cipherSuites(Arrays.asList("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"))
            .applySslConfig()
        ...

GetSSLConfig返回一个可选。为了得到密码套件:

client.getConfig().getSslConfig().get().getCipherSuites()
 类似资料:
  • 问题内容: 我正在使用Zend_Framework编写一个应用程序(因此解决方案可以依靠它)。 如何获得客户的时区? 例如,如果有人在俄罗斯莫斯科,我想得到3 * 60 * 60(因为有UTC + 3)。如果他在英国,我要零。如果他使用UTC-3:30(加拿大?),我要-3.5 * 60 * 60。 (这不是格式的问题-我可以在俄罗斯圣彼得堡获得’Europe / Moscow’或’UTC-3’,

  • 我试图弄清楚如何处理Passport包中的密码授予令牌。我是否应该将客户id和客户机密存储在中。env文件或在请求令牌时直接从数据库获取值?

  • 我正在尝试各种Azure功能,目前希望从KeyVault检索一个秘密。 直截了当地说: 我正在使用这个nuget包与我的azure资源进行交互。 我开发了一个简单的。NET核心控制台应用程序,并在本地运行。 我有一个密钥库资源,其中定义了一个处于活动状态且未过期的秘密。 我在AAD中注册了一个应用程序,因此我的本地出货。NET Core控制台应用程序在AAD中具有标识。 然后我在AAD的注册应用程

  • 问题内容: 我想知道我们如何知道套接字(java)中服务器端客户端的IP地址。假设有一个服务器“ S”和两个客户端“ A”和“ B”。客户端A向我(服务器)发送一些信息,客户端B向我(服务器)发送一些其他信息。我必须将来自A和B的信息存储在不同表中的数据库中。如何区分客户端A和客户端B的请求? 问题答案: 每个套接字都有一个方法来返回与其连接的客户端的IP地址。

  • 我如何保护我的javascript客户端,你能推荐一些库吗。 提前谢谢你