Changeset d4d7205


Ignore:
Timestamp:
Feb 3, 2016 7:04:46 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3474b827, ebc4ca86
Parents:
6be7c46
Message:

hashCode() and equals() for ElGamalParameterSpec?
comments for I2PProvider

Location:
core/java/src/net/i2p/crypto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/crypto/elgamal/spec/ElGamalParameterSpec.java

    r6be7c46 rd4d7205  
    99 *  use reflection to create a "real" org.bouncycasle.jce.spec.ElGamalParameterSpec.
    1010 *
    11  *  @since 0.9.18
     11 *  @since 0.9.18, moved from net.i2p.crypto in 0.9.25
    1212 */
    1313public class ElGamalParameterSpec implements AlgorithmParameterSpec {
     
    4444        return g;
    4545    }
     46
     47    /**
     48     * @since 0.9.25
     49     */
     50    @Override
     51    public int hashCode() {
     52        return p.hashCode() ^ g.hashCode();
     53    }
     54
     55    /**
     56     * @since 0.9.25
     57     */
     58    @Override
     59    public boolean equals(Object obj) {
     60        if (obj == null)
     61            return false;
     62        BigInteger op, og;
     63        if (obj instanceof ElGamalParameterSpec) {
     64            ElGamalParameterSpec egps = (ElGamalParameterSpec) obj;
     65            op = egps.getP();
     66            og = egps.getG();
     67        //} else if (obj.getClass().getName().equals("org.bouncycastle.jce.spec.ElGamalParameterSpec")) {
     68            //reflection... no...
     69        } else {
     70            return false;
     71        }
     72        return p.equals(op) && g.equals(og);
     73    }
    4674}
  • core/java/src/net/i2p/crypto/provider/I2PProvider.java

    r6be7c46 rd4d7205  
    6565        put("Alg.Alias.KeyPairGenerator.1.3.101.100", "EdDSA");
    6666        put("Alg.Alias.KeyPairGenerator.OID.1.3.101.100", "EdDSA");
     67        // with this setting, keytool keygen doesn't work
     68        // java.security.cert.CertificateException: Signature algorithm mismatch
     69        // it must match the key setting (1.3.101.100) to work
     70        // but this works fine with programmatic cert generation
    6771        put("Alg.Alias.Signature.1.3.101.101", "SHA512withEdDSA");
    6872        put("Alg.Alias.Signature.OID.1.3.101.101", "SHA512withEdDSA");
Note: See TracChangeset for help on using the changeset viewer.