0
미니 jabber-bot를 개발해야합니다. TLS 연결 규칙 만있는 개방형 서버가 있습니다. 나는 4.2.0를 갈기 위해 사용 - 나는 연결을 시도하지만 예외가 지난 안정적인 빌드를 http://www.igniterealtime.org/downloads/에서 : 코드 :hava jabber-bot. XLSP over smack 4.2.0 (TLS 포함)
로그인XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("testjava", "12345678")
.setServiceName(server)
.setPort(5222)
.setHost(server) .setSecurityMode(ConnectionConfiguration.SecurityMode.required)
.setDebuggerEnabled(true)
.build();
AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
conn2.connect();
: 나는 피진을 사용하고 연결 수립이
10:35:31 AM SENT (0): <stream:stream xmlns='jabber:client' to='***.pro' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='[email protected]***.pro' xml:lang='en'>
10:35:31 AM RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="***.pro" id="xb9bamjxw" xml:lang="en" version="1.0">
10:35:32 AM RECV (0): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms></stream:features>
10:35:32 AM SENT (0): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>
10:35:32 AM RECV (0): <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
Exception in thread "main" org.jivesoftware.smack.SmackException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1010)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
at java.lang.Thread.run(Thread.java:745)
섬기는 사람. TLS 인증을 지원하려면 코드에 무엇을 추가해야합니까?
가능한 [Smack 4 throws "SSLHandshakeException : ValidatorException : SunCertPathBuilderException"(http://stackoverflow.com/questions/25495368/smack-4-throws-sslhandshakeexception-validatorexception-suncertpathbuilderexc) – Flow