Examples of DSAPublicKey


Examples of ch.ethz.ssh2.signature.DSAPublicKey

    }

    if (kxs.np.server_host_key_algo.equals("ssh-dss"))
    {
      DSASignature ds = DSASHA1Verify.decodeSSHDSASignature(sig);
      DSAPublicKey dpk = DSASHA1Verify.decodeSSHDSAPublicKey(hostkey);

      log.log(50, "Verifying ssh-dss signature");

      return DSASHA1Verify.verifySignature(kxs.H, ds, dpk);
    }
View Full Code Here

Examples of com.trilead.ssh2.signature.DSAPublicKey

    }

    if (kxs.np.server_host_key_algo.equals("ssh-dss"))
    {
      DSASignature ds = DSASHA1Verify.decodeSSHDSASignature(sig);
      DSAPublicKey dpk = DSASHA1Verify.decodeSSHDSAPublicKey(hostkey);

      log.log(50, "Verifying ssh-dss signature");

      return DSASHA1Verify.verifySignature(kxs.H, ds, dpk);
    }
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

    if (logMINOR)
      Logger.minor(this, "Getting pubkey: " + HexUtil.bytesToHex(hash));

    if (USE_RAM_PUBKEYS_CACHE) {
      synchronized (cachedPubKeys) {
        DSAPublicKey key = cachedPubKeys.get(w);
        if (key != null) {
          cachedPubKeys.push(w, key);
          if (logMINOR)
            Logger.minor(this, "Got " + HexUtil.bytesToHex(hash) + " from in-memory cache");
          return key;
        }
      }
    }
    try {
      DSAPublicKey key = null;
      if(pubKeyClientcache != null && canReadClientCache)
        key = pubKeyClientcache.fetch(hash, false, false, meta);
      if(node.oldPKClientCache != null && canReadClientCache && key == null) {
        PubkeyStore pks = node.oldPKClientCache;
        if(pks != null) key = pks.fetch(hash, false, false, meta);
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

  public void cacheKey(byte[] hash, DSAPublicKey key, boolean deep, boolean canWriteClientCache, boolean canWriteDatastore, boolean forULPR, boolean writeLocalToDatastore) {
    if (logMINOR)
      Logger.minor(this, "Cache key: " + HexUtil.bytesToHex(hash) + " : " + key);
    ByteArrayWrapper w = new ByteArrayWrapper(hash);
    synchronized (cachedPubKeys) {
      DSAPublicKey key2 = cachedPubKeys.get(w);
      if ((key2 != null) && !key2.equals(key))
        throw new IllegalArgumentException("Wrong hash?? Already have different key with same hash!");
      cachedPubKeys.push(w, key);
      while (cachedPubKeys.size() > MAX_MEMORY_CACHED_PUBKEYS)
        cachedPubKeys.popKey();
    }
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

    byte subtype = (byte)(keyType & 0xFF);
    if(type == NodeCHK.BASE_TYPE) {
      // For CHKs, the subtype is the crypto algorithm.
      return CHKBlock.construct(dataBytes, headersBytes, subtype);
    } else if(type == NodeSSK.BASE_TYPE) {
      DSAPublicKey pubKey;
      try {
        pubKey = new DSAPublicKey(pubkeyBytes);
      } catch (IOException e) {
        throw new KeyVerifyException("Failed to construct pubkey: "+e, e);
      } catch (CryptFormatException e) {
        throw new KeyVerifyException("Failed to construct pubkey: "+e, e);
      }
      NodeSSK key = new NodeSSK(pubKey.asBytesHash(), keyBytes, pubKey, subtype);
      return new SSKBlock(dataBytes, headersBytes, key, false);
    } else {
      throw new KeyVerifyException("No such key type "+Integer.toHexString(type));
    }
  }
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

    if (key instanceof NodeCHK) {
      kb = fetch(key, false, canReadClientCache, canWriteClientCache, canWriteDatastore, null);
    } else if (key instanceof NodeSSK) {
      NodeSSK sskKey = (NodeSSK) key;
      DSAPublicKey pubKey = sskKey.getPubKey();
      if (pubKey == null) {
        pubKey = getPubKey.getKey(sskKey.getPubKeyHash(), canReadClientCache, offersOnly, null);
        if (logMINOR)
          Logger.minor(this, "Fetched pubkey: " + pubKey);
        try {
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

    else
      throw new IllegalStateException("Don't know what to do with "+key);
  }

  public ClientKeyBlock fetch(ClientSSK clientSSK, boolean canReadClientCache, boolean canWriteClientCache, boolean canWriteDatastore) throws SSKVerifyException {
    DSAPublicKey key = clientSSK.getPubKey();
    if(key == null) {
      key = getPubKey.getKey(clientSSK.pubKeyHash, canReadClientCache, false, null);
    }
    if(key == null) return null;
    clientSSK.setPublicKey(key);
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

      } 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) {
        throw new Error(e);
      }
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

  }
 
  public InsertableClientSSK getInsertableSSK(String string) {
    try {
      return new InsertableClientSSK(string, pubKeyHash,
          new DSAPublicKey(getCryptoGroup(), privKey), privKey, cryptoKey, cryptoAlgorithm);
    } catch (MalformedURLException e) {
      Logger.error(this, "Caught "+e+" should not be possible in USK.getSSK", e);
      throw new Error(e);
    }
  }
View Full Code Here

Examples of freenet.crypt.DSAPublicKey

    } catch(IllegalArgumentException e) {
      // DSAPrivateKey is invalid
      Logger.error(InsertableClientSSK.class, "Caught "+e, e);
      throw new MalformedURLException("SSK private key (routing key) is invalid: " + e);
    }
    DSAPublicKey pubKey = new DSAPublicKey(g, privKey);
    byte[] pkHash = pubKey.asBytesHash();
    return new InsertableClientSSK(uri.getDocName(), pkHash, pubKey, privKey, uri.getCryptoKey(), keyType);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.