import, @since

This commit is contained in:
zzz
2014-08-29 13:40:53 +00:00
parent c318760398
commit 5decf18eb5
20 changed files with 49 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ import java.security.interfaces.ECKey;
import java.security.interfaces.RSAKey; import java.security.interfaces.RSAKey;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.crypto.eddsa.EdDSAEngine;
import net.i2p.crypto.eddsa.EdDSAKey; import net.i2p.crypto.eddsa.EdDSAKey;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.Signature; import net.i2p.data.Signature;
@@ -517,7 +518,7 @@ public class DSAEngine {
java.security.Signature jsig; java.security.Signature jsig;
if (type.getBaseAlgorithm() == SigAlgo.EdDSA) if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
jsig = new net.i2p.crypto.eddsa.EdDSAEngine(type.getDigestInstance()); jsig = new EdDSAEngine(type.getDigestInstance());
else else
jsig = java.security.Signature.getInstance(type.getAlgorithmName()); jsig = java.security.Signature.getInstance(type.getAlgorithmName());
PublicKey pubKey = SigUtil.toJavaKey(verifyingKey); PublicKey pubKey = SigUtil.toJavaKey(verifyingKey);
@@ -566,7 +567,7 @@ public class DSAEngine {
String algo = getRawAlgo(type); String algo = getRawAlgo(type);
java.security.Signature jsig; java.security.Signature jsig;
if (type.getBaseAlgorithm() == SigAlgo.EdDSA) if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
jsig = new net.i2p.crypto.eddsa.EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification. jsig = new EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
else else
jsig = java.security.Signature.getInstance(algo); jsig = java.security.Signature.getInstance(algo);
jsig.initVerify(pubKey); jsig.initVerify(pubKey);
@@ -608,7 +609,7 @@ public class DSAEngine {
java.security.Signature jsig; java.security.Signature jsig;
if (type.getBaseAlgorithm() == SigAlgo.EdDSA) if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
jsig = new net.i2p.crypto.eddsa.EdDSAEngine(type.getDigestInstance()); jsig = new EdDSAEngine(type.getDigestInstance());
else else
jsig = java.security.Signature.getInstance(type.getAlgorithmName()); jsig = java.security.Signature.getInstance(type.getAlgorithmName());
PrivateKey privKey = SigUtil.toJavaKey(privateKey); PrivateKey privKey = SigUtil.toJavaKey(privateKey);
@@ -651,7 +652,7 @@ public class DSAEngine {
java.security.Signature jsig; java.security.Signature jsig;
if (type.getBaseAlgorithm() == SigAlgo.EdDSA) if (type.getBaseAlgorithm() == SigAlgo.EdDSA)
jsig = new net.i2p.crypto.eddsa.EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification. jsig = new EdDSAEngine(); // Ignore algo, EdDSAKey includes a hash specification.
else else
jsig = java.security.Signature.getInstance(algo); jsig = java.security.Signature.getInstance(algo);
jsig.initSign(privKey, _context.random()); jsig.initSign(privKey, _context.random());

View File

@@ -16,6 +16,7 @@ import net.i2p.crypto.eddsa.math.GroupElement;
import net.i2p.crypto.eddsa.math.ScalarOps; import net.i2p.crypto.eddsa.math.ScalarOps;
/** /**
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -4,6 +4,8 @@ import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
/** /**
* Common interface for all EdDSA keys. * Common interface for all EdDSA keys.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -8,6 +8,8 @@ import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
/** /**
* An EdDSA private key. * An EdDSA private key.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -8,6 +8,8 @@ import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
/** /**
* An EdDSA public key. * An EdDSA public key.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -12,6 +12,7 @@ import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec; import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
/** /**
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -17,6 +17,8 @@ import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
/** /**
* Default strength is 256 * Default strength is 256
*
* @since 0.9.15
*/ */
public class KeyPairGenerator extends KeyPairGeneratorSpi { public class KeyPairGenerator extends KeyPairGeneratorSpi {
private static final int DEFAULT_STRENGTH = 256; private static final int DEFAULT_STRENGTH = 256;

View File

@@ -1,6 +1,10 @@
package net.i2p.crypto.eddsa; package net.i2p.crypto.eddsa;
/** /**
* Basic utilities for eddsa.
* Not for external use, not maintained as a public API.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -5,6 +5,8 @@ import java.io.Serializable;
/** /**
* A twisted Edwards curve. * A twisted Edwards curve.
* Points on the curve satisfy -x^2 + y^2 = 1 + d x^2y^2 * Points on the curve satisfy -x^2 + y^2 = 1 + d x^2y^2
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -3,6 +3,8 @@ package net.i2p.crypto.eddsa.math;
/** /**
* Common interface for all (b-1)-bit encodings of elements * Common interface for all (b-1)-bit encodings of elements
* of EdDSA finite fields. * of EdDSA finite fields.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -4,6 +4,8 @@ import java.io.Serializable;
/** /**
* An EdDSA finite field. Includes several pre-computed values. * An EdDSA finite field. Includes several pre-computed values.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -1,5 +1,10 @@
package net.i2p.crypto.eddsa.math; package net.i2p.crypto.eddsa.math;
/**
*
* @since 0.9.15
*
*/
public abstract class FieldElement { public abstract class FieldElement {
protected final Field f; protected final Field f;

View File

@@ -6,6 +6,8 @@ import net.i2p.crypto.eddsa.Utils;
/** /**
* A point (x,y) on an EdDSA curve. * A point (x,y) on an EdDSA curve.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -1,5 +1,10 @@
package net.i2p.crypto.eddsa.math; package net.i2p.crypto.eddsa.math;
/**
*
* @since 0.9.15
*
*/
public interface ScalarOps { public interface ScalarOps {
/** /**
* Reduce the given scalar mod l. * Reduce the given scalar mod l.

View File

@@ -5,6 +5,8 @@ import java.security.spec.AlgorithmParameterSpec;
/** /**
* Implementation of AlgorithmParameterSpec that holds the name of a named * Implementation of AlgorithmParameterSpec that holds the name of a named
* EdDSA curve specification. * EdDSA curve specification.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -6,6 +6,8 @@ import net.i2p.crypto.eddsa.math.ScalarOps;
/** /**
* EdDSA Curve specification that can also be referred to by name. * EdDSA Curve specification that can also be referred to by name.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -10,6 +10,8 @@ import net.i2p.crypto.eddsa.math.ed25519.Ed25519ScalarOps;
/** /**
* The named EdDSA curves. * The named EdDSA curves.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -12,6 +12,8 @@ import java.io.Serializable;
/** /**
* Parameter specification for an EdDSA algorithm. * Parameter specification for an EdDSA algorithm.
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -8,6 +8,8 @@ import java.util.Arrays;
import net.i2p.crypto.eddsa.math.GroupElement; import net.i2p.crypto.eddsa.math.GroupElement;
/** /**
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */

View File

@@ -5,6 +5,8 @@ import java.security.spec.KeySpec;
import net.i2p.crypto.eddsa.math.GroupElement; import net.i2p.crypto.eddsa.math.GroupElement;
/** /**
*
* @since 0.9.15
* @author str4d * @author str4d
* *
*/ */