diff --git a/lib/agreement/EC/curve.ex b/lib/agreement/EC/curve.ex index 70bcfd4..5fa00d2 100644 --- a/lib/agreement/EC/curve.ex +++ b/lib/agreement/EC/curve.ex @@ -1,4 +1,5 @@ defmodule CA.Curve do + @moduledoc "CA Curve library." require CA.Integer require CA.Point defstruct [:A, :B, :P, :N, :G, :name, :oid] diff --git a/lib/agreement/EC/integer.ex b/lib/agreement/EC/integer.ex index 87a08c9..de8c788 100644 --- a/lib/agreement/EC/integer.ex +++ b/lib/agreement/EC/integer.ex @@ -1,4 +1,5 @@ defmodule CA.Integer do + @moduledoc "CA Integer library." import Bitwise def modulo(x, n), do: rem(x, n) |> correctNegativeModulo(n) diff --git a/lib/agreement/EC/jacobian.ex b/lib/agreement/EC/jacobian.ex index e9bf242..d9ea189 100644 --- a/lib/agreement/EC/jacobian.ex +++ b/lib/agreement/EC/jacobian.ex @@ -1,4 +1,5 @@ defmodule CA.Jacobian do + @moduledoc "CA Jacobian library." require CA.Integer require CA.Point diff --git a/lib/agreement/EC/point.ex b/lib/agreement/EC/point.ex index 72e3a17..382ef16 100644 --- a/lib/agreement/EC/point.ex +++ b/lib/agreement/EC/point.ex @@ -1,4 +1,5 @@ defmodule CA.Point do + @moduledoc "CA Point library." defstruct [:x, :y, z: 0] def isAtInfinity?(p) do p.y == 0 diff --git a/lib/agreement/ecc.ex b/lib/agreement/ecc.ex index e0e81dc..73917ac 100644 --- a/lib/agreement/ecc.ex +++ b/lib/agreement/ecc.ex @@ -1,4 +1,5 @@ defmodule CA.KnownCurves do + @moduledoc "CA/ECC library." require CA.Curve require CA.Point diff --git a/lib/services/cmp.ex b/lib/services/cmp.ex index 5a7c391..7f225ac 100644 --- a/lib/services/cmp.ex +++ b/lib/services/cmp.ex @@ -25,7 +25,7 @@ defmodule CA.CMP do def start(), do: {:ok, :erlang.spawn(fn -> listen(8829) end)} def listen(port) do - {:ok, socket} = :gen_tcp.listen(port, [:binary, {:packet, :raw}, {:active, false}, {:reuseaddr, true}, {:keepalive, true}]) + {:ok, socket} = :gen_tcp.listen(port, [:binary, {:active, false}, {:reuseaddr, true}]) accept(socket) end @@ -39,13 +39,18 @@ defmodule CA.CMP do case :gen_tcp.recv(socket, 0) do {:error, :closed} -> :exit {:ok, stage1} -> - [_headers|body] = :string.split stage1, "\r\n\r\n", :all - case body do + try do + [_headers|body] = :string.split stage1, "\r\n\r\n", :all + case body do [""] -> case :gen_tcp.recv(socket, 0) do {:error, :closed} -> :exit {:ok, stage2} -> handleMessage(socket,stage2) end - _ -> handleMessage(socket,body) end - loop(socket) + _ -> handleMessage(socket,body) + end + loop(socket) + catch _ -> + loop(socket) + end end end diff --git a/lib/services/http/get.ex b/lib/services/http/get.ex index d62bc02..5f6151a 100644 --- a/lib/services/http/get.ex +++ b/lib/services/http/get.ex @@ -1,4 +1,5 @@ defmodule CA.EST.Get do + @moduledoc "CA/ETS GET Method HTTP handlers." import Plug.Conn def get(conn, [], "Authority", [], "CA") do diff --git a/lib/services/http/post.ex b/lib/services/http/post.ex index ddd6e2f..f2aefa1 100644 --- a/lib/services/http/post.ex +++ b/lib/services/http/post.ex @@ -1,4 +1,5 @@ defmodule CA.EST.Post do + @moduledoc "CA/ETS POST Method HTTP handlers." import Plug.Conn def post(conn,_,type,id,spec) do # :io.format 'PUT/4:#{type}#{id}/#{spec}', [] diff --git a/openssl/ecc/maxim.pem b/openssl/ecc/maxim.pem index ad41b23..a3bda6f 100644 --- a/openssl/ecc/maxim.pem +++ b/openssl/ecc/maxim.pem @@ -1,15 +1,15 @@ -----BEGIN CERTIFICATE----- -MIICQDCCAcagAwIBAgIIFMeQFGQ/7HYwCgYIKoZIzj0EAwIwPTELMAkGA1UEBhMC -VUExETAPBgNVBAcMCNCa0LjRl9CyMQ4wDAYDVQQKDAVTWU5SQzELMAkGA1UEAwwC -Q0EwHhcNMjQxMTA1MTQ1NjUyWhcNMjUxMjA1MTUwMTUyWjA8MQswCQYDVQQGEwJV -QTENMAsGA1UECAwES3lpdjEOMAwGA1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