-
Notifications
You must be signed in to change notification settings - Fork 534
PKCS decoder fuzz test #938
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
Conversation
/cc @evildour |
This fails without PR googleapis#937, passes with it
11401ae
to
67ea814
Compare
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.
Generally fine apart from a nit - one suggested change if possible, but only if it's reasonably simple to do.
// This test does take a few (possibly 10s of) seconds, longer than most unit tests. | ||
for (int i = 0; i < 1000; i++) | ||
{ | ||
// This SecureRandom construtor is deprecated, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
try | ||
{ | ||
// Throws CryptographicException if the rsaParameters is invalid | ||
key.ImportParameters(rsaParameters); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
And make TrimLeadingZeroes() internal
// Check that all the parameters exported are equal to the originally created parameters | ||
var exportedParams = key.ExportParameters(true); | ||
var privateKey = (Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters)keys.Private; | ||
Assert.That(Pkcs8.TrimLeadingZeroes(exportedParams.P, false), Is.EqualTo(privateKey.P.ToByteArrayUnsigned())); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This fails without PR #937, passes with it