Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ES256 Sign1 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikekelly
Copy link

Fairly self explanatory. Includes a test case from the main cose repo.

@geonnave
Copy link
Owner

Thank you for the PR! Will take a closer look soon.

Copy link
Owner

@geonnave geonnave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left some comments.

| signature: COSE.Keys.ECDSA.sign(:es256, to_be_signed, private_key)
}
end

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the introduced functions duplicate a fair amount of the body, including sign_encode(:es256 ...), sign(:es256, ...), etc. Could it be improved?

@@ -36,3 +60,38 @@ defmodule COSE.Keys.OKP do
:crypto.verify(:eddsa, :sha256, to_be_verified, signature, [ver_key.x, :ed25519])
end
end

defmodule COSE.Keys.ECDSA do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not following defining the key struct here, as in the rest of the library?

@@ -2,6 +2,30 @@ defmodule COSE.Keys.Symmetric do
defstruct [:kty, :kid, :alg, :key_ops, :base_iv, :k]
end

defmodule ECDSASignature do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we keep this module (see comment below about struct definition), the name should be COSE.Keys. ECDSASignature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants