ciao ho studiato la teoria delle curve ellittiche e adesso devo applicarle in Java usando bouncycastle provider.
Ho trovato nel web alcuni esempi , ma non riesco a capire quale sia quello più efficace poichè mi è stato detto che la curva deve essere generata casualmente e anche se ho studiato la teoria delle curve ellittiche , qui in crittografia mi rimangono dei dubbi. che cosa significa che una chiave ecc da 192bit è efficace come una rsa da 2048 bit?è inteso come la dimensione del campo finito o della chiave pubblica o privata ? in tal caso come posso sapere e/o scegliere le dimensioni delle coppie di chiavi?
qual'è secondo voi dei 3 esempi quello più efficace (anche come casualità e sicurezza) ?

grazie




codice:
ECCurve.Fp curve = new ECCurve.Fp( new BigInteger("6277101735386680763835789423207666416083908700390324961279"), new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16));

ECDomainParameters params = new ECDomainParameters( curve, curve.decodePoint(Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G new BigInteger ("6277101735386680763835789423176059013767194773182842284081")); // n


  ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
        new BigInteger("651056770906015076056810763456358567190100156695615665659"), // d
        params);

    ECPublicKeyParameters pubKey = new ECPublicKeyParameters(
        curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q
        params); 

    AsymmetricCipherKeyPair  p1 = new AsymmetricCipherKeyPair(pubKey, priKey);
    AsymmetricCipherKeyPair  p2 = new AsymmetricCipherKeyPair(pubKey,priKey);








codice:
ECKeyPairGenerator gen = new ECKeyPairGenerator();
           SecureRandom var = new SecureRandom();
          //X9ECParameters cb = SECNamedCurves.getByName("secp256k1");
           //da scegluiere a seconda del tipo di curva
          X9ECParameters c = X962NamedCurves.getByName("prime256v1");
          ECDomainParameters param = new ECDomainParameters(c.getCurve(), c.getG(), c.getN(), c.getH());
          ECKeyGenerationParameters kg = new ECKeyGenerationParameters(param, var);
          gen.init(kg);
          AsymmetricCipherKeyPair  p1b = gen.generateKeyPair() ;
          AsymmetricCipherKeyPair  p2b = gen.generateKeyPair() ;`




codice:
`SecureRandom PRNG = SecureRandom.getInstance("SHA256PRNG");`
//this i take from cryptosms 

          int NONCE_SIZE = 64;  
          int PRIV_KEY_SIZE = 64;
          BigInteger privNum = new BigInteger(PRNG
                    .generateSeed(NONCE_SIZE)).abs(); // select k

           ECCurve cFp256v1 = new ECCurve.Fp(
                    new BigInteger("115792089210356248762697446949407573530086143415290314195533631308867097853951"),
                    new BigInteger("ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", 16),
                    new BigInteger("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16));

               /**  X9ECParameters prime256v1b = new X9ECParameters(
                    cFp256v1,
                    cFp256v1.decodePoint(
                        Hex.decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")),
                    new BigInteger("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 16),
                    BigInteger.valueOf(1),
                    Hex.decode("c49d360886e704936a6678e1139d26b7819f7e90"));*/


                 ECDomainParameters prime256v1 = new ECDomainParameters(
                         cFp256v1,
                         cFp256v1
                                .decodePoint(Hex
                                        .decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")),
                        new BigInteger("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",
                                16), BigInteger.valueOf(1), Hex
                        .decode("c49d360886e704936a6678e1139d26b7819f7e90"));

          ECPrivateKeyParameters priv3 = new ECPrivateKeyParameters(privNum,
                  prime256v1);
          ECPublicKeyParameters pb3 = generatePublicKey (priv3 );`