Package net.i2p.util

Examples of net.i2p.util.NativeBigInteger


    fs.putSingle("y", Base64.encode(y.toByteArray()));
    return fs;
  }

  public static DSAPublicKey create(SimpleFieldSet set, DSAGroup group) throws FSParseException {
    NativeBigInteger x;
    try {
      x = new NativeBigInteger(1, Base64.decode(set.get("y")));
    } catch (IllegalBase64Exception e) {
      throw new FSParseException(e);
    }
    try {
      return new DSAPublicKey(group, x);
View Full Code Here


    Logger.normal(DiffieHellman.class, "DiffieHellman had to generate a parameter on thread! (report if that happens often)");
    return genParams();
  }

  private static NativeBigInteger[] genParams() {
    NativeBigInteger params[] = new NativeBigInteger[2];
    // Don't need NativeBigInteger?
   
    do {
      params[0] = new NativeBigInteger(256, r);
      params[1] = (NativeBigInteger) group.getG().modPow(params[0], group.getP());
    } while(!DiffieHellman.checkDHExponentialValidity(DiffieHellman.class, params[1]));
   
    return params;
  }
View Full Code Here

  }

  public static CryptoKey readFromField(String field) {
    BigInteger p, g;
    StringTokenizer str = new StringTokenizer(field, ",");
    p = new NativeBigInteger(1, HexUtil.hexToBytes(str.nextToken()));
    g = new NativeBigInteger(1, HexUtil.hexToBytes(str.nextToken()));
    return new DHGroup(p, g);
  }
View Full Code Here

  }

  /** Sign a hash */
  byte[] sign(byte[] hash) {
        byte[] sig = new byte[Node.SIGNATURE_PARAMETER_LENGTH*2];
        DSASignature s = DSA.sign(cryptoGroup, privKey, new NativeBigInteger(1, hash), random);
        System.arraycopy(s.getRBytes(Node.SIGNATURE_PARAMETER_LENGTH), 0, sig, 0, Node.SIGNATURE_PARAMETER_LENGTH);
        System.arraycopy(s.getSBytes(Node.SIGNATURE_PARAMETER_LENGTH), 0, sig, Node.SIGNATURE_PARAMETER_LENGTH, Node.SIGNATURE_PARAMETER_LENGTH);
    return sig;
  }
View Full Code Here

TOP

Related Classes of net.i2p.util.NativeBigInteger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.