-
Notifications
You must be signed in to change notification settings - Fork 20
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
Issue with RSA KeyGen 186-5 testing #293
Comments
Hi @graponi - the issue with the above is that if you're running with Edit: Misspoke saying prompt, meant answers. |
Am Dienstag, 24. Oktober 2023, 21:14:19 CEST schrieb Joel Brockman:
Hi Joel,
Hi @graponi - the issue with the above is that if you're running with
`infoGeneratedByServer: 'false'`, you'll need to fill out the RSA key data
in the prompt file to test with your implementation, then use that for your
validations. If you want to test without doing that, just flip that to
`true` and it will generate the keys. You can also make it a sample
(isSample: true) to get it to generate as well.
May I ask you to be a bit more specific what exactly you are referring to? The
documentation in [1] does not provide any hint that specific information needs
to be provided. Further, seemingly the registration is similar to the example
provided in [1] which has infoGeneratedByServer: false.
Also, wouldn't it be helpful that the server returns an error that some
information missing instead of an error that looks like the server-side has an
issue?
[1] https://github.com/usnistgov/ACVP/blob/master/src/rsa/sections/05-keygen-capabilities.adoc
Ciao
Stephan
|
@smuellerDD When run without data generated by the server, it's expecting the iut to provide that. You get a prompt file with all the test cases listed, but in a deferred state. "algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "standard",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true
},
{
"tcId": 2,
"deferred": true
}, You will get an "empty" answer file that needs to be filled in for validation. {
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "",
"p": "",
"q": "",
"d": ""
},
{
"tcId": 2,
"e": "",
"p": "",
"q": "",
"d": ""
}, The expectedAnswers file will look like this: {
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "standard",
"primeTest": "invalid",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true,
"e": "",
"p": "",
"q": "",
"d": "",
"dmp1": "",
"dmq1": "",
"iqmp": ""
}, ACVP-Server then checks for the deferred state setting, and then does crypto operations on the provided data from the answers file and checks against that. I agree that the example should be true by default, and that the error is not informative at all. I will look into making the documentation and error message more verbose and informative, apologies for that. |
Am Mittwoch, 25. Oktober 2023, 15:10:21 CEST schrieb Joel Brockman:
Hi Joel,
@smuellerDD When run without data generated by the server, it's expecting
the iut to provide that. You get a prompt file with all the test cases
listed, but in a deferred state.
```json
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "standard",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true
},
{
"tcId": 2,
"deferred": true
},
```
Just to be extra clear: when specifying the infoGeneratedByServer as false,
the initial request does NOT need to specify anything in particular beyond
what you stated above?!
If so, that seems to be exactly what is sent to the server and the server
returns the mentioned error, i.e. it does not return any test vector.
You will get an "empty" answer file that needs to be filled in for
validation.
```json
{
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "",
"p": "",
"q": "",
"d": ""
},
{
"tcId": 2,
"e": "",
"p": "",
"q": "",
"d": ""
},
```
The expectedAnswers file will look like this:
```json
{
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "standard",
"primeTest": "invalid",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true,
"e": "",
"p": "",
"q": "",
"d": "",
"dmp1": "",
"dmq1": "",
"iqmp": ""
},
```
That all sounds very clear and as expected. But as said above, the server does
not return anything after submitting the initial request.
ACVP-Server then checks for the deferred state setting, and then does crypto
operations on the provided data from the answers file and checks against
that.
I agree that the example should be true by default, and that the error is
not informative at all. I will look into making the documentation and error
message more verbose and informative, apologies for that.
Ciao
Stephan
|
The error received is from Validation, not Generation. The info needs to be filled into the Answer's file, then submitted for Validation. When I run just Generation with the provided registration from graponi, I get the above files in their current state. Maybe I'm missing something? These are what are called for Deferred crypto: https://github.com/usnistgov/ACVP-Server/blob/master/gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/RSA/Fips186_5/KeyGen/DeferredTestCaseResolverAft.cs. |
Hi Joel, Could you please confirm that the issue is related to the response obtained using the 'infoGeneratedByServer=false' property?
In addition to that, could you please confirm that the expected file looks like this? From https://github.com/usnistgov/ACVP/blob/master/src/rsa/sections/07-keygen-responses.adoc : "If the 'keyFormat' of the test group is 'standard', then the client SHALL not include the 'dmp1', 'dmq1' and 'iqmp' properties. Those properties SHALL only be included if the 'keyFormat' is set to 'crt' for the Chinese Remainder Theorem." Also, looking at Table 2 - RSA Test Case Applicability Grid For AFT Responses, it seems that the only properties that should be present for the "provable" test case are: p, q, e, n, d, and seed (they're all present in the response file). Am I missing some detail?
|
Hi @graponi,
Can you please verify that the settings of
I am not sure from where I took the above examples, and your files are expired at this time, apologies. Running fresh examples though here are my files:
{
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-4",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"fixedPubExp": "010001",
"testType": "AFT",
"keyFormat": "standard",
"randPQ": "B.3.2",
"pubExp": "fixed",
"hashAlg": "SHA2-224",
"tests": [
{
"tcId": 1,
"deferred": true
},
{
"tcId": 2,
"deferred": true
}, {
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "crt",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true
}, Here is an example of the
{
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-4",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "010001",
"p": "",
"q": "",
"d": ""
}, {
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "",
"p": "",
"q": "",
"d": ""
},
{
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "",
"p": "",
"q": "",
"dmp1": "",
"dmq1": "",
"iqmp": ""
}, {
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-4",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"tests": [
{
"tcId": 1,
"e": "010001",
"p": "",
"q": "",
"dmp1": "",
"dmq1": "",
"iqmp": ""
}, This is what is expected, maybe some of the example files we're using are errored, or out of date, either way can you please verify this is what you would expect as well against anything you've run before or had experience with? Everything here seems to be working as intended, and maybe there's just some confusion with example usage or documentation I would need to update. |
Actually, looking through the above I see that the file quoted there as expectedResults is actually internalProjection, which just lists ALL the data for everything. This is the example of what I just ran: {
"vsId": 0,
"algorithm": "RSA",
"mode": "keyGen",
"revision": "FIPS186-5",
"isSample": false,
"testGroups": [
{
"tgId": 1,
"infoGeneratedByServer": false,
"modulo": 2048,
"testType": "AFT",
"keyFormat": "crt",
"primeTest": "invalid",
"randPQ": "provable",
"pubExp": "random",
"hashAlg": "SHA2-384",
"tests": [
{
"tcId": 1,
"deferred": true,
"e": "",
"p": "",
"q": "",
"d": "",
"dmp1": "",
"dmq1": "",
"iqmp": ""
}, Apologies for that confusion. |
Hi Joel, I executed two different ACVP tests covering the following RSA KeyGen test cases:
Unfortunately the 186-5 revision testing failed, showing the following output in the verdict.json file: [ From what I see, comparing the json structure and fields that I obtained with the ones you mentioned in your latest comment, it seems that the response file differs. Using revision 186-4 the RSA KeyGen test passed successfully even though the request/response .json files have the same structure as the requests and responses obtained for revision 186-5. |
Thanks @graponi for all the related info, I'll look into this. |
Hi @graponi, there was a recent change that made some values required, but they shouldn't be. I fixed this and the change will go out in the next patch. Apologies, thanks for bringing this to our attention! |
The fix for this is on Demo in release v1.1.0.33 |
The fix for this is on Prod in release v1.1.0.33 |
environment
Demo
testSessionId
450265
vsId
1913863
Algorithm registration
{
"revision":"FIPS186-5",
"algorithm":"RSA",
"mode":"keyGen",
"infoGeneratedByServer":false,
"pubExpMode":"random",
"keyFormat":"standard",
"capabilities":[
{
"randPQ":"provable",
"properties":[
{
"modulo":2048,
"hashAlg":[
"SHA2-384"
],
"primeTest":[
"2pow100"
],
"pMod8":0,
"qMod8":0
},
{
"modulo":3072,
"hashAlg":[
"SHA2-384"
],
"primeTest":[
"2pow100"
],
"pMod8":0,
"qMod8":0
},
{
"modulo":4096,
"hashAlg":[
"SHA2-384"
],
"primeTest":[
"2pow100"
],
"pMod8":0,
"qMod8":0
}
]
}
],
"prereqVals":[
{
"algorithm":"SHA",
"valValue":"same"
},
{
"algorithm":"DRBG",
"valValue":"same"
}
]
}
Excpected behavior
After posting the results, excpected to receive a verdict from the server.
Received the following response from the server:
[
{
"acvVersion": "1.0"
},
{
"error": "General exception. Contact service provider."
}
]
The text was updated successfully, but these errors were encountered: