Examples of DSASignature


Examples of ch.ethz.ssh2.signature.DSASignature

      return RSASHA1Verify.verifySignature(kxs.H, rs, rpk);
    }

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

      log.debug("Verifying ssh-dss signature");

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

Examples of ch.ethz.ssh2.signature.DSASignature

          signature = RSASHA1Verify.encodeSSHRSASignature(rs);
        }

        if (kxs.np.server_host_key_algo.equals("ssh-dss"))
        {
          DSASignature ds = DSASHA1Verify.generateSignature(kxs.H, kxs.local_dsa_key, rnd);
          signature = DSASHA1Verify.encodeSSHDSASignature(ds);
        }

        PacketKexDHReply dhr = new PacketKexDHReply(hostKey, kxs.dhx.getF(), signature);
        tm.sendKexMessage(dhr.getPayload());
View Full Code Here

Examples of com.google.nigori.common.DSASignature

    Nonce nonce = new Nonce(auth.getNonce().toByteArray());
    String serverName = auth.getServerName();
    try {
      byte[] publicKey = database.getPublicKey(publicHash);

      DSASignature sig =
          new DSASignature(dsaR, dsaS, Util.joinBytes(toBytes(serverName), nonce.nt(), nonce.nr(), toBytes(command), Util.joinBytes(payload)));
      try {
        DSAVerify v = new DSAVerify(publicKey);

        if (v.verify(sig)) {
          boolean validNonce = database.checkAndAddNonce(nonce, publicHash);
View Full Code Here

Examples of com.trilead.ssh2.signature.DSASignature

        tw.writeString("ssh-dss");
        tw.writeString(pk_enc, 0, pk_enc.length);

        byte[] msg = tw.getBytes();

        DSASignature ds = DSASHA1Verify.generateSignature(msg, pk, rnd);

        byte[] ds_enc = DSASHA1Verify.encodeSSHDSASignature(ds);

        PacketUserauthRequestPublicKey ua = new PacketUserauthRequestPublicKey("ssh-connection", user,
            "ssh-dss", pk_enc, ds_enc);
View Full Code Here

Examples of com.trilead.ssh2.signature.DSASignature

      return RSASHA1Verify.verifySignature(kxs.H, rs, rpk);
    }

    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.DSASignature

        // Verify the DSA signature
        byte[] r = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
        byte[] s = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
        System.arraycopy(sig, 0, r, 0, Node.SIGNATURE_PARAMETER_LENGTH);
        System.arraycopy(sig, Node.SIGNATURE_PARAMETER_LENGTH, s, 0, Node.SIGNATURE_PARAMETER_LENGTH);
        DSASignature remoteSignature = new DSASignature(new NativeBigInteger(1,r), new NativeBigInteger(1,s));
        // At that point we don't know if it's "him"; let's check it out
        byte[] locallyExpectedExponentials =  assembleDHParams(hisExponential, pn.peerCryptoGroup);

        if(!DSA.verify(pn.peerPubKey, remoteSignature, new NativeBigInteger(1, SHA256.digest(locallyExpectedExponentials)), false)) {
            Logger.error(this, "The signature verification has failed in JFK(2)!! "+pn.getPeer());
View Full Code Here

Examples of freenet.crypt.DSASignature

    if(negType < 9) {
        byte[] r = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
        System.arraycopy(sig, 0, r, 0, Node.SIGNATURE_PARAMETER_LENGTH);
            byte[] s = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
            System.arraycopy(sig, Node.SIGNATURE_PARAMETER_LENGTH, s, 0, Node.SIGNATURE_PARAMETER_LENGTH);
        DSASignature remoteSignature = new DSASignature(new NativeBigInteger(1,r), new NativeBigInteger(1,s));
        if(!DSA.verify(pn.peerPubKey, remoteSignature, new NativeBigInteger(1, SHA256.digest(toVerify)), false)) {
            Logger.error(this, "The signature verification has failed!! JFK(3) - "+pn.getPeer());
            return;
        }
    } else {
View Full Code Here

Examples of freenet.crypt.DSASignature

      if(negType < 9) { // DSA sig    
          byte[] r = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
          System.arraycopy(sig, 0, r, 0, Node.SIGNATURE_PARAMETER_LENGTH);
          byte[] s = new byte[Node.SIGNATURE_PARAMETER_LENGTH];
          System.arraycopy(sig, Node.SIGNATURE_PARAMETER_LENGTH, s, 0, Node.SIGNATURE_PARAMETER_LENGTH);
          DSASignature remoteSignature = new DSASignature(new NativeBigInteger(1,r), new NativeBigInteger(1,s));
          byte[] messageHash = SHA256.digest(locallyGeneratedText);
          if(!DSA.verify(pn.peerPubKey, remoteSignature, new NativeBigInteger(1, messageHash), false)) {
              String error = "The signature verification has failed!! JFK(4) -"+pn.getPeer()+" message hash "+HexUtil.bytesToHex(messageHash)+" length "+locallyGeneratedText.length+" hisRef "+hisRef.length+" hash "+Fields.hashCode(hisRef)+" myRef "+pn.jfkMyRef.length+" hash "+Fields.hashCode(pn.jfkMyRef)+" boot ID "+bootID;
              Logger.error(this, error);
              return true;
View Full Code Here

Examples of freenet.crypt.DSASignature

      // Generate implicit overall hash.
      md256.update(headers, 0, x);
      md256.update(encryptedDataHash);
      byte[] overallHash = md256.digest();
      // Now sign it
      DSASignature sig = DSA.sign(pubKey.getGroup(), privKey, new NativeBigInteger(1, overallHash), r);
      // Pack R and S into 32 bytes each, and copy to headers.

      // Then create and return the ClientSSKBlock.
      byte[] rBuf = truncate(sig.getR().toByteArray(), SSKBlock.SIG_R_LENGTH);
      byte[] sBuf = truncate(sig.getS().toByteArray(), SSKBlock.SIG_S_LENGTH);
      System.arraycopy(rBuf, 0, headers, x, rBuf.length);
      x += rBuf.length;
      System.arraycopy(sBuf, 0, headers, x, sBuf.length);
      x += sBuf.length;
      if (x != SSKBlock.TOTAL_HEADERS_LENGTH)
View Full Code Here

Examples of freenet.crypt.DSASignature

      SHA256.returnMessageDigest(md);
     
      // Now verify it
      NativeBigInteger r = new NativeBigInteger(1, bufR);
      NativeBigInteger s = new NativeBigInteger(1, bufS);
      if(!(DSA.verify(pubKey, new DSASignature(r, s), new NativeBigInteger(1, overallHash), false) ||
          (DSA.verify(pubKey, new DSASignature(r, s), new NativeBigInteger(1, overallHash), true)))) {
        if (dontVerify)
          Logger.error(this, "DSA verification failed with dontVerify!!!!");
        throw new SSKVerifyException("Signature verification failed for node-level SSK");
      }
    } // x isn't verified otherwise so no need to += SIG_R_LENGTH + SIG_S_LENGTH
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.