Skip to content

Commit

Permalink
Version 1.8.4
Browse files Browse the repository at this point in the history
* Enhancements
  * Add support for reading and writing PEM files for Ed25519, Ed448, X25519, and X448 keys based on https://tools.ietf.org/html/draft-ietf-curdle-pkix.
  * Add support for https://github.com/potatosalad/erlang-json adapter for encoding/decoding JSON.
  • Loading branch information
potatosalad committed May 19, 2017
1 parent feeba51 commit f8f97fb
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 30 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ notifications:
email: false

env:
- OTP_VERSION=18.3 ELIXIR_VERSION=1.2.6
- OTP_VERSION=19.3 ELIXIR_VERSION=1.4.1
- OTP_VERSION=19.3 ELIXIR_VERSION=1.4.2

cache:
directories:
- docker-otp-18.3-elixir-1.2.6
- docker-otp-19.3-elixir-1.4.1
- docker-otp-19.3-elixir-1.4.2
- test/cavp_SUITE_data/186-3rsatestvectors
- test/cavp_SUITE_data/aesmmt
- test/cavp_SUITE_data/archive
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.8.4 (2017-05-18)

* Enhancements
* Add support for reading and writing PEM files for Ed25519, Ed448, X25519, and X448 keys based on [draft-ietf-curdle-pkix](https://tools.ietf.org/html/draft-ietf-curdle-pkix).
* Add support for [ojson](https://github.com/potatosalad/erlang-json) adapter for encoding/decoding JSON.

## 1.8.3 (2017-03-30)

* Fixes
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PROJECT = jose
PROJECT_DESCRIPTION = JSON Object Signing and Encryption (JOSE) for Erlang and Elixir.
PROJECT_VERSION = 1.8.3
PROJECT_VERSION = 1.8.4

DEPS = base64url

Expand Down
1 change: 1 addition & 0 deletions lib/jose.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ defmodule JOSE do
Currently supported JSON modules (first found is used as default):
* [`ojson`](https://github.com/potatosalad/erlang-ojson)
* [`Poison`](https://github.com/devinus/poison)
* [`jiffy`](https://github.com/davisp/jiffy)
* [`jsone`](https://github.com/sile/jsone)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule JOSE.Mixfile do

def project do
[app: :jose,
version: "1.8.3",
version: "1.8.4",
elixir: "~> 1.0",
erlc_options: erlc_options(),
build_embedded: Mix.env == :prod,
Expand Down
17 changes: 9 additions & 8 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
%{"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], []},
%{"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
"cutkey": {:git, "https://github.com/potatosalad/cutkey.git", "47640d04fb4db4a0b79168d7fca0df87aaa42751", []},
"earmark": {:hex, :earmark, "1.2.0", "bf1ce17aea43ab62f6943b97bd6e3dc032ce45d4f787504e3adf738e54b42f3a", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.15.0", "e73333785eef3488cf9144a6e847d3d647e67d02bd6fdac500687854dd5c599f", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]},
"jsone": {:hex, :jsone, "1.4.3", "6d5f802136249e64f9d4997043b13355c6eac314217dc3b19bf3677e351a0641", [:rebar3], []},
"jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [:mix, :rebar3], []},
"libdecaf": {:hex, :libdecaf, "0.0.4", "c1caa4c4aaea356f89372debd0a672251111c2b2236e1b1e8a0f5bc271b60af4", [:rebar3], []},
"libsodium": {:hex, :libsodium, "0.0.10", "24584e6f5a60aed53542054c15fb31719bbf2d811d9a84f626734faf64d41304", [:rebar3], []},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}}
"earmark": {:hex, :earmark, "1.2.2", "f718159d6b65068e8daeef709ccddae5f7fdc770707d82e7d126f584cd925b74", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.15.1", "d5f9d588fd802152516fccfdb96d6073753f77314fcfee892b15b6724ca0d596", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"jsone": {:hex, :jsone, "1.4.3", "6d5f802136249e64f9d4997043b13355c6eac314217dc3b19bf3677e351a0641", [:rebar3], [], "hexpm"},
"jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [:mix, :rebar3], [], "hexpm"},
"libdecaf": {:hex, :libdecaf, "0.0.4", "c1caa4c4aaea356f89372debd0a672251111c2b2236e1b1e8a0f5bc271b60af4", [:rebar3], [], "hexpm"},
"libsodium": {:hex, :libsodium, "0.0.10", "24584e6f5a60aed53542054c15fb31719bbf2d811d9a84f626734faf64d41304", [:rebar3], [], "hexpm"},
"ojson": {:hex, :ojson, "1.0.0", "fd28614eadaec00a15cdb2f53f29d8717a812a508ddb80d202f2f2e2aaeabbcc", [:mix, :rebar3], [], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}}
2 changes: 1 addition & 1 deletion src/jose.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%% vim: ts=4 sw=4 ft=erlang noet
{application, jose, [
{description, "JSON Object Signing and Encryption (JOSE) for Erlang and Elixir."},
{vsn, "1.8.3"},
{vsn, "1.8.4"},
{id, "git"},
{mod, {'jose_app', []}},
{registered, []},
Expand Down
46 changes: 31 additions & 15 deletions test/jose_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
-module(jose_SUITE).

-include_lib("common_test/include/ct.hrl").
-include_lib("jose/include/jose_public_key.hrl").
-include_lib("public_key/include/public_key.hrl").

-include("jose.hrl").
Expand Down Expand Up @@ -143,9 +144,12 @@ jose_cfrg_curves_a_1(Config) ->
A_1_JWK = jose_jwk:from_file(data_file("jose_cfrg_curves/a.1.jwk+json", Config)),
A_1_Secret = hex:hex_to_bin(?config("a.1.secret", C)),
A_1_PK = hex:hex_to_bin(?config("a.1.pk", C)),
A_1_SK = << A_1_Secret/binary, A_1_PK/binary >>,
{_, A_1_SK} = jose_jwk:to_key(A_1_JWK),
{_, A_1_PK} = jose_jwk:to_public_key(A_1_JWK),
% A_1_SK = << A_1_Secret/binary, A_1_PK/binary >>,
{_, #'jose_EdDSA25519PrivateKey'{
publicKey=#'jose_EdDSA25519PublicKey'{publicKey=A_1_PK},
privateKey=A_1_Secret
}} = jose_jwk:to_key(A_1_JWK),
{_, #'jose_EdDSA25519PublicKey'{publicKey=A_1_PK}} = jose_jwk:to_public_key(A_1_JWK),
ok.

% CFRG ECDH and signatures in JOSE
Expand Down Expand Up @@ -242,12 +246,18 @@ jose_cfrg_curves_a_6(Config) ->
A_6_EPK_SK = << A_6_EPK_Secret/binary, A_6_EPK_PK/binary >>,
A_6_BOB_S_JWK = jose_jwk:from_okp({'X25519', A_6_BOB_SK}),
A_6_EPK_S_JWK = jose_jwk:from_okp({'X25519', A_6_EPK_SK}),
{_, A_6_BOB_SK} = jose_jwk:to_key(A_6_BOB_S_JWK),
{_, A_6_BOB_PK} = jose_jwk:to_public_key(A_6_BOB_S_JWK),
{_, A_6_BOB_PK} = jose_jwk:to_key(A_6_BOB_JWK),
{_, A_6_EPK_SK} = jose_jwk:to_key(A_6_EPK_S_JWK),
{_, A_6_EPK_PK} = jose_jwk:to_public_key(A_6_EPK_S_JWK),
{_, A_6_EPK_PK} = jose_jwk:to_key(A_6_EPK_JWK),
{_, #'jose_X25519PrivateKey'{
publicKey=#'jose_X25519PublicKey'{publicKey=A_6_BOB_PK},
privateKey=A_6_BOB_Secret
}} = jose_jwk:to_key(A_6_BOB_S_JWK),
{_, #'jose_X25519PublicKey'{publicKey=A_6_BOB_PK}} = jose_jwk:to_public_key(A_6_BOB_S_JWK),
{_, #'jose_X25519PublicKey'{publicKey=A_6_BOB_PK}} = jose_jwk:to_key(A_6_BOB_JWK),
{_, #'jose_X25519PrivateKey'{
publicKey=#'jose_X25519PublicKey'{publicKey=A_6_EPK_PK},
privateKey=A_6_EPK_Secret
}} = jose_jwk:to_key(A_6_EPK_S_JWK),
{_, #'jose_X25519PublicKey'{publicKey=A_6_EPK_PK}} = jose_jwk:to_public_key(A_6_EPK_S_JWK),
{_, #'jose_X25519PublicKey'{publicKey=A_6_EPK_PK}} = jose_jwk:to_key(A_6_EPK_JWK),
A_6_Z = jose_jwk:shared_secret(A_6_BOB_JWK, A_6_EPK_S_JWK),
A_6_Z = jose_jwk:shared_secret(A_6_EPK_JWK, A_6_BOB_S_JWK),
A_6_TEXT = <<"Example of X25519 encryption">>,
Expand Down Expand Up @@ -276,12 +286,18 @@ jose_cfrg_curves_a_7(Config) ->
A_7_EPK_SK = << A_7_EPK_Secret/binary, A_7_EPK_PK/binary >>,
A_7_BOB_S_JWK = jose_jwk:from_okp({'X448', A_7_BOB_SK}),
A_7_EPK_S_JWK = jose_jwk:from_okp({'X448', A_7_EPK_SK}),
{_, A_7_BOB_SK} = jose_jwk:to_key(A_7_BOB_S_JWK),
{_, A_7_BOB_PK} = jose_jwk:to_public_key(A_7_BOB_S_JWK),
{_, A_7_BOB_PK} = jose_jwk:to_key(A_7_BOB_JWK),
{_, A_7_EPK_SK} = jose_jwk:to_key(A_7_EPK_S_JWK),
{_, A_7_EPK_PK} = jose_jwk:to_public_key(A_7_EPK_S_JWK),
{_, A_7_EPK_PK} = jose_jwk:to_key(A_7_EPK_JWK),
{_, #'jose_X448PrivateKey'{
publicKey=#'jose_X448PublicKey'{publicKey=A_7_BOB_PK},
privateKey=A_7_BOB_Secret
}} = jose_jwk:to_key(A_7_BOB_S_JWK),
{_, #'jose_X448PublicKey'{publicKey=A_7_BOB_PK}} = jose_jwk:to_public_key(A_7_BOB_S_JWK),
{_, #'jose_X448PublicKey'{publicKey=A_7_BOB_PK}} = jose_jwk:to_key(A_7_BOB_JWK),
{_, #'jose_X448PrivateKey'{
publicKey=#'jose_X448PublicKey'{publicKey=A_7_EPK_PK},
privateKey=A_7_EPK_Secret
}} = jose_jwk:to_key(A_7_EPK_S_JWK),
{_, #'jose_X448PublicKey'{publicKey=A_7_EPK_PK}} = jose_jwk:to_public_key(A_7_EPK_S_JWK),
{_, #'jose_X448PublicKey'{publicKey=A_7_EPK_PK}} = jose_jwk:to_key(A_7_EPK_JWK),
A_7_Z = jose_jwk:shared_secret(A_7_BOB_JWK, A_7_EPK_S_JWK),
A_7_Z = jose_jwk:shared_secret(A_7_EPK_JWK, A_7_BOB_S_JWK),
A_7_TEXT = <<"Example of X448 encryption">>,
Expand Down

0 comments on commit f8f97fb

Please sign in to comment.