Skip to content

Commit daffd27

Browse files
committed
Remove the BC provider
As this causes org.jivesoftware.smack.SmackException$SmackWrappedException: javax.net.ssl.SSLHandshakeException: Could not generate secret org.jivesoftware.smack.AbstractXMPPConnection.setCurrentConnectionExceptionAndNotify(AbstractXMPPConnection.java:690) org.jivesoftware.smack.AbstractXMPPConnection.notifyConnectionError(AbstractXMPPConnection.java:994) org.jivesoftware.smack.tcp.XMPPTCPConnection.access$4100(XMPPTCPConnection.java:130) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1164) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936) java.lang.Thread.run(Thread.java:829) javax.net.ssl.SSLHandshakeException: Could not generate secret sun.security.ssl.KAKeyDerivation.t13DeriveKey(KAKeyDerivation.java:128) sun.security.ssl.KAKeyDerivation.deriveKey(KAKeyDerivation.java:63) sun.security.ssl.ServerHello$T13ServerHelloConsumer.consume(ServerHello.java:1256) sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:990) sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:878) sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443) sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421) sun.security.ssl.TransportContext.dispatch(TransportContext.java:182) sun.security.ssl.SSLTransport.decode(SSLTransport.java:171) sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1418) sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1324) sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411) org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:730) org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1400(XMPPTCPConnection.java:130) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:987) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936) java.lang.Thread.run(Thread.java:829) java.security.InvalidKeyException: cannot identify XDH private key org.bouncycastle.jcajce.provider.asymmetric.edec.KeyAgreementSpi.engineDoPhase(Unknown Source) javax.crypto.KeyAgreement.doPhase(KeyAgreement.java:579) sun.security.ssl.KAKeyDerivation.t13DeriveKey(KAKeyDerivation.java:104) sun.security.ssl.KAKeyDerivation.deriveKey(KAKeyDerivation.java:63) sun.security.ssl.ServerHello$T13ServerHelloConsumer.consume(ServerHello.java:1256) sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:990) sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:878) sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443) sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421) sun.security.ssl.TransportContext.dispatch(TransportContext.java:182) sun.security.ssl.SSLTransport.decode(SSLTransport.java:171) sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1418) sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1324) sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411) org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:730) org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1400(XMPPTCPConnection.java:130) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:987) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913) org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936) java.lang.Thread.run(Thread.java:829) See also bcgit/bc-java#620
1 parent c928758 commit daffd27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sendxmpp

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration
1616

1717
import dev.dirs.ProjectDirectories
1818

19+
// Initialize Smack.
20+
org.jivesoftware.smack.SmackConfiguration.getVersion()
21+
// Remove the BC provider after Smack was initialized.
22+
java.security.Security.removeProvider("BC")
23+
1924
@main
2025
def main(recipient: String, message: String, credfile: String = "auto") {
2126
val recipientJid = JidCreate.from(recipient)

0 commit comments

Comments
 (0)