-
Notifications
You must be signed in to change notification settings - Fork 30
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
add support for ecdsa signatures #108
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
ca5e60a
add a signature type
Geal 863c723
helper methods
Geal b242be8
indicate the algorithm of the next private key
Geal 92da6e8
cleanup
Geal 13581cf
start the boilerplate around managing multiple types of keys
Geal be9e6a4
start support for p256 signatures
Geal d0113b3
p256 support
Geal 36e7362
Merge branch 'master' into fipscuit
Geal ba0f80e
Merge branch 'main' into fipscuit
Geal ad56ade
reintroduce ed25519-dalek 2.0
Geal d0f335f
Merge branch 'main' into fipscuit
Geal b52b929
Merge branch 'main' into fipscuit
Geal 60514db
fix testcases
Geal 92f88f8
move impl
Geal 9a8cd39
PEM support
Geal daa0bfd
Merge branch 'main' into fipscuit
Geal 2985990
wip
Geal 410340e
Merge branch 'v5' into fipscuit
Geal 27da40e
update protobuf enum
Geal 93c2aae
update serialization formats
Geal f104b65
remove unuse code
Geal 047ded5
add samples
Geal 3bd1d04
parsing and printing
Geal d9d68bc
Merge branch 'v5' into fipscuit
Geal 5aeb701
fix sample file name
Geal 0c97e37
Merge branch 'v5' into fipscuit
Geal ce02b60
specify the algorithm when creating a KeyPair
Geal 8108420
capi fixes
Geal c7378ce
Merge branch 'v5' into fipscuit
Geal c88fff0
fix samples build
Geal 346d4de
make the algorithm Copy
Geal d58d352
Merge branch 'v5' into fipscuit
Geal 56fa6c3
Merge branch 'v5' into fipscuit
Geal 69f58dd
update for bwk
Geal cfc7de7
Merge branch 'v5' into fipscuit
Geal 86323c6
update bwk
Geal ae3d779
remove the Display implementation for public keys
Geal b0490ae
replace the Display implementation
Geal bdb8c74
From implementations
Geal da9dade
update p256
Geal 1e080fb
add a test for ecdsa parsing
Geal caeaad9
Update biscuit-auth/src/token/mod.rs
Geal 8ec8bba
Merge branch 'v5' into fipscuit
Geal 50b6306
Merge branch 'v5' into fipscuit
Geal 543d0f1
fix key_pair_new usage
Geal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ use rand::rngs::OsRng; | |
|
||
fn create_block_1(b: &mut Bencher) { | ||
let mut rng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it could be done in another PR, but adding benches for other signature algorithms would be nice (eg making the bench suite parametric on the algorithm, and running it for each supported algorithm) |
||
|
||
let mut builder = Biscuit::builder(); | ||
builder.add_fact(fact("right", &[string("file1"), string("read")])); | ||
|
@@ -40,8 +40,8 @@ fn create_block_1(b: &mut Bencher) { | |
|
||
fn append_block_2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let mut builder = Biscuit::builder(); | ||
builder.add_fact(fact("right", &[string("file1"), string("read")])); | ||
|
@@ -75,11 +75,11 @@ fn append_block_2(b: &mut Bencher) { | |
|
||
fn append_block_5(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let keypair3 = KeyPair::new_with_rng(&mut rng); | ||
let keypair4 = KeyPair::new_with_rng(&mut rng); | ||
let keypair5 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair3 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair4 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair5 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let mut builder = Biscuit::builder(); | ||
builder.add_fact(fact("right", &[string("file1"), string("read")])); | ||
|
@@ -129,8 +129,8 @@ fn append_block_5(b: &mut Bencher) { | |
|
||
fn unverified_append_block_2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let mut builder = Biscuit::builder(); | ||
builder.add_fact(fact("right", &[string("file1"), string("read")])); | ||
|
@@ -164,11 +164,11 @@ fn unverified_append_block_2(b: &mut Bencher) { | |
|
||
fn unverified_append_block_5(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let keypair3 = KeyPair::new_with_rng(&mut rng); | ||
let keypair4 = KeyPair::new_with_rng(&mut rng); | ||
let keypair5 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair3 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair4 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair5 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let mut builder = Biscuit::builder(); | ||
builder.add_fact(fact("right", &[string("file1"), string("read")])); | ||
|
@@ -218,8 +218,8 @@ fn unverified_append_block_5(b: &mut Bencher) { | |
|
||
fn verify_block_2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -269,11 +269,11 @@ fn verify_block_2(b: &mut Bencher) { | |
|
||
fn verify_block_5(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let keypair3 = KeyPair::new_with_rng(&mut rng); | ||
let keypair4 = KeyPair::new_with_rng(&mut rng); | ||
let keypair5 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair3 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair4 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair5 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -348,8 +348,8 @@ fn verify_block_5(b: &mut Bencher) { | |
|
||
fn check_signature_2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -390,11 +390,11 @@ fn check_signature_2(b: &mut Bencher) { | |
|
||
fn check_signature_5(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let keypair3 = KeyPair::new_with_rng(&mut rng); | ||
let keypair4 = KeyPair::new_with_rng(&mut rng); | ||
let keypair5 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair3 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair4 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair5 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -458,8 +458,8 @@ fn check_signature_5(b: &mut Bencher) { | |
|
||
fn checks_block_2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -510,8 +510,8 @@ fn checks_block_2(b: &mut Bencher) { | |
|
||
fn checks_block_create_verifier2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
@@ -553,8 +553,8 @@ fn checks_block_create_verifier2(b: &mut Bencher) { | |
|
||
fn checks_block_verify_only2(b: &mut Bencher) { | ||
let mut rng: OsRng = OsRng; | ||
let root = KeyPair::new_with_rng(&mut rng); | ||
let keypair2 = KeyPair::new_with_rng(&mut rng); | ||
let root = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
let keypair2 = KeyPair::new_with_rng(Algorithm::Ed25519, &mut rng); | ||
|
||
let data = { | ||
let mut builder = Biscuit::builder(); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should we feature-gate ecdsa support?
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.
we can, but what would it bring? Reducing the number of dependencies?
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.
yes, that’s what we’ve done for pem/der support iirc
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.
the API already exposes the algorithm in key creation everywhere, feature gating it after that would make it a little bit more annoying