IRCaBot 2.1.0
GPLv3 © acetone, 2021-2022
#i2p-dev
/2022/03/28
mesh zzz: what exactly is the purpose of PrivateKeyFile?
mesh alright so Destination.writeBytes certainly does not do what I thought it does
zzz w00ty w00t we're getting back into debian
zzz mesh, PKF is to store private keys :)
eche|off ohh, good with Debian
zzz only 0.9.48 again, but baby steps, I found the right mailing linst
mesh zzz: hey? Can I ask you about PrivateKeyFile?
zzz shoot
mesh zzz: what is the right way to turn the keystream created by I2PClient.createDestination back into a Destination?
mesh I noticed this ctor in PrivateKeyFile:
mesh public PrivateKeyFile(InputStream in) throws I2PSessionException { this("/dev/null"); I2PSession s = this.client.createSession(in, new Properties()); this.dest = s.getMyDestination();
mesh this.privKey = s.getDecryptionKey();
mesh this.signingPrivKey = s.getPrivateKey();
mesh is that the right way? To actually create an I2PSession?
zzz that's a low-level way to do it, yes
mesh zzz: is there a better way?
zzz for a socket-oriented app, you'll want to use the higher-level I2PSocketManagerFactory
zzz which creates a session underneath
mesh zzz: what method in I2PSocketManager takes a keystream and returns the Destination?
zzz several methods take an input stream. all methods return a I2PSocketManager, from there you can get the session and the destination
mesh oh you're talking about the factory class, the I2PSocketManagerFactory
zzz if you don't want a session, you just want to "know" what the destination is, you can use Destination.readBytes(InputStream)
zzz right
zzz you can only make a I2PSocketManager via the factory
zzz it's just an interface
mesh I see, so the expected behavior is people should save KeyStreams and then use them to create I2PSocketManagers
mesh zzz: if I do use I2PClient.createSession(InputStream) ... are there any side effects? This doesn't actually connect to the router? Can I just call I2PSession.destroySession and then discard the Session once I have the Destination?
zzz that would be a little messy. If you just want to get a destination from the keystream, use Destination.readBytes()
mesh zzz: that is guaranteed to always work, even with stuff like encrypted leasesets?
zzz if you want a persistent destination, save the keystream to a file, then feed it back to the socket manager factory every time you start up
zzz yes guaranteed, destinations are not leasesets, you need to know your own destination, LS encryption happens somewhere else
mesh zzz: yeah I figured that out eventually. I think I need to know my Destination before I actually create the I2PSocketManager and connect so I'll give Destination.readBytes a shot.
mesh zzz: the Certificate parameter is interesting. Is there any example code out there that shows how to create Certs?
zzz you don't want to do that, you want to specify a sig type
mesh zzz: wouldn't the Certificate be useful to prove that I own a Destination?
zzz no, that's not how it works
mesh ah ok.
zzz you're thinking of X509 certificates. Certificates in Destinations are something else entirely
zzz net.i2p.data.Certificate, not java.security.Certificate
mesh zzz: ok. Do you think it's a good idea to listen for connections (be a server) and also connect to other peers (be a client) using the same I2PSocketManager?
zlatinb that's what I do in muwire
zzz that's the common paradigm for a peer-to-peer application. For a non-p2p app, it depends on the threat model
mesh zlatinb: you use a single SocketManager as a server and a client?
mesh ok, thanks, good to know
mesh my goal is to have multiple services (listening on different "ports") and clients share the same SocketManager but I was worried about threading and stuff like that
RN Is this error worth looking into? -
RN ERROR [CP Reader 25] .client.ClientConnectionRunner: Disconnecting the client - java.io.EOFException: EOF reading 4 byte value