-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for the PR! Will take a closer look soon. |
There was a problem hiding this 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 | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
.
Fairly self explanatory. Includes a test case from the main cose repo.