Changeset e8e2396 for apps/ministreaming


Ignore:
Timestamp:
Jan 3, 2014 12:22:44 AM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
41e071e
Parents:
5842e25
Message:
  • Crypto: More implementation for key certs
    • Support i2cp.destination.sigType option in TunnelController? and I2PSocketManagerFactory
    • Fixup of Destination.create() and Destination.size()
    • Add generic off/len methods in DSAEngine, needed for streaming
    • Fixup of sign/verify in streaming Packet
    • Javadocs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java

    r5842e25 re8e2396  
    1515import net.i2p.client.I2PSession;
    1616import net.i2p.client.I2PSessionException;
     17import net.i2p.crypto.SigType;
    1718import net.i2p.util.Log;
    1819
     
    2728    public static final String PROP_MANAGER = "i2p.streaming.manager";
    2829    public static final String DEFAULT_MANAGER = "net.i2p.client.streaming.I2PSocketManagerFull";
    29    
     30
    3031    /**
    3132     * Create a socket manager using a brand new destination connected to the
     
    8081    public static I2PSocketManager createManager(String i2cpHost, int i2cpPort, Properties opts) {
    8182        I2PClient client = I2PClientFactory.createClient();
    82         ByteArrayOutputStream keyStream = new ByteArrayOutputStream(512);
     83        ByteArrayOutputStream keyStream = new ByteArrayOutputStream(1024);
    8384        try {
    84             client.createDestination(keyStream);
     85            client.createDestination(keyStream, getSigType(opts));
    8586            ByteArrayInputStream in = new ByteArrayInputStream(keyStream.toByteArray());
    8687            return createManager(in, i2cpHost, i2cpPort, opts);
     
    169170        if (myPrivateKeyStream == null) {
    170171            I2PClient client = I2PClientFactory.createClient();
    171             ByteArrayOutputStream keyStream = new ByteArrayOutputStream(512);
     172            ByteArrayOutputStream keyStream = new ByteArrayOutputStream(1024);
    172173            try {
    173                 client.createDestination(keyStream);
     174                client.createDestination(keyStream, getSigType(opts));
    174175            } catch (Exception e) {
    175176                throw new I2PSessionException("Error creating keys", e);
     
    258259    }
    259260
     261    /**
     262     *  @param opts may be null
     263     *  @since 0.9.11
     264     */
     265    private static SigType getSigType(Properties opts) {
     266        if (opts != null) {
     267            String st = opts.getProperty(I2PClient.PROP_SIGTYPE);
     268            if (st != null) {
     269                SigType rv = SigType.parseSigType(st);
     270                if (rv != null)
     271                    return rv;
     272                getLog().error("Unsupported sig type " + st);
     273            }
     274        }
     275        return I2PClient.DEFAULT_SIGTYPE;
     276    }
     277
    260278    /** @since 0.9.7 */
    261279    private static Log getLog() {
Note: See TracChangeset for help on using the changeset viewer.