Skip to content

Commit

Permalink
RELEASE/v1.1.0.32
Browse files Browse the repository at this point in the history
  • Loading branch information
livebe01 committed Dec 15, 2023
1 parent 7e77916 commit 74779fb
Show file tree
Hide file tree
Showing 12 changed files with 1,567 additions and 1,574 deletions.

Large diffs are not rendered by default.

1,534 changes: 767 additions & 767 deletions gen-val/json-files/RSA-DecryptionPrimitive-Sp800-56Br2/internalProjection.json

Large diffs are not rendered by default.

1,346 changes: 673 additions & 673 deletions gen-val/json-files/RSA-DecryptionPrimitive-Sp800-56Br2/prompt.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
2048,
3072,
4096
]
],
"pubExpMode": "random"
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void ShouldInvokeAesEncryptAtLeastTwelveTimes(int payloadSize)

_subject.Encrypt(new BitString(128), payload, false);

_cipher.Verify(v => v.ProcessPayload(It.IsAny<IModeBlockCipherParameters>()), Times.Exactly(expectedNumberOfInvocations), $"{expectedNumberOfInvocations} invokations expected.");
_cipher.Verify(v => v.ProcessPayload(It.IsAny<IModeBlockCipherParameters>()), Times.Exactly(expectedNumberOfInvocations), $"{expectedNumberOfInvocations} invocations expected.");
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ParameterValidateResponse Validate(Parameters parameters)

if (!parameters.PreHash && !parameters.Pure)
{
errors.Add("No valid mode chosen");
errors.Add("No valid signature generation mode chosen; PreHash or Pure must be true");
}

return new ParameterValidateResponse(errors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ParameterValidateResponse Validate(Parameters parameters)

if (!parameters.PreHash && !parameters.Pure)
{
errors.Add("No valid mode chosen");
errors.Add("No valid signature generation mode chosen; PreHash or Pure must be true");
}

return new ParameterValidateResponse(errors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,20 @@ public ParameterValidateResponse Validate(Parameters parameters)
errorResults.AddIfNotNullOrEmpty(ValidateArray(parameters.KeyFormat, VALID_KEY_FORMATS, "keyFormat"));
errorResults.AddIfNotNullOrEmpty(ValidateArray(parameters.Modulo, VALID_MODULI, "modulo"));

if (parameters.PublicExponentModes != null)
if (parameters.PublicExponentMode == PublicExponentModes.Invalid)
{
foreach (var mode in parameters.PublicExponentModes)
errorResults.Add("Invalid or no public exponent mode provided");
}

if (parameters.PublicExponentMode == PublicExponentModes.Fixed)
{
if (parameters.PublicExponentValue == null || parameters.PublicExponentValue.BitLength == 0)
{
errorResults.Add("No public exponent provided.");
}
else if (!RsaKeyHelper.IsValidExponent(parameters.PublicExponentValue.ToPositiveBigInteger()))
{
if (mode == PublicExponentModes.Invalid)
{
errorResults.Add("Invalid public exponent mode provided");
}
else if (mode== PublicExponentModes.Fixed)
{
if (parameters.PublicExponentValue == null || parameters.PublicExponentValue.BitLength == 0)
{
errorResults.Add("No public exponent provided.");
}
else if (!RsaKeyHelper.IsValidExponent(parameters.PublicExponentValue.ToPositiveBigInteger()))
{
errorResults.Add("Invalid public exponent provided.");
}
}
errorResults.Add("Invalid public exponent provided.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class Parameters : IParameters

[JsonProperty(PropertyName = "modulo")]
public int[] Modulo { get; set; }

[JsonProperty(PropertyName = "pubExpMode")]
public PublicExponentModes[] PublicExponentModes { get; set; }
public PublicExponentModes PublicExponentMode { get; set; }

[JsonProperty(PropertyName = "fixedPubExp")]
public BitString PublicExponentValue = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public Task<List<TestGroup>> BuildTestGroupsAsync(Parameters parameters)
{
foreach (var modulus in parameters.Modulo)
{
if (parameters.PublicExponentModes == null)
if (parameters.PublicExponentMode == PublicExponentModes.Random)
{
groups.Add(new TestGroup
{
Expand All @@ -32,18 +32,15 @@ public Task<List<TestGroup>> BuildTestGroupsAsync(Parameters parameters)
}
else
{
foreach (var mode in parameters.PublicExponentModes)
groups.Add(new TestGroup
{
groups.Add(new TestGroup
{
Modulo = modulus,
KeyMode = format,
TestType = TEST_TYPE,
TestCaseExpectationProvider = new TestCaseExpectationProvider(parameters.IsSample),
PublicExponentMode = mode,
PublicExponent = mode == PublicExponentModes.Fixed ? parameters.PublicExponentValue : null
});
}
Modulo = modulus,
KeyMode = format,
TestType = TEST_TYPE,
TestCaseExpectationProvider = new TestCaseExpectationProvider(parameters.IsSample),
PublicExponentMode = parameters.PublicExponentMode,
PublicExponent = parameters.PublicExponentMode == PublicExponentModes.Fixed ? parameters.PublicExponentValue : null
});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected override string GetTestFileFewTestCases(string folderName)
IsSample = true,
KeyFormat = new PrivateKeyModes[] { PrivateKeyModes.Standard },
Modulo = new [] { 2048 },
// PublicExponentModes = new PublicExponentModes[]{ PublicExponentModes.Fixed, PublicExponentModes.Random },
// PublicExponentValue = new BitString("010001")
PublicExponentMode = PublicExponentModes.Fixed,
PublicExponentValue = new BitString("010001")
};

return CreateRegistration(folderName, p);
Expand All @@ -45,7 +45,7 @@ protected override string GetTestFileLotsOfTestCases(string folderName)
IsSample = false,
KeyFormat = new PrivateKeyModes[] { PrivateKeyModes.Standard, PrivateKeyModes.Crt },
Modulo = new [] { 2048, 3072, 4096 },
//PublicExponentModes = new PublicExponentModes[]{ PublicExponentModes.Random }
PublicExponentMode = PublicExponentModes.Random
};

return CreateRegistration(folderName, p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ShouldCreateCorrectNumberOfTestGroupsByModulus(int[] modulus)
IsSample = true,
Modulo = modulus,
KeyFormat = new [] { PrivateKeyModes.Standard },
PublicExponentModes = new PublicExponentModes[] { PublicExponentModes.Random }
PublicExponentMode = PublicExponentModes.Random
};

var tgGen = new TestGroupGenerator();
Expand All @@ -41,7 +41,7 @@ public async Task ShouldCreateCorrectNumberOfTestGroupsByKeyFormat(PrivateKeyMod
IsSample = true,
Modulo = new [] { 2048 },
KeyFormat = keyFormats,
PublicExponentModes = new PublicExponentModes[] { PublicExponentModes.Random }
PublicExponentMode = PublicExponentModes.Random
};

var tgGen = new TestGroupGenerator();
Expand Down

0 comments on commit 74779fb

Please sign in to comment.