-
Notifications
You must be signed in to change notification settings - Fork 33
refactor(picky-asn1-der): remove num-bigint-dig
#427
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
Merged
Merged
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| extern crate num_bigint_dig as num_bigint; | ||
|
|
||
| mod pki_tests; | ||
|
|
||
| use num_bigint::ToBigInt; | ||
| use crypto_bigint::BoxedUint; | ||
| use oid::prelude::*; | ||
| use picky_asn1::bit_string::BitString; | ||
| use picky_asn1::date::{Date, GeneralizedTime, UTCTime}; | ||
|
|
@@ -107,7 +105,7 @@ fn big_integer() { | |
| #[test] | ||
| fn small_integer() { | ||
| let buffer = [0x02, 0x01, 0x03]; | ||
| let big_integer = IntegerAsn1::from(3.to_bigint().unwrap().to_signed_bytes_be()); | ||
| let big_integer = IntegerAsn1::from(BoxedUint::from(3u32).to_be_bytes_trimmed_vartime().into_vec()); | ||
|
|
||
| assert!(big_integer.is_positive()); | ||
| assert!(!big_integer.is_negative()); | ||
|
|
@@ -116,18 +114,6 @@ fn small_integer() { | |
| check(&buffer, big_integer); | ||
| } | ||
|
|
||
| #[test] | ||
| fn small_integer_negative() { | ||
| let buffer = [0x02, 0x01, 0xF9]; | ||
| let big_integer = IntegerAsn1::from((-7).to_bigint().unwrap().to_signed_bytes_be()); | ||
|
|
||
| assert!(!big_integer.is_positive()); | ||
| assert!(big_integer.is_negative()); | ||
| assert_eq!(big_integer.as_unsigned_bytes_be(), &[0xF9]); | ||
|
|
||
| check(&buffer, big_integer); | ||
| } | ||
|
|
||
| #[test] | ||
| fn date() { | ||
| let buffer = [ | ||
|
|
@@ -225,13 +211,6 @@ fn sequence_of() { | |
| check(&buffer, set_of_elems); | ||
| } | ||
|
|
||
| #[test] | ||
| fn application_tag0() { | ||
|
Collaborator
Author
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. |
||
| let buffer = [0xA0, 0x03, 0x02, 0x01, 0xF9]; | ||
| let application_tag = ExplicitContextTag0(IntegerAsn1::from((-7).to_bigint().unwrap().to_signed_bytes_be())); | ||
| check(&buffer, application_tag); | ||
| } | ||
|
|
||
| #[test] | ||
| fn restricted_strings() { | ||
| let printable_string_buffer = b"\x13\x02\x4E\x4C"; | ||
|
|
||
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.
Unfortunately, there is no logic of
to_signed_bytes_befrom a bigIntpresent in crypto-bigint, so I tried to work around it, but it didn't work. So, I had to choose only this option.