Package freenet.crypt

Examples of freenet.crypt.DSAPrivateKey


        keywordHash = md256.digest(keyword.getBytes("UTF-8"));
      } catch (UnsupportedEncodingException e) {
        throw new Error("Impossible: JVM doesn't support UTF-8: " + e, e);
      }
      MersenneTwister mt = new MersenneTwister(keywordHash);
      DSAPrivateKey privKey = new DSAPrivateKey(Global.DSAgroupBigA, mt);
      DSAPublicKey pubKey = new DSAPublicKey(Global.DSAgroupBigA, privKey);
      byte[] pubKeyHash = md256.digest(pubKey.asBytes());
      try {
        return new ClientKSK(keyword, pubKeyHash, pubKey, privKey, keywordHash);
      } catch (MalformedURLException e) {
View Full Code Here


    // However, we recommend that you not use this, especially not for a freesite, as
    // SSK@blah,blah,blah//filename is confusing for clients, browsers etc.
    if(uri.getDocName() == null)
      throw new MalformedURLException("SSK URIs must have a document name (to avoid ambiguity)");
    DSAGroup g = Global.DSAgroupBigA;
    DSAPrivateKey privKey;
    try {
      privKey = new DSAPrivateKey(new NativeBigInteger(1, uri.getRoutingKey()), g);
    } catch(IllegalArgumentException e) {
      // DSAPrivateKey is invalid
      Logger.error(InsertableClientSSK.class, "Caught "+e, e);
      throw new MalformedURLException("SSK private key (routing key) is invalid: " + e);
    }
View Full Code Here

  public static InsertableClientSSK createRandom(RandomSource r, String docName) {
    byte[] ckey = new byte[CRYPTO_KEY_LENGTH];
    r.nextBytes(ckey);
    DSAGroup g = Global.DSAgroupBigA;
    DSAPrivateKey privKey = new DSAPrivateKey(g, r);
    DSAPublicKey pubKey = new DSAPublicKey(g, privKey);
    try {
      byte[] pkHash = SHA256.digest(pubKey.asBytes());
      return new InsertableClientSSK(docName, pkHash, pubKey, privKey, ckey,
          Key.ALGO_AES_PCFB_256_SHA256);
View Full Code Here

    new RAMFreenetStore<DSAPublicKey>(pk, keys);
    DSAGroup group = Global.DSAgroupBigA;
    Random random = new MersenneTwister(1010101);
    HashMap<ByteArrayWrapper, DSAPublicKey> map = new HashMap<ByteArrayWrapper, DSAPublicKey>();
    for(int i=0;i<keys;i++) {
      DSAPrivateKey privKey = new DSAPrivateKey(group, random);
      DSAPublicKey key = new DSAPublicKey(group, privKey);
      byte[] hash = key.asBytesHash();
      ByteArrayWrapper w = new ByteArrayWrapper(hash);
      map.put(w, key.cloneKey());
      pk.put(hash, key, false);
View Full Code Here

    GetPubkey pubkeys = new SimpleGetPubkey(pk);
    DSAGroup group = Global.DSAgroupBigA;
    Random random = new MersenneTwister(1010101);
    HashMap<ByteArrayWrapper, DSAPublicKey> map = new HashMap<ByteArrayWrapper, DSAPublicKey>();
    for(int i=0;i<keys;i++) {
      DSAPrivateKey privKey = new DSAPrivateKey(group, random);
      DSAPublicKey key = new DSAPublicKey(group, privKey);
      byte[] hash = key.asBytesHash();
      ByteArrayWrapper w = new ByteArrayWrapper(hash);
      map.put(w, key.cloneKey());
      pubkeys.cacheKey(hash, key, false, false, false, false, false);
View Full Code Here

   
    final int CRYPTO_KEY_LENGTH = 32;
    byte[] ckey = new byte[CRYPTO_KEY_LENGTH];
    random.nextBytes(ckey);
    DSAGroup g = Global.DSAgroupBigA;
    DSAPrivateKey privKey = new DSAPrivateKey(g, random);
    DSAPublicKey pubKey = new DSAPublicKey(g, privKey);
    byte[] pkHash = SHA256.digest(pubKey.asBytes());
    String docName = "myDOC";
    InsertableClientSSK ik = new InsertableClientSSK(docName, pkHash, pubKey, privKey, ckey, Key.ALGO_AES_PCFB_256_SHA256);
   
View Full Code Here

   
    final int CRYPTO_KEY_LENGTH = 32;
    byte[] ckey = new byte[CRYPTO_KEY_LENGTH];
    random.nextBytes(ckey);
    DSAGroup g = Global.DSAgroupBigA;
    DSAPrivateKey privKey = new DSAPrivateKey(g, random);
    DSAPublicKey pubKey = new DSAPublicKey(g, privKey);
    byte[] pkHash = SHA256.digest(pubKey.asBytes());
    String docName = "myDOC";
    InsertableClientSSK ik = new InsertableClientSSK(docName, pkHash, pubKey, privKey, ckey, Key.ALGO_AES_PCFB_256_SHA256);
   
View Full Code Here

   * Create the cryptographic keys etc from scratch
   */
  public void initCrypto() {
    MessageDigest md = SHA256.getMessageDigest();
    cryptoGroup = Global.DSAgroupBigA;
    privKey = new DSAPrivateKey(cryptoGroup, random);
    pubKey = new DSAPublicKey(cryptoGroup, privKey);
    myARK = InsertableClientSSK.createRandom(random, "ark");
    myARKNumber = 0;
    SHA256.returnMessageDigest(md);
    clientNonce = new byte[32];
View Full Code Here

TOP

Related Classes of freenet.crypt.DSAPrivateKey

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.