Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkYP9-0002tw-Hz for pgsql-jdbc@arkaria.postgresql.org; Mon, 08 Jul 2019 18:30:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkYP7-0007hJ-G4 for pgsql-jdbc@arkaria.postgresql.org; Mon, 08 Jul 2019 18:30:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkYP7-0007cA-5o for pgsql-jdbc@lists.postgresql.org; Mon, 08 Jul 2019 18:30:21 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkYP3-0003Xn-21 for pgsql-jdbc@postgresql.org; Mon, 08 Jul 2019 18:30:20 +0000 Received: by mail-wm1-x335.google.com with SMTP id 207so502667wma.1 for ; Mon, 08 Jul 2019 11:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ongres.com; s=gsuite; h=to:from:subject:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=26tAhGna7yjDDk83M59mKIc76RmNkUq1KNa/WxkDbVw=; b=rlATnmOkvP8U44htsdeJAyCP+1FV/bX3dUOhQzdelCDL7D/AI0MdHQSnr70LtZRu7F h+ohPzBRGIAoOG+IQ92Ka0BexxN/5fyh0p9RhEhkN90CpREsUeYeoAwOX/fbe35Pujxp XmPHfMsp1SMFc8hzeLOQj1VspOL+JDCcap+18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=26tAhGna7yjDDk83M59mKIc76RmNkUq1KNa/WxkDbVw=; b=nGb6mD5v//6TC4aaawGyqjNnwFqyknlCsMOhpfmBQWvCn2GTEXO2Y22p874as4/mo6 iFb9LxHulv+KSuEUhuOoPtlLZqf7eMe2CjRsuz7gYayv/W/VkptcDjzpq0sJhNiOw/bq 0PKA7A+sXB8VBkGsCEDSiIW06fEBJ/g4JADgyjSQvKwLCd1CzjoHEGqXdSYECf94vDg7 BhVhyUEAfhYLCcmYiv6LrUX4EOJXRutqBp/K87DXUbdarV4XqY6a/QcI+LAh3CNP3JKB pyNXthISKLb7E65TjGfEEETSxzXbbZZzUY9IIsGyT+L6zIROevAS3V9S68wsIgmNBriB f04w== X-Gm-Message-State: APjAAAW7iwS/iJUIEyRO/+gaVieDEcl8EfzgKv8qTl2vWHBVaDB1was6 2N2kxf7sId7FuTuQr+yy57DiSkiBAdk= X-Google-Smtp-Source: APXvYqwMt11vPTxhpTJnKJEYF8h5Ry8RFNwMnCKrXt0VbxXWTSUPtLSCxmRF7ju+OLcojkce0u88Pw== X-Received: by 2002:a1c:2c41:: with SMTP id s62mr17890031wms.8.1562610614994; Mon, 08 Jul 2019 11:30:14 -0700 (PDT) Received: from [192.168.1.86] (118.red-193-153-99.dynamicip.rima-tde.net. [193.153.99.118]) by smtp.gmail.com with ESMTPSA id e3sm5386953wrt.93.2019.07.08.11.30.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 11:30:14 -0700 (PDT) To: List From: =?UTF-8?B?w4FsdmFybyBIZXJuw6FuZGV6?= Subject: SCRAM v2: adding support for Java7 and SaslPrep Cc: scram@ongres.com Message-ID: <8d3e1d34-d6e9-7448-fe38-a11fea2c63c3@ongres.com> Date: Mon, 8 Jul 2019 20:30:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk     Hi list.     We have been working on significant changes to the SCRAM library, that has been included in the pgJDBC driver. The most notable changes are: - Moved development to GitLab: https://gitlab.com/ongresinc/scram/ - Added support to Java7, to widen the user base. This meant slight changes to the "public facing" API and as such the library version is bumped to v2.0. - Added proper support for SaslPrep. Previous implementation just supported the "NO PREP" algorithm. This may cause problems with usernames and/or passwords that contain varied characters (say tildes, accents or general UTF-8 characters). Please note that we believe SaslPrep should also be code reusable by third parties, and as such it has been:     * Developed on a separate repository: https://gitlab.com/ongresinc/stringprep     * Added as a new (shaded) dependency. - More tests have been added.     Since this code works with Java7, we have created 2 PRs: one for pgjdbc, one for pgjdcb-jre7. They are for SCRAM version 1.9 (which added Java7 but not the stringprep dependency), and we plan to update them to the 2.0beta1 version, which is ready as of today. But there are two observed problems, where we need your input/coordination. Please check the currently submitted PRs:     * https://github.com/pgjdbc/pgjdbc/pull/1520     * https://github.com/pgjdbc/pgjdbc-jre7/pull/3     PR currently does not pass two CI jobs: * https://travis-ci.org/pgjdbc/pgjdbc/jobs/552706535: Seems that the script failed for some reasons not appearing in the job log. May be restarted? * https://travis-ci.org/pgjdbc/pgjdbc/jobs/552706542: build for Java7 is failing since there is another PR for pgjdbc-jre7 that fixes missing dependencies (scram). The only options I see to move on would be to ignore this build or to re-run the failed job pointing to the cloned repo with the pgjdbc-jre7 patch (maybe doable with a Travis CI custom build?). In other words, we have here a bit of a chicken-and-egg problem due to the way the pgjdbc / pgjdbc-jre7 split works currently. Ideas are welcome.     Waiting for your comments. Regards,     Álvaro P.S. Follows a slightly more detailed changelog, FYI: # Scram 2.0-beta1 - This version replaces the saslprep implementation with a dependency to an external library from a separated repository. The library is our clean room implementation of the stringprep (https://tools.ietf.org/html/rfc3454), put in a separate module to allow easy extension of other modules that depends on stringprep, as long as the saslprep (https://tools.ietf.org/html/rfc4013). The library source code can be found at https://gitlab.com/ongresinc/stringprep. The library stringprep has been implemented using Apache Velocity to generate the code with the rules of each step as thay appear in the stringprep RFC. - Add test of Scram-SaslPrep The library contains tests of each rule and saslprep (example of https://tools.ietf.org/html/rfc4013). # Scram 1.9-beta1 The changes included backport the library to work with Java 7 and add standard saslprep implementation. To do that, it has been necessary: - Remove all the Java 8 features. - Replace the crypto algorithm Base64 encode/decode and PBKDF2WithHmacSHA256 (no available in all versions of Java7). These crypto algorithms has been replaced with some classes from the project bouncy castle (They can be found into the folder common/src/main/java/com/ongres/scram/common/bouncycastle). Scram has been modified to try to use with all the security protocol implementation from the JVM and, in case PBKDF2WithHmacSHA256 is not available (like for Oracle JRE 7), use the implementation from bouncy castle. - Add new tests with SHA-256 (example of https://tools.ietf.org/html/rfc7677). - Include saslprep standard algorithm. Files common/src/main/java/com/ongres/scram/common/stringprep/SaslPrep.java and common/src/test/java/com/ongres/scram/common/stringprep/SaslPrepTest.java are copied from project saslprep developed by Tom Bentley (https://github.com/tombentley/saslprep). - Include saslprep tests (from https://tools.ietf.org/html/4013). -- Alvaro Hernandez ----------- OnGres