Changeset a756c12 for core/java


Ignore:
Timestamp:
Feb 4, 2019 9:58:27 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6f75680
Parents:
ead4925
Message:

I2CP: Change format and message type of CreateLeaseSet2 message
to match spec changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/i2cp/CreateLeaseSet2Message.java

    read4925 ra756c12  
    1313import net.i2p.data.DatabaseEntry;
    1414import net.i2p.data.DataFormatException;
     15import net.i2p.data.DataHelper;
    1516import net.i2p.data.EncryptedLeaseSet;
    1617import net.i2p.data.LeaseSet;
     
    4142 */
    4243public class CreateLeaseSet2Message extends CreateLeaseSetMessage {
    43     public final static int MESSAGE_TYPE = 40;
     44    /**
     45     *  NOTE: Preliminary format was type 40 in 0.9.38.
     46     *  Format changed as of 0.9.39, changed type to 41.
     47     */
     48    public final static int MESSAGE_TYPE = 41;
    4449
    4550    // only used if more than one key, otherwise null
     
    119124                        if (etype == null)
    120125                            throw new I2CPMessageException("Unsupported encryption type");
     126                        int encType = (int) DataHelper.readLong(in, 2);
     127                        int encLen = (int) DataHelper.readLong(in, 2);
     128                        if (encType != etype.getCode() || encLen != etype.getPrivkeyLen())
     129                            throw new I2CPMessageException("Enc type mismatch");
    121130                        PrivateKey priv = new PrivateKey(etype);
    122131                        priv.readBytes(in);
     
    157166            if (type != DatabaseEntry.KEY_TYPE_META_LS2) {
    158167                for (PrivateKey pk : getPrivateKeys()) {
     168                    EncType etype = pk.getType();
     169                    DataHelper.writeLong(os, 2, etype.getCode());
     170                    DataHelper.writeLong(os, 2, pk.length());
    159171                    pk.writeBytes(os);
    160172                }
Note: See TracChangeset for help on using the changeset viewer.