Skip to content

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

Merged
merged 4 commits into from
Mar 23, 2017
Merged

PKCS decoder fuzz test #938

merged 4 commits into from
Mar 23, 2017

Conversation

chrisdunelm
Copy link
Contributor

This fails without PR #937, passes with it

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 22, 2017
@chrisdunelm
Copy link
Contributor Author

/cc @evildour

@chrisdunelm chrisdunelm force-pushed the pkcs branch 2 times, most recently from 11401ae to 67ea814 Compare March 23, 2017 10:14
Copy link
Collaborator

@jskeet jskeet left a 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.

try
{
// Throws CryptographicException if the rsaParameters is invalid
key.ImportParameters(rsaParameters);

This comment was marked as spam.

This comment was marked as spam.

And make TrimLeadingZeroes() internal
@chrisdunelm chrisdunelm merged commit af500c6 into googleapis:master Mar 23, 2017
@chrisdunelm chrisdunelm deleted the pkcs branch March 23, 2017 15:07
// 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.

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants