forked from I2P_Developers/i2p.i2p
NetDB: Disallow RSA for RI or LS
This commit is contained in:
@ -13,6 +13,8 @@ import java.util.Arrays;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.crypto.DSAEngine;
|
||||
import net.i2p.crypto.SigAlgo;
|
||||
import net.i2p.crypto.SigType;
|
||||
|
||||
/**
|
||||
*<p>
|
||||
@ -206,6 +208,12 @@ public abstract class DatabaseEntry extends DataStructureImpl {
|
||||
if (data == null)
|
||||
return false;
|
||||
// if the data is non-null the SPK will be non-null
|
||||
return DSAEngine.getInstance().verifySignature(_signature, data, getSigningPublicKey());
|
||||
SigningPublicKey spk = getSigningPublicKey();
|
||||
SigType type = spk.getType();
|
||||
// As of 0.9.28, disallow RSA as it's so slow it could be
|
||||
// used as a DoS
|
||||
if (type == null || type.getBaseAlgorithm() == SigAlgo.RSA)
|
||||
return false;
|
||||
return DSAEngine.getInstance().verifySignature(_signature, data, spk);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user