Skip to content

Commit

Permalink
secp384r1 logs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Oct 23, 2024
1 parent 9d61265 commit 7e59ec8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 1 addition & 6 deletions lib/curves/ecdsa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ defmodule CA.ECDSA do
end

def private(bin), do: :erlang.element(2,X509.PrivateKey.from_pem(bin))
def public(bin), do: #:erlang.element(1,:erlang.element(2,
:public_key.pem_entry_decode(hd(:public_key.pem_decode(bin)))
def public(bin), do: :public_key.pem_entry_decode(hd(:public_key.pem_decode(bin)))

def numberFromString(string) do
Base.encode16(string)
Expand All @@ -34,9 +33,6 @@ defmodule CA.ECDSA do
xs = :binary.part(bin, 0, baseLength)
ys = :binary.part(bin, baseLength, :erlang.size(bin) - baseLength)
point = %CA.Point{ x: numberFromString(xs), y: numberFromString(ys)}
:io.format 'ECPoint.x: ~p~n', [xs]
:io.format 'ECPoint.y: ~p~n', [ys]
:io.format 'ECPoint: ~p~n', [point]
point
end

Expand All @@ -47,7 +43,6 @@ defmodule CA.ECDSA do
end

def verify(message, {r,s}, publicKey, options) do
:io.format '{r,s}: ~p~n', [{r,s}]
%{hashfunc: hashfunc} = Enum.into(options, %{hashfunc: :sha256})
number = :crypto.hash(hashfunc, message) |> numberFromString()
curve = CA.KnownCurves.secp384r1()
Expand Down
2 changes: 0 additions & 2 deletions lib/ecdsa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ defmodule CA.ECDSA.OTP do
def signature(name) do
{:ok, sig} = :file.read_file name
{{_,[{_,r},{_,s}]},""} = :asn1rt_nif.decode_ber_tlv sig
:io.format 'r: ~p~n', [r]
:io.format 's: ~p~n', [s]
{ :ca_enroll.decode_integer(r),
:ca_enroll.decode_integer(s) }
end
Expand Down

0 comments on commit 7e59ec8

Please sign in to comment.