Skip to content

Commit 9d72891

Browse files
committed
net: create I2P sessions with both ECIES-X25519 and ElGamal encryption
A Bitcoin Core node may only connect to a peer destination via I2P if both sides have sessions with the same encryption type. The encryption type is a property of the session, not the destination. Sessions may support multiple encryption types. As Bitcoin Core is not currently setting the I2P encryption type when creating sessions, it is using the older default, ElGamal (type 0). This pull updates Bitcoin Core to use both ECIES-X25519 and ElGamal (types 4 and 0, respectively). This allows to connect to I2P peers with either type, and the newer, faster ECIES-X25519 will be preferred. See also the recently updated section "Signature and Encryption Types" in https://geti2p.net/en/docs/api/samv3 Thanks and credit to zzzi2p (https://github.com/zzzi2p) for reporting. Closes bitcoin/bitcoin#29197.
1 parent 82ba0f8 commit 9d72891

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/i2p.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ void Session::CreateIfNotCreatedAlready()
427427
const Reply& reply = SendRequestAndGetReply(
428428
*sock,
429429
strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=TRANSIENT SIGNATURE_TYPE=7 "
430-
"inbound.quantity=1 outbound.quantity=1",
430+
"i2cp.leaseSetEncType=4,0 inbound.quantity=1 outbound.quantity=1",
431431
session_id));
432432

433433
m_private_key = DecodeI2PBase64(reply.Get("DESTINATION"));
@@ -445,7 +445,7 @@ void Session::CreateIfNotCreatedAlready()
445445

446446
SendRequestAndGetReply(*sock,
447447
strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=%s "
448-
"inbound.quantity=3 outbound.quantity=3",
448+
"i2cp.leaseSetEncType=4,0 inbound.quantity=3 outbound.quantity=3",
449449
session_id,
450450
private_key_b64));
451451
}

0 commit comments

Comments
 (0)