check rsa server certificates against the ca trust store for the key exchange in use
What changed, and why it matters
This one-line change fixes how Sparrow Wallet checks a Bitcoin server’s TLS certificate. Previously, when the server used an RSA certificate, the app told Java’s certificate validator to expect an old-style RSA key exchange ("RSA"). That was the wrong label for modern TLS connections, which typically use ephemeral Diffie-Hellman with RSA ("ECDHE_RSA"). The mismatch could cause Java to reject valid certificates or, worse, accept weaker validation paths than intended. The fix makes the validation label match the actual key exchange in use, so certificates are checked correctly against the device’s trusted certificate authorities.
Users and downstream packagers should upgrade to a Sparrow release containing this commit. Operators running pre-release builds from source should cherry-pick or merge this change. No configuration change is required; the fix is in the validation path used for CA-validated server TLS connections.
Security signals we found
TLS certificate validation logic changed
X509TrustManager.checkServerTrusted authType corrected
Potential for certificate acceptance/rejection mismatch before fix
Single-character fix in security-critical network code
Evidence from the diff
In TcpOverTlsTransport.isCaValidated(), the authType passed to X509TrustManager.checkServerTrusted() was hardcoded to “RSA” for any non-EC certificate. Modern TLS 1.2/1.3 handshakes using RSA-signed server certificates almost always use an ephemeral ECDHE key exchange, so the correct JSSE authType string is “ECDHE_RSA”, not the legacy “RSA” (which implies static RSA key transport). Passing an incorrect authType can lead the trust manager to select an inappropriate validator or cipher-suite policy, potentially causing certificate rejection or weaker validation. The patch changes the fallback from “RSA” to “ECDHE_RSA” so the authType aligns with the key exchange Sparrow actually uses for TLS.
Changed components
src/main/java/com/sparrowwallet/sparrow/net/TcpOverTlsTransport.javaTLS certificate validation for server connectionsCertificate authority (CA) trust store validationInspect captured patch +1 / −1
### src/main/java/com/sparrowwallet/sparrow/net/TcpOverTlsTransport.java
@@ -213,7 +213,7 @@ private static boolean isCaValidated(Certificate[] certs, HostAndPort server) {
x509Certs[i] = (X509Certificate)certs[i];
}
- String authType = x509Certs[0].getPublicKey().getAlgorithm().equals("EC") ? "ECDHE_ECDSA" : "RSA";
+ String authType = x509Certs[0].getPublicKey().getAlgorithm().equals("EC") ? "ECDHE_ECDSA" : "ECDHE_RSA";
defaultTm.checkServerTrusted(x509Certs, authType);
//Match the hostname as CA validated connections do, so that a certificate saved here can be validated when it is usedWhy this scored 59/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.