Changeset b37160fa
- Timestamp:
- Feb 21, 2019 2:19:38 PM (2 years ago)
- Branches:
- master
- Children:
- 9fafc25
- Parents:
- 7fbe1ce
- Location:
- core/java/src/net/i2p
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
core/java/src/net/i2p/crypto/Blinding.java
r7fbe1ce rb37160fa 40 40 41 41 /** 42 * Only for SigType EdDSA_SHA512_Ed25519.42 * Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519. 43 43 * 44 * @param key must be SigType EdDSA_SHA512_Ed25519 44 * @param key must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519 45 45 * @param alpha must be SigType RedDSA_SHA512_Ed25519 46 46 * @return SigType RedDSA_SHA512_Ed25519 … … 49 49 */ 50 50 public static SigningPublicKey blind(SigningPublicKey key, SigningPrivateKey alpha) { 51 if (key.getType() != TYPE || alpha.getType() != TYPER) 51 SigType type = key.getType(); 52 if ((type != TYPE && type != TYPER) || 53 alpha.getType() != TYPER) 52 54 throw new UnsupportedOperationException(); 53 55 try { … … 62 64 63 65 /** 64 * Only for SigType EdDSA_SHA512_Ed25519.66 * Only for SigTypes EdDSA_SHA512_Ed25519 and RedDSA_SHA512_Ed25519. 65 67 * 66 * @param key must be SigType EdDSA_SHA512_Ed25519 68 * @param key must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519 67 69 * @param alpha must be SigType RedDSA_SHA512_Ed25519 68 70 * @return SigType RedDSA_SHA512_Ed25519 … … 71 73 */ 72 74 public static SigningPrivateKey blind(SigningPrivateKey key, SigningPrivateKey alpha) { 73 if (key.getType() != TYPE || alpha.getType() != TYPER) 75 SigType type = key.getType(); 76 if ((type != TYPE && type != TYPER) || 77 alpha.getType() != TYPER) 74 78 throw new UnsupportedOperationException(); 75 79 try { … … 123 127 /** 124 128 * Generate alpha for the given time. 125 * Only for SigType EdDSA_SHA512_Ed25519 .129 * Only for SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519. 126 130 * 127 * @param dest spk must be SigType EdDSA_SHA512_Ed25519 131 * @param dest spk must be SigType EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519 128 132 * @param secret may be null or zero-length 129 133 * @param now for what time? -
core/java/src/net/i2p/crypto/KeyGenerator.java
r7fbe1ce rb37160fa 36 36 import net.i2p.crypto.eddsa.EdDSAPrivateKey; 37 37 import net.i2p.crypto.eddsa.EdDSAPublicKey; 38 import net.i2p.crypto.eddsa.RedKeyPairGenerator; 38 39 import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec; 39 40 import net.i2p.crypto.provider.I2PProvider; … … 290 291 java.security.KeyPair kp; 291 292 if (type.getBaseAlgorithm() == SigAlgo.EdDSA) { 292 net.i2p.crypto.eddsa.KeyPairGenerator kpg = new net.i2p.crypto.eddsa.KeyPairGenerator(); 293 net.i2p.crypto.eddsa.KeyPairGenerator kpg; 294 if (type == SigType.RedDSA_SHA512_Ed25519) 295 kpg = new RedKeyPairGenerator(); 296 else 297 kpg = new net.i2p.crypto.eddsa.KeyPairGenerator(); 293 298 kpg.initialize(type.getParams(), _context.random()); 294 299 kp = kpg.generateKeyPair(); -
core/java/src/net/i2p/crypto/SU3File.java
r7fbe1ce rb37160fa 674 674 if (!t.isAvailable()) 675 675 continue; 676 if (t == SigType.EdDSA_SHA512_Ed25519) 676 if (t == SigType.EdDSA_SHA512_Ed25519 || 677 t == SigType.RedDSA_SHA512_Ed25519) 677 678 continue; // not supported by keytool, and does double hashing right now 678 679 buf.append(" ").append(t).append("\t(code: ").append(t.getCode()).append(')'); -
core/java/src/net/i2p/crypto/eddsa/EdDSAPrivateKey.java
r7fbe1ce rb37160fa 72 72 73 73 /** 74 * Returns the p ublickey in its canonical encoding.74 * Returns the private key in its canonical encoding. 75 75 *<p> 76 76 * This implements the following specs: -
core/java/src/net/i2p/crypto/eddsa/KeyPairGenerator.java
r7fbe1ce rb37160fa 22 22 * @since 0.9.15 23 23 */ 24 public finalclass KeyPairGenerator extends KeyPairGeneratorSpi {25 pr ivatestatic final int DEFAULT_KEYSIZE = 256;26 pr ivateEdDSAParameterSpec edParams;27 pr ivateSecureRandom random;28 pr ivateboolean initialized;24 public class KeyPairGenerator extends KeyPairGeneratorSpi { 25 protected static final int DEFAULT_KEYSIZE = 256; 26 protected EdDSAParameterSpec edParams; 27 protected SecureRandom random; 28 protected boolean initialized; 29 29 30 30 private static final Hashtable<Integer, AlgorithmParameterSpec> edParameters; -
core/java/src/net/i2p/data/EncryptedLeaseSet.java
r7fbe1ce rb37160fa 83 83 * Overridden to set the blinded key 84 84 * 85 * @param dest non-null, must be EdDSA_SHA512_Ed25519 85 * @param dest non-null, must be EdDSA_SHA512_Ed25519 or RedDSA_SHA512_Ed25519 86 86 * @throws IllegalStateException if already signed 87 87 * @throws IllegalArgumentException if not EdDSA … … 91 91 super.setDestination(dest); 92 92 SigningPublicKey spk = dest.getSigningPublicKey(); 93 if (spk.getType() != SigType.EdDSA_SHA512_Ed25519) 93 SigType type = spk.getType(); 94 if (type != SigType.EdDSA_SHA512_Ed25519 && 95 type != SigType.RedDSA_SHA512_Ed25519) 94 96 throw new IllegalArgumentException(); 95 97 SigningPublicKey bpk = blind();
Note: See TracChangeset
for help on using the changeset viewer.