Esempio n. 1
0
  /**
   * Verifies the validity of checksum field
   *
   * @param data the application data
   * @param offset the offset where the data begins
   * @param len the length of the application data
   * @throws GSSException if an error occurs in the checksum calculation
   */
  public final boolean verifySign(byte[] data, int offset, int len) throws GSSException {

    // debug("\t====In verifySign:====\n");
    // debug("\t\t checksum:   [" + getHexBytes(checksum) + "]\n");
    // debug("\t\t data = [" + getHexBytes(data) + "]\n");

    byte[] myChecksum = getChecksum(data, offset, len);
    // debug("\t\t mychecksum: [" + getHexBytes(myChecksum) +"]\n");

    if (MessageDigest.isEqual(checksum, myChecksum)) {
      // debug("\t\t====Checksum PASS:====\n");
      return true;
    }
    return false;
  }