You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/05/24 20:25:19 UTC

[couchdb] branch jwtf-es256-fail-erlang-20 updated (ba6d78d4a -> cc1c6d758)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch jwtf-es256-fail-erlang-20
in repository https://gitbox.apache.org/repos/asf/couchdb.git


 discard ba6d78d4a Exclude jwtf EC algorithms on Erlang 20
 discard 793967191 Fix ES{256,384,512} support
     add a86c758de Fix ES{256,384,512} support
     new cc1c6d758 Cannot use EC algorithms on Erlang 20

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ba6d78d4a)
            \
             N -- N -- N   refs/heads/jwtf-es256-fail-erlang-20 (cc1c6d758)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/jwtf/test/jwtf_tests.erl | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)


[couchdb] 01/01: Cannot use EC algorithms on Erlang 20

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch jwtf-es256-fail-erlang-20
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit cc1c6d7581cc91164d47745ccefec293fb88cd09
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Tue May 24 16:21:37 2022 -0400

    Cannot use EC algorithms on Erlang 20
---
 src/jwtf/src/jwtf.erl        | 17 +++++++++++++++++
 src/jwtf/test/jwtf_tests.erl |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/jwtf/src/jwtf.erl b/src/jwtf/src/jwtf.erl
index f0a5bd6ca..e45a1ade1 100644
--- a/src/jwtf/src/jwtf.erl
+++ b/src/jwtf/src/jwtf.erl
@@ -29,6 +29,9 @@
 
 -include_lib("public_key/include/public_key.hrl").
 
+
+-ifdef(OTP_RELEASE).
+
 -define(ALGS, [
     % RSA PKCS#1 signature with SHA-256
     {<<"RS256">>, {public_key, sha256}},
@@ -42,6 +45,20 @@
     {<<"HS512">>, {hmac, sha512}}
 ]).
 
+-else.
+
+-define(ALGS, [
+    % RSA PKCS#1 signature with SHA-256
+    {<<"RS256">>, {public_key, sha256}},
+    {<<"RS384">>, {public_key, sha384}},
+    {<<"RS512">>, {public_key, sha512}},
+    {<<"HS256">>, {hmac, sha256}},
+    {<<"HS384">>, {hmac, sha384}},
+    {<<"HS512">>, {hmac, sha512}}
+]).
+
+-endif.
+
 -define(CHECKS, [
     alg,
     exp,
diff --git a/src/jwtf/test/jwtf_tests.erl b/src/jwtf/test/jwtf_tests.erl
index 2c66aa6db..a72e0d3ec 100644
--- a/src/jwtf/test/jwtf_tests.erl
+++ b/src/jwtf/test/jwtf_tests.erl
@@ -36,6 +36,8 @@ jwt_io_rsa_pubkey() ->
     [PEMEntry] = public_key:pem_decode(PublicKeyPEM),
     public_key:pem_entry_decode(PEMEntry).
 
+-ifdef(OTP_RELEASE).
+
 jwt_io_ec_pubkey() ->
     PublicKeyPEM = <<
         "-----BEGIN PUBLIC KEY-----\n"
@@ -46,6 +48,8 @@ jwt_io_ec_pubkey() ->
     [PEMEntry] = public_key:pem_decode(PublicKeyPEM),
     public_key:pem_entry_decode(PEMEntry).
 
+-endif.
+
 b64_badarg_test() ->
     Encoded = <<"0.0.0">>,
     ?assertEqual(
@@ -285,6 +289,8 @@ rs256_test() ->
 
     ?assertMatch({ok, ExpectedPayload}, jwtf:decode(EncodedToken, Checks, KS)).
 
+
+-ifdef(OTP_RELEASE).
 %% jwt.io generated
 es256_test() ->
     EncodedToken = <<
@@ -306,6 +312,8 @@ es256_test() ->
 
     ?assertMatch({ok, ExpectedPayload}, jwtf:decode(EncodedToken, Checks, KS)).
 
+-endif.
+
 encode_missing_alg_test() ->
     ?assertEqual(
         {error, {bad_request, <<"Missing alg header parameter">>}},