dummy DSA (for sim - dont run on live net)
This commit is contained in:
@ -8,6 +8,7 @@ import net.i2p.client.naming.NamingService;
|
|||||||
import net.i2p.crypto.AESEngine;
|
import net.i2p.crypto.AESEngine;
|
||||||
import net.i2p.crypto.CryptixAESEngine;
|
import net.i2p.crypto.CryptixAESEngine;
|
||||||
import net.i2p.crypto.DSAEngine;
|
import net.i2p.crypto.DSAEngine;
|
||||||
|
import net.i2p.crypto.DummyDSAEngine;
|
||||||
import net.i2p.crypto.DummyElGamalEngine;
|
import net.i2p.crypto.DummyElGamalEngine;
|
||||||
import net.i2p.crypto.ElGamalAESEngine;
|
import net.i2p.crypto.ElGamalAESEngine;
|
||||||
import net.i2p.crypto.ElGamalEngine;
|
import net.i2p.crypto.ElGamalEngine;
|
||||||
@ -373,8 +374,12 @@ public class I2PAppContext {
|
|||||||
}
|
}
|
||||||
private void initializeDSA() {
|
private void initializeDSA() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (_dsa == null)
|
if (_dsa == null) {
|
||||||
|
if ("off".equals(getProperty("i2p.encryption", "on")))
|
||||||
|
_dsa = new DummyDSAEngine(this);
|
||||||
|
else
|
||||||
_dsa = new DSAEngine(this);
|
_dsa = new DSAEngine(this);
|
||||||
|
}
|
||||||
_dsaInitialized = true;
|
_dsaInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
core/java/src/net/i2p/crypto/DummyDSAEngine.java
Normal file
29
core/java/src/net/i2p/crypto/DummyDSAEngine.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package net.i2p.crypto;
|
||||||
|
|
||||||
|
import net.i2p.I2PAppContext;
|
||||||
|
import net.i2p.data.Hash;
|
||||||
|
import net.i2p.data.Signature;
|
||||||
|
import net.i2p.data.SigningPrivateKey;
|
||||||
|
import net.i2p.data.SigningPublicKey;
|
||||||
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.util.NativeBigInteger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stub that offers no authentication.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DummyDSAEngine extends DSAEngine {
|
||||||
|
public DummyDSAEngine(I2PAppContext context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean verifySignature(Signature signature, byte signedData[], SigningPublicKey verifyingKey) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Signature sign(byte data[], SigningPrivateKey signingKey) {
|
||||||
|
Signature sig = new Signature();
|
||||||
|
sig.setData(Signature.FAKE_SIGNATURE);
|
||||||
|
return sig;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user