Changeset 20452c9


Ignore:
Timestamp:
May 20, 2011 12:46:50 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d6c1202
Parents:
64a7531
Message:
  • Certificate: Fix creation bug; improve router cert generation
Files:
2 edited

Legend:

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

    r64a7531 r20452c9  
    4545
    4646    /**
    47      * Pull from cache or return new
     47     * If null cert, return immutable static instance, else create new
    4848     * @throws AIOOBE if not enough bytes
    4949     * @since 0.8.3
     
    5858            return new Certificate(type, null);
    5959        byte[] payload = new byte[length];
    60         System.arraycopy(data, off = 3, payload, 0, length);
     60        System.arraycopy(data, off + 3, payload, 0, length);
    6161        return new Certificate(type, payload);
    6262    }
  • router/java/src/net/i2p/router/Router.java

    r64a7531 r20452c9  
    540540        return Boolean.valueOf(_context.getProperty(PROP_HIDDEN_HIDDEN)).booleanValue();
    541541    }
     542
     543    /**
     544     *  @return the certificate for a new RouterInfo - probably a null cert.
     545     */
    542546    public Certificate createCertificate() {
    543         Certificate cert = new Certificate();
    544         if (isHidden()) {
    545             cert.setCertificateType(Certificate.CERTIFICATE_TYPE_HIDDEN);
    546             cert.setPayload(null);
    547         } else {
    548             cert.setCertificateType(Certificate.CERTIFICATE_TYPE_NULL);
    549             cert.setPayload(null);
    550         }
    551         return cert;
     547        if (isHidden())
     548            return new Certificate(Certificate.CERTIFICATE_TYPE_HIDDEN, null);
     549        return Certificate.NULL_CERT;
    552550    }
    553551   
Note: See TracChangeset for help on using the changeset viewer.