皆さんこんにちは。サーバー側とクライアント側の両方で、JavaでXMPPを少し使い始めました。サーバー側では Apache Vysper 0.7 を使用し、クライアント側では Ignite Smack 3.1.0 を使用しています。ソース コードに付属の TLS 証明書を使用して、Apache vysper デモ ページの小さな XMPP 組み込みサーバーを使用しています。
XMPPServer server = new XMPPServer("localhost");
StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
AccountManagement accountManagement = (AccountManagement) providerRegistry.retrieve(AccountManagement.class);
Entity user = EntityImpl.parseUnchecked("user@localhost");
accountManagement.addUser(user, "password");
server.setStorageProviderRegistry(providerRegistry);
server.addEndpoint(new TCPEndpoint());
server.setTLSCertificateInfo(new File("bogus_mina_tls.cert"), "boguspw");
server.start();
System.out.println("Vysper server is running...");
問題は、これが正しい/有効な証明書ではないことです。pidgin を使用してサーバーをテストすると、アラート ウィンドウがポップアップ表示され、証明書が無効であることと、例外を追加する場合のボタンが表示されます。
私が望むのは、Smack api で同じことを行うことですが、方法がわかりません。
私のsmack apiでは、次のようなものを使用しています:
ConnectionConfiguration config = new ConnectionConfiguration("localhost",5222, "localhost");
config.setSASLAuthenticationEnabled(false);
connection = new XMPPConnection(config);
connection.connect();
connection.login(userName, password);
それで、ここにあります。無効な証明書を承認または拒否するにはどうすればよいですか? ご協力いただきありがとうございます。